Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--doc writes lua's documentation instead of given module's #3002

Open
girvel opened this issue Dec 22, 2024 · 5 comments
Open

--doc writes lua's documentation instead of given module's #3002

girvel opened this issue Dec 22, 2024 · 5 comments

Comments

@girvel
Copy link

girvel commented Dec 22, 2024

How are you using the lua-language-server?

Command Line

Which OS are you using?

Windows WSL

What is the issue affecting?

Other

Expected Behaviour

Producing documentation for the given module

Actual Behaviour

Producing documentation for lua's builtin functions

Reproduction steps

  1. Create & cd into empty folder with a module.lua inside:
---@param x number
function foo(x) end
  1. Execute lua-language-server --doc=. --doc_out_path=.
  2. Get the doc.md & doc.json containing lua docs instead of module docs

Additional Notes

Tested on 3.13.5.

Log File

file_home_girvel_tmp_..log
service.log

@girvel
Copy link
Author

girvel commented Dec 22, 2024

Updated log files & additional notes. Sorry, was running with a slightly wrong command. Btw, it seems like almost any invalid command produces the same output without any indication of failure.

@tomlau10
Copy link
Contributor

The output file actually contains your foo global function doc, just that currently (and seems previously as well) it also contains the whole lua's built-in global table, which is reported here: #2977.

When you search foo in the output md, it is in between the built-in type filetype and function 🤦‍♂️
(due to alphabetical sorting I guess: fi < fo < fu)

# filetype


---

# foo


```lua
function foo(x: number)
```


---

# function

According to this reply: #2977 (comment), this is significantly noticeable after the heavy refactor in #2821, which changed the sorting of the exported docs.

  • Before it, the global table seems to come last, with user's types comes first
  • After it, all are sorted alphabetically (?), so user's types and the global table are interleaved.

@girvel
Copy link
Author

girvel commented Dec 23, 2024

Oh wow, I didn't notice that the documentation for the foo was generated. In the previous attempt when I provided the wrong path there were only built-in functions, so I gave up searching for it in the next one. Maybe it should fail or produce a warning when given the wrong path?

@tomlau10
Copy link
Contributor

Maybe it should fail or produce a warning when given the wrong path?

I am unsure about the meaning of wrong path when executing the --doc 😕.
Because in the view of the server, this is just a user supplied workspace root path, and there is no correct or wrong?

I guess at most the server can only verify the given directory exist?
And by no means the server would know that an existing path is wrong ?

@girvel
Copy link
Author

girvel commented Dec 25, 2024

Yeah, no, I meant wrong as "doesn't exist". Btw I wonder why the invalid path doesn't cause panic at the moment and if is there a pcall on reading the folder for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants