Skip to content

Commit

Permalink
Fixes #317
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Apr 12, 2024
1 parent 5ce1835 commit a69b790
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions server/src/providers/documentLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export async function onDocumentLinks(params: DocumentLinkParams): Promise<Docum
let result: DocumentLink[] = [];

// Loop through the class and look for documentation comments
const classregex = new RegExp("<class>([^<>\/]*)<\/class>","gi");
const memberregex = new RegExp("(?:<method>([^<>\/]*)<\/method>)|(?:<property>([^<>\/]*)<\/property>)|(?:<query>([^<>\/]*)<\/query>)","gi");
const classregex = /(?:<class>([^<>/#]+)<\/class>)|(?:##class\(([^<>()]+)\))/gi;
const memberregex = new RegExp("(?:<method>([^<>\/]+)<\/method>)|(?:<property>([^<>\/]+)<\/property>)|(?:<query>([^<>\/]+)<\/query>)","gi");
for (let line = 0; line < parsed.length; line++) {
if (
parsed[line].length > 0 &&
Expand All @@ -23,15 +23,17 @@ export async function onDocumentLinks(params: DocumentLinkParams): Promise<Docum
) {
// This is a UDL documentation line
const linetext = doc.getText(Range.create(line,0,line+1,0));
let matcharr: any;
let matcharr: RegExpExecArray | null;
while ((matcharr = classregex.exec(linetext)) !== null) {
// This is a <CLASS> HTML tag
// This is a <CLASS> 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
}
});
}
Expand Down

0 comments on commit a69b790

Please sign in to comment.