diff --git a/editors/vscode/icon.png b/editors/vscode/icon.png new file mode 100644 index 0000000..7f1067e Binary files /dev/null and b/editors/vscode/icon.png differ diff --git a/editors/vscode/package-lock.json b/editors/vscode/package-lock.json index e2170d4..35c5a96 100644 --- a/editors/vscode/package-lock.json +++ b/editors/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "logic-md-vscode", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "logic-md-vscode", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { "@types/node": "^22.0.0", diff --git a/editors/vscode/package.json b/editors/vscode/package.json index a514452..f753fa9 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -2,9 +2,10 @@ "name": "logic-md-vscode", "displayName": "LOGIC.md", "description": "Syntax highlighting and validation for LOGIC.md reasoning specifications", - "version": "0.1.1", + "version": "0.1.2", "publisher": "singlesourceai", "license": "MIT", + "icon": "icon.png", "repository": { "type": "git", "url": "https://github.com/SingularityAI-Dev/logic-md" diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts index 0c1ba41..4c6b0e9 100644 --- a/editors/vscode/src/extension.ts +++ b/editors/vscode/src/extension.ts @@ -83,9 +83,16 @@ function validateDocument(doc: vscode.TextDocument): void { const text = doc.getText(); const lines = text.split("\n"); - // Check for frontmatter delimiters - const frontmatterStart = text.search(/^---/m); - const frontmatterEnd = text.search(/^---/m, frontmatterStart + 1); + // Check for frontmatter delimiters. + // NOTE: String.prototype.search() ignores any second argument, so we use a /g regex + // with repeated .exec() calls to find the opening and closing --- delimiters. + // Frontmatter must be the very first line of the document; stray --- blocks later + // in the file (e.g. markdown horizontal rules) must not be treated as frontmatter. + const fmRegex = /^---\s*$/gm; + const firstMatch = fmRegex.exec(text); + const frontmatterStart = firstMatch && firstMatch.index === 0 ? 0 : -1; + const secondMatch = frontmatterStart === 0 ? fmRegex.exec(text) : null; + const frontmatterEnd = secondMatch ? secondMatch.index : -1; if (frontmatterStart === -1) { const range = new vscode.Range(0, 0, 0, 0);