Requirents... more syntax validator
This commit is contained in:
@@ -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'
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user