Skip to content
Merged
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
17 changes: 16 additions & 1 deletion src/main/kotlin/com/emberjs/gts/GtsSupport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ val GTS_DEFAULT_EXTENSIONS_WITH_DOT = arrayOf(".gts", ".gjs")

class GtsImportResolver(project: Project,
resolveContext: JSImportResolveContext,
private val contextFile: VirtualFile): TypeScriptFileImportsResolverImpl(project, resolveContext, GTS_DEFAULT_EXTENSIONS_WITH_DOT, listOf(GtsFileType.INSTANCE)) {
private val contextFile: VirtualFile):
TypeScriptFileImportsResolverImpl(project, resolveContext, GTS_DEFAULT_EXTENSIONS_WITH_DOT, listOf(GtsFileType.INSTANCE, GjsFileType.INSTANCE
)) {

override fun processAllFilesInScope(includeScope: GlobalSearchScope, processor: Processor<in VirtualFile>) {
if (includeScope == GlobalSearchScope.EMPTY_SCOPE) return
Expand All @@ -621,6 +623,9 @@ class GtsImportResolver(project: Project,
TypeScriptImportsResolverProvider.getDefaultProvider(project, resolveContext)
.resolveFileModule("gts", contextFile)
?.let { processor.process(it) }
TypeScriptImportsResolverProvider.getDefaultProvider(project, resolveContext)
.resolveFileModule("gjs", contextFile)
?.let { processor.process(it) }
}

override fun getPriority(): Int = TypeScriptFileImportsResolver.JS_DEFAULT_PRIORITY
Expand Down Expand Up @@ -660,6 +665,13 @@ class GtsComponentCandidatesProvider(val placeInfo: JSImportPlaceInfo) : JSImpor
.flatten()
.toMutableList()

list.addAll(FilenameIndex.getAllFilesByExt(project, "gjs",
createProjectImportsScope(placeInfo, getStructureModuleRoot(placeInfo)))
.map { getExports(it) }
.flatten()
.toMutableList()
)

val scopes = EmberUtils.getScopesForFile(myPlaceInfo.file)

val scope = ProjectScope.getAllScope(project)
Expand Down Expand Up @@ -728,6 +740,9 @@ class GtsComponentCandidatesProvider(val placeInfo: JSImportPlaceInfo) : JSImpor
return if (virtualFile.name == "index.gts") {
virtualFile.parent.name
}
else if (virtualFile.name == "index.gjs") {
virtualFile.parent.name
}
else {
virtualFile.nameWithoutExtension
}
Expand Down
Loading