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

Add optional description argument to app.add_config_value #12549

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Jul 12, 2024

Sphinx (+ extensions) has a lot of available configuration variables (>200),
which can make it not so user-friendly to write the conf.py,
whilst trying to remember them all or search for them on the sphinx/extension websites 😅

Allowing for the co-location of a short description on the configuration value,
can be utilised by external tools, like LSPs to provide better sphinx authoring support
(things like hover descriptions of variables in the conf.py)


Note, I already have auto-completion working 😄

autocomplete_sphinx_conf

@chrisjsewell chrisjsewell requested a review from AA-Turner July 12, 2024 00:19
@chrisjsewell chrisjsewell requested a review from picnixz July 12, 2024 01:11
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Oh... this can be very useful though I don't know if there's a PyCharm plugin for that. But if it can help people, I think it should be fine?

I assume that you want to add description to the built-in configuration values in a separate PR?

sphinx/application.py Outdated Show resolved Hide resolved
@chrisjsewell
Copy link
Member Author

I don't know if there's a PyCharm plugin for that

making a language server, that can work in most editors 😉

I assume that you want to add description to the built-in configuration values in a separate PR?

yep 👍, didn't want to go to the trouble for the API was agreed on


the only other thing I was thinking is if there could be some sort of category/categories option, to allow easier identification as to the origin of the config, e.g. app.add_config_value(..., categories=["my_extension", "html"])
don't know if you have any thought?

Co-authored-by: Bénédikt Tran <[email protected]>
@chrisjsewell chrisjsewell requested a review from picnixz July 12, 2024 17:00
@picnixz
Copy link
Member

picnixz commented Jul 12, 2024

app.add_config_value(..., categories=["my_extension", "html"])

I think it would be an overkill here. I would be happy to write a short description, but most of the time, I expect extension developers not to bother about the categories. Ideally, we could get the frame that called add_config_value automatically and add it internally and it would become easier (at least, we can have the defining module, maybe not the builder for which it was meant to).

I think it's preferrable to correctly name the configuration values rather than add 'categories' like this (for description, I see a reason for IDEs).

@chrisjsewell chrisjsewell changed the title Add optional description argument to Sphinx.add_config_value Add optional description argument to app.add_config_value Jul 12, 2024
@chrisjsewell chrisjsewell merged commit 78c8b4d into sphinx-doc:master Jul 12, 2024
23 checks passed
@chrisjsewell chrisjsewell deleted the config-description branch July 12, 2024 17:40
@AA-Turner AA-Turner added this to the 7.4.0 milestone Jul 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants