Skip to content

[DO NOT MERGE] Enablement for specific input - #310

Closed
BoykoAlex wants to merge 1 commit into
eclipse-lsp4e:masterfrom
BoykoAlex:enablement
Closed

BoykoAlex wants to merge 1 commit into
eclipse-lsp4e:masterfrom
BoykoAlex:enablement

Conversation

@BoykoAlex

Copy link
Copy Markdown
Contributor

enabledWhen doesn't have editor input, fie, document or any kind of input context for evaluation. It is used in ContentTypeToLanguageServerDefinition#isEnabled() calls. These calls are made also from content type -> LS preference page which is independent of any input context.

I'm curious if it is worth making a similar enabledInputWhen tester able to take input context such as IDocument, IEditorInput, IFile etc. Therefore whenever there is input available we'd pass it over to ContentTypeToLanguageServerDefinition#isEnabledFor(Object input)rather thanisEnabled()`. The PR adds implementation for this.

The goal i have in mind is start Boot LS for a workspace that has at least one java project with spring boot on the classpath. Shut down Boot LS if there are no more Spring Boot projects left in the workspace. Now if Boot LS is shut down and user opens a Java file (or any other boot related content-type files) in an editor I wouldn't want to start Boot LS for a file that does not belong to a Spring Boot project. Hence, the enabledInputWhen would help in this case.
What do you think? Do you see any issues/obstacles achieving the goal above with the proposed PR?

Thanks in advance for feedback on this topic!!!

@BoykoAlex BoykoAlex changed the title [DON NOT MERGE] Enablement for specific input [DO NOT MERGE] Enablement for specific input Nov 18, 2022
@eclipsewebmaster
eclipsewebmaster deleted the branch eclipse-lsp4e:master May 21, 2024 14:09
@mickaelistria

Copy link
Copy Markdown
Contributor

The initial target branch master was deleted and replaced by main, so this PR got closed automatically. If this is still relevant, please re-create this PR targetting the main branch.

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.

3 participants