release: WRNexusJS 0.2.29

This commit is contained in:
2026-07-14 17:34:51 +05:30
parent e27c92e3b6
commit e6dbb5b0fc
62 changed files with 513 additions and 292 deletions
+8 -25
View File
@@ -2,14 +2,10 @@
const vscode = require("vscode");
const COMPONENT_DECLARATION =
/^\s*(component|layout)\s+([A-Za-z_$][\w$]*)\s*\{/gm;
const COMPONENT_DECLARATION = /^\s*(component|layout)\s+([A-Za-z_$][\w$]*)\s*\{/gm;
function getTagAtPosition(document, position) {
const range = document.getWordRangeAtPosition(
position,
/[A-Za-z_$][\w$]*/,
);
const range = document.getWordRangeAtPosition(position, /[A-Za-z_$][\w$]*/);
if (!range) {
return null;
@@ -23,17 +19,13 @@ function getTagAtPosition(document, position) {
const line = document.lineAt(position.line).text;
const offset = document.offsetAt(position);
const lineStart = document.offsetAt(
new vscode.Position(position.line, 0),
);
const lineStart = document.offsetAt(new vscode.Position(position.line, 0));
const characterOffset = offset - lineStart;
const before = line.slice(0, characterOffset);
const after = line.slice(characterOffset);
const insideTag =
before.lastIndexOf("<") > before.lastIndexOf(">") &&
after.includes(">");
const insideTag = before.lastIndexOf("<") > before.lastIndexOf(">") && after.includes(">");
if (!insideTag) {
return null;
@@ -75,21 +67,12 @@ async function findDeclaration(name) {
continue;
}
const nameOffset =
match.index +
match[0].indexOf(declarationName);
const nameOffset = match.index + match[0].indexOf(declarationName);
const start = document.positionAt(nameOffset);
const end = document.positionAt(
nameOffset + declarationName.length,
);
const end = document.positionAt(nameOffset + declarationName.length);
matches.push(
new vscode.Location(
uri,
new vscode.Range(start, end),
),
);
matches.push(new vscode.Location(uri, new vscode.Range(start, end)));
}
}
@@ -131,4 +114,4 @@ module.exports = {
getTagAtPosition,
provideDefinition,
registerDefinitionProvider,
};
};