Skip to content

Commit

Permalink
Fixes #325
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Apr 19, 2024
1 parent bd0c373 commit c07bd63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fix issue [#322](https://github.com/intersystems/language-server/issues/322): Add setting to disable undefined variable warning diagnostics
- Fix issue [#323](https://github.com/intersystems/language-server/issues/323): Go to definition on `##super()` will open the superclass's implementation
- Fix issue [#324](https://github.com/intersystems/language-server/issues/324): Add intellisense for variables set to JSON literal constructors
- Fix issue [#325](https://github.com/intersystems/language-server/issues/325): Don't sort inherited `%%OID` members at the top of completion lists
- Parser changes:
- DP-430347: Track variables in routine procedure blocks
- DP-430473: Fix variable tracking with embedded SQL in routine procedure blocks
Expand Down
15 changes: 9 additions & 6 deletions server/src/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export let schemaCaches: Map<ServerSpec, SchemaCache> = new Map();
*/
var macroCompletionCache: MacroContext;

/** Prefix for `sortText` used to bubble base class members to the top of the list. */
const sortPrefix = "!!!";

/**
* Mapping between an XML prefix and namespace.
*/
Expand Down Expand Up @@ -1112,7 +1115,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
}
if (memobj.Origin === membercontext.baseclass) {
// Members from the base class should appear first
item.sortText = "##" + quotedname;
item.sortText = sortPrefix + quotedname;
}
else {
item.sortText = item.label;
Expand Down Expand Up @@ -1249,15 +1252,15 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
result.push({
...item,
label: quoted,
sortText: memobj.Origin == membercontext.baseclass ? "##" + quoted : quoted,
sortText: memobj.Origin == membercontext.baseclass ? sortPrefix + quoted : quoted,
tags: memobj.Deprecated ? [CompletionItemTag.Deprecated] : undefined
});
});
}
}
if (memobj.Origin === membercontext.baseclass) {
// Members from the base class should appear first
item.sortText = "##" + quotedname;
item.sortText = sortPrefix + quotedname;
}
else {
item.sortText = item.label;
Expand Down Expand Up @@ -1393,7 +1396,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
}
if (memobj.Origin === normalizedcls) {
// Members from the base class should appear first
item.sortText = "##" + memobj.Name;
item.sortText = sortPrefix + memobj.Name;
}
if (memobj.Deprecated) {
item.tags = [CompletionItemTag.Deprecated];
Expand Down Expand Up @@ -1679,7 +1682,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
};
if (method.Origin === method.baseclass) {
// Members from the base class should appear first
item.sortText = "##" + method.Name;
item.sortText = sortPrefix + method.Name;
}
else {
item.sortText = item.label;
Expand Down Expand Up @@ -2091,7 +2094,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
}
if (memobj.Origin === thisclass) {
// Members from the base class should appear first
item.sortText = "##" + quotedname;
item.sortText = sortPrefix + quotedname;
}
else {
item.sortText = item.label;
Expand Down

0 comments on commit c07bd63

Please sign in to comment.