-
Notifications
You must be signed in to change notification settings - Fork 104
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
Implement file type defnition mapping #253
Conversation
private static Map<String, LSPExtensionManager> extToExtManager = new ConcurrentHashMap<>(); | ||
private static final Map<String, Set<LanguageServerWrapper>> projectToLanguageWrappers = new ConcurrentHashMap<>(); | ||
private static final Map<Pair<String, String>, LanguageServerDefinition> extToServerDefinition = new ConcurrentHashMap<>(); | ||
private static final Map<Pair<Class<? extends FileType>, String>, LanguageServerDefinition> fileTypeToServerDefinition = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit new to this but it might be a safe assumption to assume that all file types are singletons and have this be
private static final Map<Pair<FileType, String>, LanguageServerDefinition> fileTypeToServerDefinition = new ConcurrentHashMap<>();
@@ -67,7 +66,7 @@ public Object collectInformation(@NotNull PsiFile file, @NotNull Editor editor, | |||
VirtualFile virtualFile = file.getVirtualFile(); | |||
|
|||
// If the file is not supported, we skips the annotation by returning null. | |||
if (!FileUtils.isFileSupported(virtualFile) || !IntellijLanguageClient.isExtensionSupported(virtualFile)) { | |||
if (!FileUtils.isFileSupported(virtualFile) || !FileUtils.isFileSupported(virtualFile)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant checks
import org.eclipse.lsp4j.VersionedTextDocumentIdentifier; | ||
import org.wso2.lsp4intellij.client.languageserver.requestmanager.RequestManager; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import org.eclipse.lsp4j.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets avoid wildcard imports.
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets avoid wildcard imports.
I'm unlikely to come back to this. I've instead taken to writing a language plugin based off the Python language for my use case. Feel free to fix this up, or close this PR as you see fit. |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
Purpose
Resolves #252
Goals
Lots of files don't have extension:
Makefile
,Dockerfile
, and in my case:BUILD
files. Mapping a definition to a filetype also seems to fit into the Intellij framework better.Approach
Added a new map to IntellijLanguageClient and added new API methods to register definitions against a filetype.
Release note
LanguageServerDefinitions can now be registered against file types with IntellijLanguageClient#addServerDefinition