Skip to content

Commit 91d0d81

Browse files
committed
- fix: gts formatting freeze on large files
- fix: remove import suggestions for args properties in templates
1 parent af67d74 commit 91d0d81

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Changelog
44
===============================================================================
5+
## 2023.1.47
6+
- fix: gts formatting freeze on large files
7+
- fix: remove import suggestions for args properties in templates
8+
59
## 2023.1.44
610
- fix: fix formatting issues in gts files
711

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212

1313

1414
group = "com.emberjs"
15-
version = "2023.1.46"
15+
version = "2023.1.47"
1616

1717
// Configure project's dependencies
1818
repositories {

src/main/kotlin/com/emberjs/gts/GtsSupport.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ val NoWrap = Wrap.createWrap(WrapType.NONE, false).apply { ignoreParentWraps() }
639639
// wrapper to patch JsBlocks to include outer language block into JSAssignmentExpression and JSVarStatement
640640
open class JsBlockWrapper(val block: Block, val parent: JsBlockWrapper?, var hbsBlock: Block? = null): Block by block {
641641

642+
private var cachedBlocks: List<JsBlockWrapper>? = null
642643
val astnode by lazy {
643644
return@lazy (block as? ASTBlock)?.node
644645
}
@@ -675,9 +676,10 @@ open class JsBlockWrapper(val block: Block, val parent: JsBlockWrapper?, var hbs
675676
}
676677

677678
override fun getSubBlocks(): MutableList<JsBlockWrapper> {
678-
val blocks = block.subBlocks.map { mapToWrapper(it, hbsBlock) }.toMutableList()
679-
if (block is AnotherLanguageBlockWrapper) {
679+
if (this.cachedBlocks != null) {
680+
return this.cachedBlocks!!.toMutableList()
680681
}
682+
val blocks = block.subBlocks.map { mapToWrapper(it, hbsBlock) }.toMutableList()
681683

682684
blocks.toTypedArray().forEach {
683685
blocks.removeIf { it.block is RootBlockWrapper && it.block.patched }
@@ -698,6 +700,7 @@ open class JsBlockWrapper(val block: Block, val parent: JsBlockWrapper?, var hbs
698700
}
699701
}
700702
}
703+
this.cachedBlocks = blocks.toList()
701704
return blocks
702705
}
703706
}

src/main/kotlin/com/emberjs/gts/HbLinter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.emberjs.gts
22

33
import com.dmarcotte.handlebars.file.HbFileViewProvider
44
import com.dmarcotte.handlebars.parsing.HbTokenTypes
5+
import com.dmarcotte.handlebars.psi.HbData
56
import com.dmarcotte.handlebars.psi.HbMustache
67
import com.dmarcotte.handlebars.psi.HbPsiElement
78
import com.dmarcotte.handlebars.psi.HbPsiFile
@@ -225,7 +226,8 @@ class HbLintAnnotator() : Annotator {
225226
.tooltip(message)
226227
val prevSiblingIsSep = element.parent.prevSibling.elementType == HbTokenTypes.SEP ||
227228
element.prevSibling.elementType == HbTokenTypes.SEP
228-
if (!prevSiblingIsSep) {
229+
val isInHbData = element.parent !is HbData
230+
if (!prevSiblingIsSep && !isInHbData) {
229231
candidates?.forEach { c ->
230232
val icwe = JSImportCandidateWithExecutor(c, ES6AddImportExecutor(tsFile))
231233
val fix = GtsImportFix(element, icwe, JSImportModuleFix.HintMode.SINGLE)

0 commit comments

Comments
 (0)