diff --git a/src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt b/src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt index dc899b56..51c5f922 100644 --- a/src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt +++ b/src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt @@ -52,13 +52,14 @@ import java.util.concurrent.Future import java.util.stream.Stream class GlintLanguageServiceProvider(val project: Project) : JSLanguageServiceProvider { + val descriptor = getGlintDescriptor(project) override fun isHighlightingCandidate(file: VirtualFile) = file.fileType is HbFileType || file.fileType is JavaScriptFileType || file.fileType is TypeScriptFileType || file.fileType is GtsFileType - override fun getService(file: VirtualFile) = allServices.firstOrNull() + override fun getService(file: VirtualFile) = if (descriptor.isAvailable(file)) GlintTypeScriptService.getInstance(project) else null override val allServices: List - get() = if (EmberUtils.isEnabledEmberProject(project)) listOf(GlintTypeScriptService.getInstance(project)) else emptyList() + get() = if (descriptor.isAvailable(null)) listOf(GlintTypeScriptService.getInstance(project)) else emptyList() } diff --git a/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt b/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt index da1656a6..579f44b9 100644 --- a/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt +++ b/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt @@ -98,7 +98,7 @@ class GlintLspServerDescriptor(private val myProject: Project) : LspServerDescri return true } - fun isAvailable(vfile: VirtualFile): Boolean { + fun isAvailable(vfile: VirtualFile?): Boolean { val config = GlintConfiguration.getInstance(myProject) val pkg = config.getPackage() val path = pkg.`package`.constantPackage?.systemIndependentPath