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

Include prefix part in primary domain #416

Closed
stsewd opened this issue Jun 19, 2022 · 3 comments · Fixed by #495
Closed

Include prefix part in primary domain #416

stsewd opened this issue Jun 19, 2022 · 3 comments · Fixed by #495
Labels
enhancement New feature or request lsp Issues that relate to the language server

Comments

@stsewd
Copy link
Contributor

stsewd commented Jun 19, 2022

Currently, esbonio will list/return only the domain part when listing domains from the primary domain

# Items from the standard and primary domains don't require the namespace prefix
if name == "std" or name == primary_domain:
prefix = ""

But using the prefixed form is still valid and authors may use that form outside python docstrings to disambiguate from other domains.

This also makes the hover feature not work when used in a :py:fun: role, but it only works when used in :fun:.

I was about to make a PR making this an option, but I think maybe this should be the default behavior?

The same could be said about the std prefix, but I haven't that form being used in the wild.

@alcarney
Copy link
Member

I think you're right from an API perspective, that method should definitely be returning the prefix regardless.

Making that change however, will require refactoring the consumers of that method, otherwise completion suggestions for :fun: won't be generated anymore.

@stsewd
Copy link
Contributor Author

stsewd commented Jun 19, 2022

Making that change however, will require refactoring the consumers of that method, otherwise completion suggestions for :fun: won't be generated anymore.

Sorry I wasn't clear, I think esbonio should return both forms with and without prefix, that way hover and completion will keep working with both formats, as both are valid.

@alcarney
Copy link
Member

Sorry, I don't think I was clear either :)

I've just been thinking a lot about the internal API recently and it probably makes sense to adjust get_domains to return the prefix for all domains regardless of whether they're the primary one or not. Then generating completions for both :py:fun: and :fun: should be handled by the code that actually produces completion suggestions as directives like .. default-domain:: can change this on a per file basis anyway.

@alcarney alcarney added enhancement New feature or request lsp Issues that relate to the language server labels Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lsp Issues that relate to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants