diff --git a/distributables/lyng-idea-0.0.2-SNAPSHOT.zip b/distributables/lyng-idea-0.0.2-SNAPSHOT.zip deleted file mode 100644 index 72afc0c..0000000 --- a/distributables/lyng-idea-0.0.2-SNAPSHOT.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:87fa872ca5fd55187d28f7ced04661147f735eee5753aedca737ef0582357182 -size 5766976 diff --git a/distributables/lyng-idea-0.0.3-SNAPSHOT.zip b/distributables/lyng-idea-0.0.3-SNAPSHOT.zip index 9c31d9b..63e417a 100644 --- a/distributables/lyng-idea-0.0.3-SNAPSHOT.zip +++ b/distributables/lyng-idea-0.0.3-SNAPSHOT.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7079233ef1d30b371c4ea197e326d7b332e68eec584bdc239cad8ea377cab307 -size 27120267 +oid sha256:85b67c4dc4721072c63d99dc1ca1812037e7cd30cc347f3a0df806e1712fe366 +size 27200367 diff --git a/docs/samples/fs_sample.lyng b/docs/samples/fs_sample.lyng index 9505c8a..5b67302 100755 --- a/docs/samples/fs_sample.lyng +++ b/docs/samples/fs_sample.lyng @@ -4,6 +4,7 @@ import lyng.io.fs import lyng.stdlib val files = Path("../..").list().toList() +// most long is longest? val longestNameLength = files.maxOf { it.name.length } diff --git a/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/grazie/LyngGrazieAnnotator.kt b/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/grazie/LyngGrazieAnnotator.kt index aa46bc9..28d41bb 100644 --- a/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/grazie/LyngGrazieAnnotator.kt +++ b/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/grazie/LyngGrazieAnnotator.kt @@ -129,22 +129,10 @@ class LyngGrazieAnnotator : ExternalAnnotator"}, totalFindings=$totalReturned, painting=${findings.size}") - // Guarded fallback: if Grazie returned nothing but we clearly have fragments, try legacy spellchecker via reflection - if (findings.isEmpty() && fragments.isNotEmpty()) { - val added = fallbackWithLegacySpellcheckerIfAvailable(file, fragments, holder) - log.info("LyngGrazieAnnotator.apply: fallback painted=$added (0 means no legacy and heuristic may have painted separately)") - // Ensure at least one visible mark for diagnostics: paint a small WARNING at the first fragment range - try { - val first = fragments.first().second - val diagRange = TextRange(first.startOffset, (first.startOffset + 2).coerceAtMost(first.endOffset)) - val ab = holder.newAnnotation(HighlightSeverity.INFORMATION, "[LyngSpell] active").range(diagRange) - applyTypoStyleIfRequested(file, ab) - ab.create() - log.info("LyngGrazieAnnotator.apply: painted diagnostic marker at ${diagRange.startOffset}..${diagRange.endOffset}") - } catch (_: Throwable) { - // ignore - } - } + // IMPORTANT: Do NOT fallback to the tiny bundled vocabulary on modern IDEs. + // If Grazie/Natural Languages processing returned nothing, we simply exit here + // to avoid low‑quality results from the legacy dictionary. + if (findings.isEmpty()) return for (f in findings) { val ab = holder.newAnnotation(HighlightSeverity.INFORMATION, f.message).range(f.range) diff --git a/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/settings/LyngFormatterSettingsConfigurable.kt b/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/settings/LyngFormatterSettingsConfigurable.kt index 8082d12..dd512df 100644 --- a/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/settings/LyngFormatterSettingsConfigurable.kt +++ b/lyng-idea/src/main/kotlin/net/sergeych/lyng/idea/settings/LyngFormatterSettingsConfigurable.kt @@ -36,6 +36,8 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur private var grazieIdsAsCommentsCb: JCheckBox? = null private var grazieLiteralsAsCommentsCb: JCheckBox? = null private var debugShowSpellFeedCb: JCheckBox? = null + private var showTyposGreenCb: JCheckBox? = null + private var offerQuickFixesCb: JCheckBox? = null override fun getDisplayName(): String = "Lyng Formatter" @@ -53,6 +55,8 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur grazieIdsAsCommentsCb = JCheckBox("Natural Languages/Grazie: treat identifiers as comments (forces spelling checks in 2024.3)") grazieLiteralsAsCommentsCb = JCheckBox("Natural Languages/Grazie: treat string literals as comments when literals are not processed") debugShowSpellFeedCb = JCheckBox("Debug: show spell-feed ranges (weak warnings)") + showTyposGreenCb = JCheckBox("Show Lyng typos with green underline (TYPO styling)") + offerQuickFixesCb = JCheckBox("Offer Lyng typo quick fixes (Replace…, Add to dictionary) without Spell Checker") // Tooltips / short help spacingCb?.toolTipText = "Applies minimal, safe spacing (e.g., around commas/operators, control-flow parens)." @@ -65,6 +69,8 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur grazieIdsAsCommentsCb?.toolTipText = "Grazie-only fallback: route identifiers as COMMENTS domain so Grazie applies spelling in 2024.3." grazieLiteralsAsCommentsCb?.toolTipText = "Grazie-only fallback: when Grammar doesn't process literals, route strings as COMMENTS so they are checked." debugShowSpellFeedCb?.toolTipText = "Show the exact ranges we feed to spellcheckers (ids/comments/strings) as weak warnings." + showTyposGreenCb?.toolTipText = "Render Lyng typos using the platform's green TYPO underline instead of generic warnings." + offerQuickFixesCb?.toolTipText = "Provide lightweight Replace… and Add to dictionary quick-fixes without requiring the legacy Spell Checker." p.add(spacingCb) p.add(wrappingCb) p.add(reindentClosedBlockCb) @@ -76,6 +82,8 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur p.add(grazieIdsAsCommentsCb) p.add(grazieLiteralsAsCommentsCb) p.add(debugShowSpellFeedCb) + p.add(showTyposGreenCb) + p.add(offerQuickFixesCb) panel = p reset() return p @@ -93,7 +101,9 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur grazieChecksIdentifiersCb?.isSelected != s.grazieChecksIdentifiers || grazieIdsAsCommentsCb?.isSelected != s.grazieTreatIdentifiersAsComments || grazieLiteralsAsCommentsCb?.isSelected != s.grazieTreatLiteralsAsComments || - debugShowSpellFeedCb?.isSelected != s.debugShowSpellFeed + debugShowSpellFeedCb?.isSelected != s.debugShowSpellFeed || + showTyposGreenCb?.isSelected != s.showTyposWithGreenUnderline || + offerQuickFixesCb?.isSelected != s.offerLyngTypoQuickFixes } override fun apply() { @@ -109,6 +119,8 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur s.grazieTreatIdentifiersAsComments = grazieIdsAsCommentsCb?.isSelected == true s.grazieTreatLiteralsAsComments = grazieLiteralsAsCommentsCb?.isSelected == true s.debugShowSpellFeed = debugShowSpellFeedCb?.isSelected == true + s.showTyposWithGreenUnderline = showTyposGreenCb?.isSelected == true + s.offerLyngTypoQuickFixes = offerQuickFixesCb?.isSelected == true } override fun reset() { @@ -124,5 +136,7 @@ class LyngFormatterSettingsConfigurable(private val project: Project) : Configur grazieIdsAsCommentsCb?.isSelected = s.grazieTreatIdentifiersAsComments grazieLiteralsAsCommentsCb?.isSelected = s.grazieTreatLiteralsAsComments debugShowSpellFeedCb?.isSelected = s.debugShowSpellFeed + showTyposGreenCb?.isSelected = s.showTyposWithGreenUnderline + offerQuickFixesCb?.isSelected = s.offerLyngTypoQuickFixes } }