Skip to content

Commit

Permalink
add setting for disable lsp completion
Browse files Browse the repository at this point in the history
  • Loading branch information
onriv committed Oct 13, 2024
1 parent f925504 commit af5fe66
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/main/kotlin/lean4ij/lsp/LeanLSPCompletionFeature.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package lean4ij.lsp

import com.intellij.openapi.components.service
import com.intellij.psi.PsiFile
import com.redhat.devtools.lsp4ij.client.features.LSPCompletionFeature
import lean4ij.Lean4Settings

/**
* Add an impl for disable lsp completion for lean
* for sometimes it's slow...
*/
class LeanLSPCompletionFeature : LSPCompletionFeature() {

Check warning on line 12 in src/main/kotlin/lean4ij/lsp/LeanLSPCompletionFeature.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.redhat.devtools.lsp4ij.client.features.LSPCompletionFeature' is marked unstable with @ApiStatus.Experimental

Check warning on line 12 in src/main/kotlin/lean4ij/lsp/LeanLSPCompletionFeature.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'LSPCompletionFeature()' is declared in unstable class 'com.redhat.devtools.lsp4ij.client.features.LSPCompletionFeature' marked with @ApiStatus.Experimental
private val lean4Settings = service<Lean4Settings>()

override fun isEnabled(file: PsiFile): Boolean {

Check warning on line 15 in src/main/kotlin/lean4ij/lsp/LeanLSPCompletionFeature.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

Overridden method 'isEnabled(com.intellij.psi.@org.jetbrains.annotations.NotNull PsiFile)' is declared in unstable class 'com.redhat.devtools.lsp4ij.client.features.AbstractLSPDocumentFeature' marked with @ApiStatus.Experimental
return lean4Settings.enableLspCompletion
}
}
10 changes: 8 additions & 2 deletions src/main/kotlin/lean4ij/lsp/LeanLanguageServerFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.redhat.devtools.lsp4ij.LanguageServerEnablementSupport
import com.redhat.devtools.lsp4ij.LanguageServerFactory
import com.redhat.devtools.lsp4ij.client.LanguageClientImpl
import com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures
import com.redhat.devtools.lsp4ij.client.features.LSPCompletionFeature
import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider
import org.eclipse.lsp4j.services.LanguageServer
import java.util.concurrent.atomic.AtomicBoolean
Expand Down Expand Up @@ -51,4 +50,11 @@ class LeanLanguageServerFactory : LanguageServerFactory, LanguageServerEnablemen
override fun getServerInterface(): Class<out LanguageServer> {
return InternalLeanLanguageServer::class.java
}
}

override fun createClientFeatures(): LSPClientFeatures {

Check warning on line 54 in src/main/kotlin/lean4ij/lsp/LeanLanguageServerFactory.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures' is marked unstable with @ApiStatus.Experimental
return LSPClientFeatures().apply {

Check warning on line 55 in src/main/kotlin/lean4ij/lsp/LeanLanguageServerFactory.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'LSPClientFeatures()' is declared in unstable class 'com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures' marked with @ApiStatus.Experimental

Check warning on line 55 in src/main/kotlin/lean4ij/lsp/LeanLanguageServerFactory.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures' is marked unstable with @ApiStatus.Experimental
completionFeature = LeanLSPCompletionFeature()

Check warning on line 56 in src/main/kotlin/lean4ij/lsp/LeanLanguageServerFactory.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'setCompletionFeature(com.redhat.devtools.lsp4ij.client.features.@org.jetbrains.annotations.NotNull LSPCompletionFeature)' is declared in unstable class 'com.redhat.devtools.lsp4ij.client.features.LSPClientFeatures' marked with @ApiStatus.Experimental
}
}
}

0 comments on commit af5fe66

Please sign in to comment.