Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/kotlin/com/emberjs/glint/GlintLanguageService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<GlintTypeScriptService>
get() = if (EmberUtils.isEnabledEmberProject(project)) listOf(GlintTypeScriptService.getInstance(project)) else emptyList()
get() = if (descriptor.isAvailable(null)) listOf(GlintTypeScriptService.getInstance(project)) else emptyList()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading