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

Config settings for path/filename of doc files. #2518

Closed
wants to merge 1 commit into from

Conversation

AndreasMatthias
Copy link
Contributor

  • Added 3 new configuration settings:

    • Lua.doc.output.path
    • Lua.doc.output.filenameJSON
    • Lua.doc.output.filenameMD
  • Documentation files will be saved in the given path/filename locations.

  • Default behavior: Not changed. If settings are missing, files will be saved in LOGPATH.

* Added 3 new configuration settings:
  - Lua.doc.output.path
  - Lua.doc.output.filenameJSON
  - Lua.doc.output.filenameMD

* Documentation files will be saved in the given path/filename
  locations.

* Default behavior: Not changed.
  If settings are missing, files will be saved in LOGPATH.
@AndreasMatthias
Copy link
Contributor Author

I'm sorry. This PR is not working as expected. I suppose I did not set rootUri correctly.

So far only

lua-language-server --doc ./

works correctly, but

lua-language-server --doc ./foo/bar/

does not.

I'll try to fix this.

@AndreasMatthias
Copy link
Contributor Author

Initialization of rootUri is a bit confusing to me. I'm not sure I really understood
everything, but it seems to me that rootUri is set differently depending on how you are
running LuaLS.

  • If you run LuaLS as an LSP-Server, rootUri points to the root of the workspace.
    And it reads .luarc.json from this root.

  • But if you run LuaLS in documentation mode, e.g. as lua-language-server --doc ./sub/path/,
    rootUri points to ./sub/path/, which is a subpath of the workspace, but not
    the root of the workspace.

From this it follows that documentaion mode will document your project starting
at ./sub/path (and not at the root of your workspace), which is quite a nice feature.

On the other hand this only works, because documentation mode doesn't need to know
about the actual root of the workspace. But this becomes an issue if you want to
read .luarc.json, because .luarc.json lies at the actual root of the workspace,
but documentation mode doesn't know where this root of the workspace is. Therefore
it seems to be quite difficult, to read settings from .luarc.json while you are
in documentation mode. Unfortunately this is exactly what I wanted to do: Set the path/filename
of the documentation file (doc.json) in .luarc.json, and use these settings
in documentation mode.

(And since the database created in vm depends on rootUri things get very complicated,
if you try to modify rootUri to read .luarc.json.)

I'm afraid this description might not be completely correct, but hopefully it is not too
wrong either. Anyway it seems to me that I will not succeed following this path.

What do you think? What's the best way to set the path of the documentation file?
With .luarc.json settings? Or with a new program argument (program flag)?
I'd prefer to set the path relative to the root of the workspace.

FWIW: I'd like to do some postprocessing of doc.json in my project. But collaborating
with other people would definitely be easier, if doc.json were somewhere in the
project directory and not in the log-path of LuaLS.

@AndreasMatthias
Copy link
Contributor Author

I close it, since this PR is not working and I don't get any further on this.

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

Successfully merging this pull request may close these issues.

1 participant