Avoid decorating attributes when cursor is in range (#1805)

This commit is contained in:
Logesh
2026-01-31 16:54:48 +01:00
committed by GitHub
parent 443c009e10
commit aa6f705781
+7 -1
View File
@@ -1,6 +1,9 @@
import { syntaxTree } from "@codemirror/language";
import { Decoration } from "@codemirror/view";
import { decoratorStateField } from "./util.ts";
import {
decoratorStateField,
isCursorInRange,
} from "./util.ts";
export function attributePlugin() {
return decoratorStateField((state) => {
@@ -11,6 +14,9 @@ export function attributePlugin() {
if (node.type.name !== "Attribute") {
return;
}
if (isCursorInRange(state, [node.from, node.to])) {
return;
}
const attributeText = state.sliceDoc(node.from, node.to);