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

Merge client's and global auto_complete_selector #2556

Open
rchl opened this issue Nov 14, 2024 · 0 comments
Open

Merge client's and global auto_complete_selector #2556

rchl opened this issue Nov 14, 2024 · 0 comments

Comments

@rchl
Copy link
Member

rchl commented Nov 14, 2024

When client specifies auto_complete_selector then it looks like currently it completely replaces the global auto_complete_selector:

LSP/plugin/session_view.py

Lines 210 to 220 in c7d622c

"""This method actually modifies the auto_complete_triggers entries for the view."""
selector = self.session.config.auto_complete_selector
if not selector:
# If the user did not set up an auto_complete_selector for this server configuration, fallback to the
# "global" auto_complete_selector of the view.
selector = str(settings.get("auto_complete_selector"))
trigger = {
"selector": selector,
# This key is not used by Sublime, but is used as a "breadcrumb" to figure out what needs to be removed
# from the auto_complete_triggers array once the session is stopped.
"server": self.session.config.name

Shouldn't there be a way to merge specified selector with the global one?

There are pros and cons of merging but I think it would make sense for the client to only care about special cases and still allow the global selectors to apply.

The example that made me file this is: I want to make LSP-typescript / LSP-vue provide completions within import paths (scope something like meta.import meta.string) but if I do that then now I also have to repeat global selectors and then the user potentially also has to override that setting manually to consider he's customizations to auto_complete_selector.

Implementation wise, the setting could optionally take an object with selector and strategy properties where stategy could be either replace or merge.

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

1 participant