-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Check if project is a MicroProfile, Qute, etc project to map file
with a language server Fixes #1185 Signed-off-by: azerr <[email protected]>
- Loading branch information
1 parent
2be23ca
commit dcc18f1
Showing
15 changed files
with
288 additions
and
107 deletions.
There are no files selected for viewing
18 changes: 15 additions & 3 deletions
18
src/main/java/com/redhat/devtools/intellij/lsp4ij/ContentTypeToLanguageServerDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
package com.redhat.devtools.intellij.lsp4ij; | ||
|
||
import com.intellij.lang.Language; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.AbstractMap; | ||
|
||
public class ContentTypeToLanguageServerDefinition extends AbstractMap.SimpleEntry<Language, LanguageServersRegistry.LanguageServerDefinition> { | ||
public ContentTypeToLanguageServerDefinition(@Nonnull Language language, | ||
@Nonnull LanguageServersRegistry.LanguageServerDefinition provider) { | ||
|
||
private final DocumentMatcher documentMatcher; | ||
|
||
public ContentTypeToLanguageServerDefinition(@NotNull Language language, | ||
@NotNull LanguageServersRegistry.LanguageServerDefinition provider, | ||
@NotNull DocumentMatcher documentMatcher) { | ||
super(language, provider); | ||
this.documentMatcher = documentMatcher; | ||
} | ||
|
||
public boolean match(VirtualFile file, Project project) { | ||
return documentMatcher.match(file, project); | ||
} | ||
|
||
public boolean isEnabled() { | ||
return true; | ||
return getValue().isEnabled(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/redhat/devtools/intellij/lsp4ij/DocumentMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.redhat.devtools.intellij.lsp4ij; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
|
||
public interface DocumentMatcher { | ||
|
||
boolean match(VirtualFile file, Project project); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.