ballerina-platform / lsp4intellij

This language client library provides language server protocol support for IntelliJ IDEA and other Jetbrains IDEs.
Apache License 2.0
438 stars 104 forks source link

How to update the list of extensions? #343

Closed payne911 closed 1 week ago

payne911 commented 10 months ago

This is what we run in a StartupActivity:

    val manager = OurLspExtensionManager()
    for (ext in SUPPORTED_FILE_EXTENSIONS) {
      IntellijLanguageClient.addExtensionManager(ext, manager)
    }
    val serverDefinition = OurServerDefinition(SUPPORTED_FILE_EXTENSIONS_STRING, command, repoRoot)
    IntellijLanguageClient.addServerDefinition(serverDefinition)

After startup, we want to allow users to add or remove to that list of supported file extensions. From what I gather, we should:

  1. Update the ServerDefinition and ExtensionManagers via methods provided by IntellijLanguageClient
  2. Call EditorEventManagerBase.forEditor(editor).wrapper.restart()

But it seems like there is no way to remove an extension in the step 1. What is the recommended way to approach this problem?

NipunaRanasinghe commented 1 week ago

@payne911 Currently there's no way to dynamically remove the file extensions added during the initialization phase. Please feel to open a feature request with your use case so that we can look into the possibility of supporting that.