[DO NOT MERGE] Enablement for specific input #310
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
enabledWhen
doesn't have editor input, fie, document or any kind of input context for evaluation. It is used inContentTypeToLanguageServerDefinition#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 asIDocument
,IEditorInput
,IFile
etc. Therefore whenever there is input available we'd pass it over to ContentTypeToLanguageServerDefinition#isEnabledFor(Object input)rather than
isEnabled()`. 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!!!