mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2025-12-31 13:48:24 +03:00
fix errors with diagnostic
This commit is contained in:
@@ -60,7 +60,7 @@ class GDScriptDiagnosticSeverity {
|
||||
const text = doc.getText();
|
||||
|
||||
const check = (name:string, range: vscode.Range) => {
|
||||
const pattern = `[\\s\\+\\-\\*/%\\^\\(\\[\\{\.]${name}[^0-9A-Za-z_]\\s*`;
|
||||
const pattern = `[^0-9A-Za-z_]\\s*${name}[^0-9A-Za-z_]\\s*`;
|
||||
var matchs = text.match(new RegExp(pattern, 'g'));
|
||||
if(matchs.length <= 1)
|
||||
diagnostics.push(new vscode.Diagnostic(range, `${name} is never used.`, DiagnosticSeverity.Warning));
|
||||
@@ -82,7 +82,7 @@ class GDScriptDiagnosticSeverity {
|
||||
if(semicolonIndex != -1) {
|
||||
diagnostics.push(new vscode.Diagnostic(new vscode.Range(i, semicolonIndex, i, semicolonIndex+1), "Statement ends with a semicolon.", DiagnosticSeverity.Warning));
|
||||
}
|
||||
if(line.match(/\s*(if|elif|else|for|while|func|class)\s/g) && line.indexOf(":") == -1) {
|
||||
if(line.match(/\s*(if|elif|else|for|while|func|class)\s*/g) && line.indexOf(":") == -1) {
|
||||
if(line.indexOf("#") == -1)
|
||||
diagnostics.push(new vscode.Diagnostic(new vscode.Range(i, 0, i, line.length), "':' expected at end of the line.", DiagnosticSeverity.Error));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user