diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d7e9c..944cf6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [2.4.5] - 2024-XX-XX +- Fix issue [#312](https://github.com/intersystems/language-server/issues/312): Fix routine existence diagnostics for routines that only exist in OBJ form - Parser changes: - DP-430347: Track variables in routine procedure blocks diff --git a/server/src/providers/diagnostic.ts b/server/src/providers/diagnostic.ts index 0fcf611..7f8d801 100644 --- a/server/src/providers/diagnostic.ts +++ b/server/src/providers/diagnostic.ts @@ -19,7 +19,7 @@ import { normalizeClassname, quoteUDLIdentifier } from '../utils/functions'; -import { zutilFunctions, lexerLanguages, documents } from '../utils/variables'; +import { zutilFunctions, lexerLanguages, documents, connection } from '../utils/variables'; import { ServerSpec, StudioOpenDialogFile, QueryData } from '../utils/types'; import * as ld from '../utils/languageDefinitions'; import parameterTypes = require("../documentation/parameterTypes.json"); @@ -51,7 +51,7 @@ export async function onDiagnostics(params: DocumentDiagnosticParams): Promise 3)","*.inc",1,1,1,1,0,0] }; } else if (!settings.diagnostics.routines && (settings.diagnostics.classes || settings.diagnostics.deprecation)) { @@ -82,10 +84,12 @@ export async function onDiagnostics(params: DocumentDiagnosticParams): Promise 3)","*.inc",1,1,1,1,0,0] }; } + connection.console.warn("about to send REST request"); const respdata = await makeRESTRequest("POST",1,"/action/query",server,querydata); if (Array.isArray(respdata?.data?.result?.content)) { files = respdata.data.result.content; @@ -593,7 +597,8 @@ export async function onDiagnostics(params: DocumentDiagnosticParams): Promise (file.Name == (word+".mac")) || (file.Name == (word+".int")))) { + const regex = new RegExp(`^${word}\.(mac|int|obj)$`); + if (!files.some(file => regex.test(file.Name))) { let diagnostic: Diagnostic = { severity: DiagnosticSeverity.Error, range: wordrange, @@ -995,7 +1000,8 @@ export async function onDiagnostics(params: DocumentDiagnosticParams): Promise otherNsDocs.delete(`${namespace}:::${e.Name.endsWith(".int") ? `${e.Name.slice(0,-3)}.mac` : e.Name}`)); + respdata.data.result.content.forEach((e) => otherNsDocs.delete(`${namespace}:::${(e.Name.endsWith(".int") || e.Name.endsWith(".obj")) ? `${e.Name.slice(0,-3)}mac` : e.Name}`)); otherNsDocs.forEach((v,k) => { const [ns, doc] = k.split(":::"); if (ns == namespace) {