diff --git a/vscode-extension-ashes/Requirements.md b/vscode-extension-ashes/Requirements.md index 61a401f6..b990ed01 100644 --- a/vscode-extension-ashes/Requirements.md +++ b/vscode-extension-ashes/Requirements.md @@ -275,7 +275,7 @@ Based on the Escoria core documentation, ASHES supports the following language f **FR-9.6: Indentation Validation** - The extension MUST enforce tab-based indentation (not spaces) as required by ASHES - The extension MUST detect mixed tabs and spaces -- The extension MUST warn about excessive indentation (more than 3 levels) +- The extension MUST allow deep indentation for complex nested structures - The extension MUST validate proper indentation for control flow blocks - The extension MUST validate that events are at the top level (no indentation) - The extension MUST validate proper indentation for dialog blocks and choices diff --git a/vscode-extension-ashes/src/syntaxValidator.ts b/vscode-extension-ashes/src/syntaxValidator.ts index 4ca812b0..dc35634f 100644 --- a/vscode-extension-ashes/src/syntaxValidator.ts +++ b/vscode-extension-ashes/src/syntaxValidator.ts @@ -386,10 +386,14 @@ export class ASHESSyntaxValidator { const conditionText = conditionMatch[2].trim(); // Check for proper inventory check patterns: "item" in inventory - const inventoryMatch = conditionText.match(/([^"]*)\s+in\s+inventory/); + const inventoryMatch = conditionText.match(/"([^"]*)"\s+in\s+inventory/); if (inventoryMatch) { - const itemPart = inventoryMatch[1].trim(); - if (!itemPart.startsWith('"') || !itemPart.endsWith('"')) { + // The pattern already matches quoted strings, so this is valid + // No need to check for quotes since the regex already requires them + } else { + // Check if there's an inventory check without proper quotes + const unquotedInventoryMatch = conditionText.match(/([^"]*)\s+in\s+inventory/); + if (unquotedInventoryMatch) { const inventoryIndex = conditionText.indexOf('in inventory'); diagnostics.push({ range: new vscode.Range(lineNumber, line.indexOf(conditionText) + inventoryIndex, lineNumber, line.indexOf(conditionText) + inventoryIndex + 'in inventory'.length), @@ -608,15 +612,15 @@ export class ASHESSyntaxValidator { if (prevIndentMatch) { const prevIndent = prevIndentMatch[1].length; - // Check for excessive indentation (more than 3 levels deep) - if (currentIndent > 3) { - diagnostics.push({ - range: new vscode.Range(lineNumber, 0, lineNumber, currentIndent), - message: "Excessive indentation detected (more than 3 levels)", - severity: vscode.DiagnosticSeverity.Warning, - code: 'excessive-indentation' - }); - } + // Note: Removed excessive indentation limit to allow deeper nesting + // if (currentIndent > 3) { + // diagnostics.push({ + // range: new vscode.Range(lineNumber, 0, lineNumber, currentIndent), + // message: "Excessive indentation detected (more than 3 levels)", + // severity: vscode.DiagnosticSeverity.Warning, + // code: 'excessive-indentation' + // }); + // } } } diff --git a/vscode-extension-ashes/syntaxes/ashes.tmLanguage.json b/vscode-extension-ashes/syntaxes/ashes.tmLanguage.json index 174e2498..47e42f3e 100644 --- a/vscode-extension-ashes/syntaxes/ashes.tmLanguage.json +++ b/vscode-extension-ashes/syntaxes/ashes.tmLanguage.json @@ -286,11 +286,39 @@ }, { "include": "#numbers" + }, + { + "include": "#keywords" + }, + { + "include": "#variables" + }, + { + "include": "#conditional-expressions" } ] } ] }, + "conditional-expressions": { + "patterns": [ + { + "name": "meta.conditional-expression.ashes", + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(==|!=|<=|>=|<|>)\\s*([a-zA-Z_][a-zA-Z0-9_]*|\\d+)\\b", + "captures": { + "1": { + "name": "variable.other.conditional.ashes" + }, + "2": { + "name": "keyword.operator.comparison.ashes" + }, + "3": { + "name": "variable.other.conditional.ashes" + } + } + } + ] + }, "strings": { "patterns": [ { @@ -361,7 +389,7 @@ }, { "name": "keyword.other.ashes", - "match": "\\b(in|is|active)\\b" + "match": "\\b(in|is|active|inventory)\\b" } ] },