Skip to content

Commit

Permalink
Fixes #353
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Oct 15, 2024
1 parent 494389e commit 190fc50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [2.6.3] - 2024-XX-XX
- Fix issue [#352](https://github.com/intersystems/language-server/issues/352): Hide Deprecated classes and class members from completion lists by default
- Fix issue [#353](https://github.com/intersystems/language-server/issues/353): Fix keyword completion for ClassMethods

## [2.6.2] - 2024-10-07
- Fix issue [#345](https://github.com/intersystems/language-server/issues/345): Add intellisense for variables passed by reference as method arguments
Expand Down
24 changes: 12 additions & 12 deletions server/src/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
var firsttwotokens = "";
if (parsed[params.position.line].length >= 2) {
firsttwotokens = doc.getText(Range.create(
Position.create(params.position.line,parsed[params.position.line][0].p),
Position.create(params.position.line,parsed[params.position.line][1].p+parsed[params.position.line][1].c)
params.position.line,parsed[params.position.line][0].p,
params.position.line,parsed[params.position.line][1].p+parsed[params.position.line][1].c
));
}
var thistoken: number = -1;
Expand Down Expand Up @@ -1485,9 +1485,9 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
// This is a UDL keyword

// Find the type of this member
var keywordtype = doc.getText(Range.create(
Position.create(params.position.line,parsed[params.position.line][0].p),
Position.create(params.position.line,parsed[params.position.line][0].p+parsed[params.position.line][0].c)
let keywordtype = doc.getText(Range.create(
params.position.line,parsed[params.position.line][0].p,
params.position.line,parsed[params.position.line][0].p+parsed[params.position.line][0].c
)).toLowerCase();
if (parsed[params.position.line][0].l !== ld.cls_langindex || parsed[params.position.line][0].s !== ld.cls_keyword_attrindex) {
// This member definition spans multiple lines
Expand All @@ -1497,15 +1497,15 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
}
if (parsed[k][0].l == ld.cls_langindex && parsed[k][0].s == ld.cls_keyword_attrindex) {
keywordtype = doc.getText(Range.create(
Position.create(k,parsed[k][0].p),
Position.create(k,parsed[k][0].p+parsed[k][0].c)
k,parsed[k][0].p,
k,parsed[k][0].p+parsed[k][0].c
)).toLowerCase();
break;
}
}
}

var keywordsarr: KeywordDoc[] =[];
let keywordsarr: KeywordDoc[] =[];
if (keywordtype === "class") {
keywordsarr = classKeywords.slice();
}
Expand All @@ -1515,7 +1515,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
else if (keywordtype === "index") {
keywordsarr = indexKeywords.slice();
}
else if (keywordtype === "method" || keywordtype === "ClassMethod" || keywordtype === "clientmethod") {
else if (keywordtype === "method" || keywordtype === "classmethod" || keywordtype === "clientmethod") {
keywordsarr = methodKeywords.slice();
}
else if (keywordtype === "parameter") {
Expand All @@ -1537,7 +1537,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
keywordsarr = xdataKeywords.slice();
}
for (const keydoc of keywordsarr) {
var doctext = keydoc.description;
let doctext = keydoc.description;
if (doctext === undefined) {
doctext = "";
}
Expand All @@ -1554,7 +1554,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
}
doctext = doctext.concat("Permitted Values: ",keydoc.constraint.join(", "));
}
var compitem: CompletionItem = {
const compitem: CompletionItem = {
label: keydoc.name,
kind: CompletionItemKind.Keyword,
data: "keyword",
Expand Down Expand Up @@ -1629,7 +1629,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
else if (keywordtype === "index") {
keywordsarr = indexKeywords.slice();
}
else if (keywordtype === "method" || keywordtype === "ClassMethod" || keywordtype === "clientmethod") {
else if (keywordtype === "method" || keywordtype === "classmethod" || keywordtype === "clientmethod") {
keywordsarr = methodKeywords.slice();
}
else if (keywordtype === "parameter") {
Expand Down

0 comments on commit 190fc50

Please sign in to comment.