From a69b7903e2250758b6c6e4384adee171a55a1a4a Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Fri, 12 Apr 2024 10:22:03 -0400 Subject: [PATCH] Fixes #317 --- CHANGELOG.md | 1 + server/src/providers/documentLink.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5fd4d9..4da345b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix issue [#312](https://github.com/intersystems/language-server/issues/312): Fix routine existence diagnostics for routines that only exist in OBJ form - Fix issue [#313](https://github.com/intersystems/language-server/issues/313): Add Diagnostic when `ROUTINE` header is missing - Fix issue [#314](https://github.com/intersystems/language-server/issues/314): Suggest boolean class keywords for completion after typing `Not` +- Fix issue [#317](https://github.com/intersystems/language-server/issues/317): Add `DocumentLink` for `##class()` in class description comments - Parser changes: - DP-430347: Track variables in routine procedure blocks - DP-430473: Fix variable tracking with embedded SQL in routine procedure blocks diff --git a/server/src/providers/documentLink.ts b/server/src/providers/documentLink.ts index 23e6db4..01da550 100644 --- a/server/src/providers/documentLink.ts +++ b/server/src/providers/documentLink.ts @@ -13,8 +13,8 @@ export async function onDocumentLinks(params: DocumentLinkParams): Promise([^<>\/]*)<\/class>","gi"); - const memberregex = new RegExp("(?:([^<>\/]*)<\/method>)|(?:([^<>\/]*)<\/property>)|(?:([^<>\/]*)<\/query>)","gi"); + const classregex = /(?:([^<>/#]+)<\/class>)|(?:##class\(([^<>()]+)\))/gi; + const memberregex = new RegExp("(?:([^<>\/]+)<\/method>)|(?:([^<>\/]+)<\/property>)|(?:([^<>\/]+)<\/query>)","gi"); for (let line = 0; line < parsed.length; line++) { if ( parsed[line].length > 0 && @@ -23,15 +23,17 @@ export async function onDocumentLinks(params: DocumentLinkParams): Promise HTML tag + // This is a HTML tag or ##class() + const clsName = matcharr[1] ?? matcharr[2]; + const offset = matcharr[1] ? 7 : 8; result.push({ - range: Range.create(line,matcharr.index+7,line,matcharr.index+7+matcharr[1].length), + range: Range.create(line,matcharr.index+offset,line,matcharr.index+offset+clsName.length), tooltip: "Open this class in a new editor tab", data: { uri: params.textDocument.uri, - clsName: matcharr[1] + clsName } }); }