File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
src/main/kotlin/com/emberjs/hbs/linter/ember-template-lint Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,14 @@ class TemplateLintExternalAnnotator(onTheFly: Boolean = true) : JSLinterExternal
3232
3333 override fun acceptPsiFile (file : PsiFile ): Boolean {
3434 val f = file
35- return f.viewProvider is GtsFileViewProvider || f.viewProvider is HbFileViewProvider || file is JSFile
35+ val pkg = TemplateLintConfiguration .getInstance(file.project).extendedState.state.templateLintPackage
36+ val supportsJS = pkg.version?.let { it.major < 8 } ? : false
37+ return (f.name.endsWith(" .hbs" )
38+ || (f.name.endsWith(" .js" ) && supportsJS)
39+ || (f.name.endsWith(" .ts" ) && supportsJS)
40+ || f.name.endsWith(" .gjs" )
41+ || f.name.endsWith(" .gts" ))
42+ && ! f.name.endsWith(" .d.ts" )
3643 }
3744
3845 override fun annotate (input : JSLinterInput <TemplateLintState >): JSLinterAnnotationResult ? {
Original file line number Diff line number Diff line change @@ -60,8 +60,15 @@ class TemplateLintFixAction : JSLinterFixAction(
6060 }
6161
6262 override fun isFileAccepted (project : Project , file : VirtualFile ): Boolean {
63- val f = PsiManager .getInstance(project).findFile(file)
64- return f?.viewProvider is GtsFileViewProvider || f?.viewProvider is HbFileViewProvider || f is JSFile
63+ val f = PsiManager .getInstance(project).findFile(file) ? : return false
64+ val pkg = TemplateLintConfiguration .getInstance(project).extendedState.state.templateLintPackage
65+ val supportsJS = pkg.version?.let { it.major < 8 } ? : false
66+ return (f.name.endsWith(" .hbs" )
67+ || (f.name.endsWith(" .js" ) && supportsJS)
68+ || (f.name.endsWith(" .ts" ) && supportsJS)
69+ || f.name.endsWith(" .gjs" )
70+ || f.name.endsWith(" .gts" ))
71+ && ! f.name.endsWith(" .d.ts" )
6572 }
6673
6774 private fun fixFile (psiFile : PsiFile ) {
You can’t perform that action at this time.
0 commit comments