Skip to content

Commit fd79a85

Browse files
Remove deprecated LSP API usage (#201)
1 parent be556d6 commit fd79a85

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ import com.intellij.lang.parameterInfo.CreateParameterInfoContext
2525
import com.intellij.lang.typescript.compiler.TypeScriptService
2626
import com.intellij.lang.typescript.compiler.languageService.TypeScriptLanguageServiceUtil
2727
import com.intellij.lang.typescript.compiler.languageService.codeFixes.TypeScriptSuppressByCommentFix
28-
import com.intellij.lang.typescript.compiler.languageService.protocol.commands.response.TypeScriptQuickInfoResponse
2928
import com.intellij.lang.typescript.lsp.BaseLspTypeScriptService
3029
import com.intellij.lang.typescript.lsp.LspAnnotationError
3130
import com.intellij.openapi.diagnostic.Logger
3231
import com.intellij.openapi.editor.Document
3332
import com.intellij.openapi.project.Project
3433
import com.intellij.openapi.util.TextRange
35-
import com.intellij.openapi.util.text.HtmlBuilder
3634
import com.intellij.openapi.vfs.VfsUtil
3735
import com.intellij.openapi.vfs.VirtualFile
3836
import com.intellij.platform.lsp.api.LspServerManager
39-
import com.intellij.platform.lsp.impl.LspServerImpl
4037
import com.intellij.platform.lsp.impl.highlighting.DiagnosticAndQuickFixes
4138
import com.intellij.psi.PsiElement
4239
import com.intellij.psi.PsiFile
@@ -47,7 +44,6 @@ import com.intellij.ui.EditorNotifications
4744
import com.intellij.util.containers.toMutableSmartList
4845
import org.eclipse.lsp4j.CompletionItem
4946
import org.eclipse.lsp4j.DiagnosticSeverity
50-
import org.eclipse.lsp4j.MarkupContent
5147
import java.net.URL
5248
import java.util.concurrent.CompletableFuture
5349
import java.util.concurrent.CompletableFuture.completedFuture
@@ -88,18 +84,6 @@ class GlintTypeScriptService(project: Project) : BaseLspTypeScriptService(projec
8884

8985
override val name = "Glint TypeScript LSP"
9086

91-
override fun isServiceCreated() = withServer { isRunning || isMalfunctioned } ?: false
92-
93-
override fun showStatusBar() = withServer { isServiceCreated() } ?: false
94-
95-
override fun getStatusText() = withServer {
96-
when {
97-
isRunning -> "Glint TypeScript LSP"
98-
isMalfunctioned -> "Glint LSP ⚠"
99-
else -> "..."
100-
}
101-
}
102-
10387
override fun getCompletionMergeStrategy(parameters: CompletionParameters, file: PsiFile, context: PsiElement): TypeScriptService.CompletionMergeStrategy {
10488
return TypeScriptLanguageServiceUtil.getCompletionMergeStrategy(parameters, file, context)
10589
}
@@ -156,7 +140,7 @@ class GlintTypeScriptService(project: Project) : BaseLspTypeScriptService(projec
156140
elem = DelegateElement(elem, element, document)
157141
}
158142

159-
val links = withServer { requestExecutor.getElementDefinitions(element.originalVirtualFile!!, (elem as PsiElement).textOffset) }
143+
val links = getServer()?.requestExecutor?.getElementDefinitions(element.originalVirtualFile!!, (elem as PsiElement).textOffset)
160144
val psiManager = PsiManager.getInstance(project)
161145
return links?.map {
162146
val vFile = VfsUtil.findFileByURL(URL(it.targetUri))
@@ -202,11 +186,11 @@ class GlintTypeScriptService(project: Project) : BaseLspTypeScriptService(projec
202186
file.fileType is JavaScriptFileType
203187
}
204188

205-
class GlintCompletionEntry(internal val item: CompletionItem) : TypeScriptService.CompletionEntry {
189+
class GlintCompletionEntry(internal val item: CompletionItem) : TypeScriptService.CompletionEntryBase() {
206190
override val name: String get() = item.label
207191
val detail: String? get() = item.detail
208192

209-
override fun intoLookupElement() = LookupElementBuilder.create(item.label)
193+
override fun createLookupElement() = LookupElementBuilder.create(item.label)
210194
.withTypeText(item.detail, true)
211195
.withInsertHandler(JSInsertHandler.DEFAULT)
212196
}

0 commit comments

Comments
 (0)