Skip to content

feat: Allow disabling the language server#47

Merged
taminomara merged 1 commit intosphinx-contrib:mainfrom
pieterlexis:disable-ls
Jan 29, 2026
Merged

feat: Allow disabling the language server#47
taminomara merged 1 commit intosphinx-contrib:mainfrom
pieterlexis:disable-ls

Conversation

@pieterlexis
Copy link
Contributor

Hello Lua-LS maintainers,

This PR adds the option to set lua_ls to disable. This will make the plugin not download or run any language server.

The usecase for this is the following. Our software (PowerDNS) has Lua as scripting language/hook engine embedded in our software. These Lua functions and objects are wrapped C++ objects and functions and hence we ship no Lua files. We do want to document all these objects and functions using the Sphinx/rst Lua domain for easy cross referencing in the docs. As this means we don't need to run a Language Server, it seemed a good idea to allow not running this.

If you need any changes to this PR, let me know.

Best regards,

Pieter Lexis

Copy link
Collaborator

@taminomara taminomara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Please, add checks to warn and early returns to run_apidoc and autoobject, otherwise they'll fail with somewhat obscure error.

Also, run pre-commit run --all to fix codestyle.

Other than this, everything else looks fine!

@pieterlexis
Copy link
Contributor Author

Please, add checks to warn and early returns to run_apidoc and autoobject, otherwise they'll fail with somewhat obscure error.

I'm not a sphinx expert, whereabouts would the early return for autoobject go? Is it in AutodocUtilsMixin.render? Thanks for any hints you may have.

Also, run pre-commit run --all to fix codestyle.

Will do!

Other than this, everything else looks fine!

Great!

@taminomara
Copy link
Collaborator

I'm not a sphinx expert, whereabouts would the early return for autoobject go? Is it in AutodocUtilsMixin.render? Thanks for any hints you may have.

In AutoObjectDirective.run, before prepare_options. You can do raise self.error("...").

@pieterlexis
Copy link
Contributor Author

Excellent, I added the returns/errors and now sphinx produces these errors when autodoc is enabled in conf.py and an .. autoobject:: is used:

image

Copy link
Collaborator

@taminomara taminomara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing 😸

Signed-off-by: Pieter Lexis <pieter.lexis@powerdns.com>
@taminomara taminomara merged commit b29c232 into sphinx-contrib:main Jan 29, 2026
9 checks passed
@taminomara
Copy link
Collaborator

Merged, will release in a few days.

@pieterlexis pieterlexis deleted the disable-ls branch January 29, 2026 19:02
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.

2 participants