Skip to content

Commit d4f43fb

Browse files
committed
Fixes #361
1 parent ab94576 commit d4f43fb

File tree

9 files changed

+103
-102
lines changed

9 files changed

+103
-102
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [2.7.1] - 2025-XX-XX
44
- Fix issue [#360](https://github.com/intersystems/language-server/issues/360): Infinite recursion in local variable type inference
5+
- Fix issue [#361](https://github.com/intersystems/language-server/issues/361): Normalize Input UIs
56

67
## [2.7.0] - 2025-02-03
78
- Fix issue [#258](https://github.com/intersystems/language-server/issues/258): Support Windows Arm

client/src/commands.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function overrideClassMembers() {
6969

7070
// Ask the user to select the type of member that they want to override
7171
const selectedType = await window.showQuickPick(["Method","Parameter","Projection","Property","Query","Trigger","XData"],{
72-
placeHolder: "Select the class member type to override"
72+
title: "Pick the type of class member to override"
7373
});
7474
if (!selectedType) {
7575
// No member type was selected, so exit
@@ -100,7 +100,9 @@ export async function overrideClassMembers() {
100100

101101
// Ask the user to select which members they want to override
102102
const selectedMembers = await window.showQuickPick(overridableMembers,{
103-
placeHolder: `Select the ${plural} to override`,
103+
title: `Pick the ${plural} to override`,
104+
matchOnDescription: true,
105+
matchOnDetail: true,
104106
canPickMany: true
105107
});
106108
if (!selectedMembers?.length) {
@@ -129,7 +131,8 @@ export async function selectParameterType(uri: string, parameterRange: Range) {
129131

130132
// Ask the user to select a parameter type
131133
const selectedParameter = await window.showQuickPick(allparametertypes,{
132-
placeHolder: "Select the Parameter type",
134+
title: "Pick the Parameter type",
135+
matchOnDescription: true,
133136
canPickMany: false
134137
});
135138
if (!selectedParameter) {
@@ -172,7 +175,7 @@ export async function selectImportPackage(uri: string, classname: string) {
172175
} else {
173176
// Ask the user to select an import package
174177
var selectedPackage = await window.showQuickPick(allimportpackages,{
175-
placeHolder: "Select the package to import",
178+
title: "Pick the package to import",
176179
canPickMany: false
177180
});
178181
if (!selectedPackage) {
@@ -203,7 +206,7 @@ export async function extractMethod(uri: string, lnstart: number, lnend: number,
203206
}
204207

205208
var newmethodname = await window.showInputBox({
206-
placeHolder: "Enter the name of the new method",
209+
title: "Enter the name of the new method",
207210
value: "newmethod",
208211
validateInput: (newmethodname: string) => {
209212
if (newmethodname === "") {

server/src/providers/completion.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
11651165

11661166
// Query the server to get the names and descriptions of all parameters
11671167
const data: QueryData = {
1168-
query: `SELECT Name, Description, Origin, Type, Deprecated FROM %Dictionary.CompiledParameter WHERE parent->ID = ?${
1168+
query: `SELECT Name, Description, Origin, Type, Deprecated FROM %Dictionary.CompiledParameter WHERE Parent = ?${
11691169
membercontext.context == "instance" ? " AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')" : ""
11701170
}${internalStr}${deprecatedStr}`,
11711171
parameters: [membercontext.baseclass]
@@ -1223,51 +1223,51 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
12231223
if (membercontext.context == "instance") {
12241224
// Non-generated methods
12251225
data.query += "SELECT Name, Description, Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases " +
1226-
"FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND Stub IS NULL AND ((Origin = parent->ID) OR (Origin != parent->ID AND NotInheritable = 0)) " +
1226+
"FROM %Dictionary.CompiledMethod WHERE Parent = ? AND Stub IS NULL AND ((Origin = Parent) OR (Origin != Parent AND NotInheritable = 0)) " +
12271227
`AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')${internalStr}${deprecatedStr}`;
12281228
data.parameters.push(membercontext.baseclass);
12291229
// Properties and Parameters
12301230
data.query += " UNION ALL %PARALLEL " +
12311231
"SELECT Name, Description, Origin, NULL AS FormalSpec, RuntimeType AS Type, 'property' AS MemberType, Deprecated, Aliases " +
1232-
`FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1232+
`FROM %Dictionary.CompiledProperty WHERE Parent = ? AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12331233
"SELECT Name, Description, Origin, NULL AS FormalSpec, Type, 'parameter' AS MemberType, Deprecated, NULL AS Aliases " +
1234-
`FROM %Dictionary.CompiledParameter WHERE parent->ID = ? AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')${internalStr}${deprecatedStr}`;
1234+
`FROM %Dictionary.CompiledParameter WHERE Parent = ? AND (parent->ClassType IS NULL OR parent->ClassType != 'datatype')${internalStr}${deprecatedStr}`;
12351235
data.parameters.push(membercontext.baseclass,membercontext.baseclass);
12361236
if (settings.completion.showGenerated) {
12371237
// Generated methods
12381238
data.query += " UNION ALL %PARALLEL " +
12391239
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases " +
1240-
`FROM %Dictionary.CompiledIndexMethod WHERE parent->parent->ID = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1240+
`FROM %Dictionary.CompiledIndexMethod WHERE parent->Parent = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12411241
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases " +
1242-
`FROM %Dictionary.CompiledQueryMethod WHERE parent->parent->ID = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1242+
`FROM %Dictionary.CompiledQueryMethod WHERE parent->Parent = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12431243
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases " +
1244-
`FROM %Dictionary.CompiledPropertyMethod WHERE parent->parent->ID = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1244+
`FROM %Dictionary.CompiledPropertyMethod WHERE parent->Parent = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12451245
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases " +
1246-
`FROM %Dictionary.CompiledConstraintMethod WHERE parent->parent->ID = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr}`;
1246+
`FROM %Dictionary.CompiledConstraintMethod WHERE parent->Parent = ? AND (parent->parent->ClassType IS NULL OR parent->parent->ClassType != 'datatype')${internalStr}${deprecatedStr}`;
12471247
data.parameters.push(...new Array(4).fill(membercontext.baseclass));
12481248
}
12491249
} else {
12501250
// Non-generated methods
12511251
data.query += "SELECT Name, Description, Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated " +
1252-
`FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND ClassMethod = 1 AND Stub IS NULL AND ((Origin = parent->ID) OR (Origin != parent->ID AND NotInheritable = 0))${internalStr}${deprecatedStr}`;
1252+
`FROM %Dictionary.CompiledMethod WHERE Parent = ? AND ClassMethod = 1 AND Stub IS NULL AND ((Origin = Parent) OR (Origin != Parent AND NotInheritable = 0))${internalStr}${deprecatedStr}`;
12531253
data.parameters.push(membercontext.baseclass);
12541254
if (membercontext.context == "class") {
12551255
// Parameters
12561256
data.query += " UNION ALL %PARALLEL " +
1257-
`SELECT Name, Description, Origin, NULL AS FormalSpec, Type, 'parameter' AS MemberType, Deprecated FROM %Dictionary.CompiledParameter WHERE parent->ID = ?${internalStr}${deprecatedStr}`;
1257+
`SELECT Name, Description, Origin, NULL AS FormalSpec, Type, 'parameter' AS MemberType, Deprecated FROM %Dictionary.CompiledParameter WHERE Parent = ?${internalStr}${deprecatedStr}`;
12581258
data.parameters.push(membercontext.baseclass);
12591259
}
12601260
if (settings.completion.showGenerated) {
12611261
// Generated methods
12621262
data.query += " UNION ALL %PARALLEL " +
12631263
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated " +
1264-
`FROM %Dictionary.CompiledIndexMethod WHERE parent->parent->ID = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1264+
`FROM %Dictionary.CompiledIndexMethod WHERE parent->Parent = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12651265
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated " +
1266-
`FROM %Dictionary.CompiledQueryMethod WHERE parent->parent->ID = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1266+
`FROM %Dictionary.CompiledQueryMethod WHERE parent->Parent = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12671267
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated " +
1268-
`FROM %Dictionary.CompiledPropertyMethod WHERE parent->parent->ID = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
1268+
`FROM %Dictionary.CompiledPropertyMethod WHERE parent->Parent = ? AND ClassMethod = 1${internalStr}${deprecatedStr} UNION ALL %PARALLEL ` +
12691269
"SELECT parent->name||Name AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated " +
1270-
`FROM %Dictionary.CompiledConstraintMethod WHERE parent->parent->ID = ? AND ClassMethod = 1${internalStr}${deprecatedStr}`
1270+
`FROM %Dictionary.CompiledConstraintMethod WHERE parent->Parent = ? AND ClassMethod = 1${internalStr}${deprecatedStr}`
12711271
data.parameters.push(...new Array(4).fill(membercontext.baseclass));
12721272
}
12731273
}
@@ -1453,8 +1453,8 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
14531453

14541454
// Query the server to get the names and descriptions of all class-specific parameters
14551455
const data: QueryData = {
1456-
query: `SELECT Name, Description, Origin, Type, Deprecated FROM %Dictionary.CompiledParameter WHERE parent->ID = ?${
1457-
isProperty ? " OR parent->ID %INLIST (SELECT $LISTFROMSTRING(PropertyClass) FROM %Dictionary.CompiledClass WHERE Name = ?)" : ""
1456+
query: `SELECT Name, Description, Origin, Type, Deprecated FROM %Dictionary.CompiledParameter WHERE Parent = ?${
1457+
isProperty ? " OR Parent %INLIST (SELECT $LISTFROMSTRING(PropertyClass) FROM %Dictionary.CompiledClass WHERE Name = ?)" : ""
14581458
}${!settings.completion.showInternal ? " AND Internal = 0": ""}${!settings.completion.showDeprecated ? " AND Deprecated = 0": ""}`,
14591459
parameters: isProperty ? [normalizedcls,currentClass(doc,parsed)] : [normalizedcls]
14601460
};
@@ -1753,7 +1753,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
17531753
}
17541754
}
17551755
const querydata = {
1756-
query: `SELECT Name, Description, Origin FROM %Dictionary.CompiledMethod WHERE parent->ID = ?${
1756+
query: `SELECT Name, Description, Origin FROM %Dictionary.CompiledMethod WHERE Parent = ?${
17571757
!settings.completion.showInternal ? " AND Internal = 0": ""
17581758
}`,
17591759
parameters:[thisclass]
@@ -2160,7 +2160,7 @@ export async function onCompletion(params: CompletionParams): Promise<Completion
21602160

21612161
// Query the server to get the names and descriptions of all non-calculated properties
21622162
const data: QueryData = {
2163-
query: `SELECT Name, Description, Origin, RuntimeType, Deprecated FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND Calculated = 0${
2163+
query: `SELECT Name, Description, Origin, RuntimeType, Deprecated FROM %Dictionary.CompiledProperty WHERE Parent = ? AND Calculated = 0${
21642164
!settings.completion.showInternal ? " AND Internal = 0": ""
21652165
}${!settings.completion.showDeprecated ? " AND Deprecated = 0" : ""}`,
21662166
parameters: [thisclass]

server/src/providers/definition.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -373,24 +373,24 @@ export async function onDefinition(params: TextDocumentPositionParams) {
373373
};
374374
if (memberKeywords == "Parameter") {
375375
// This is a parameter
376-
data.query = "SELECT Origin, NULL AS Stub FROM %Dictionary.CompiledParameter WHERE parent->ID = ? AND name = ?";
376+
data.query = "SELECT Origin, NULL AS Stub FROM %Dictionary.CompiledParameter WHERE Parent = ? AND name = ?";
377377
data.parameters = [membercontext.baseclass,unquotedname];
378378
}
379379
else if (memberKeywords == "Method|ClassMethod|ClientMethod") {
380380
// This is a method
381-
data.query = "SELECT Origin, Stub FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND name = ?";
381+
data.query = "SELECT Origin, Stub FROM %Dictionary.CompiledMethod WHERE Parent = ? AND name = ?";
382382
data.parameters = [membercontext.baseclass,unquotedname];
383383
}
384384
else if (memberKeywords == "Property|Relationship") {
385385
// This is a property
386-
data.query = "SELECT Name, Origin, NULL AS Stub FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND (Name = ? OR ? %INLIST $LISTFROMSTRING($TRANSLATE(Aliases,' ')))";
386+
data.query = "SELECT Name, Origin, NULL AS Stub FROM %Dictionary.CompiledProperty WHERE Parent = ? AND (Name = ? OR ? %INLIST $LISTFROMSTRING($TRANSLATE(Aliases,' ')))";
387387
data.parameters = [membercontext.baseclass,unquotedname,unquotedname.replace(/\s+/g,"")];
388388
}
389389
else {
390390
// This can be a method or property
391391
data.query =
392-
"SELECT Name, Origin, Stub FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND name = ? UNION ALL " +
393-
"SELECT Name, Origin, NULL AS Stub FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND (Name = ? OR ? %INLIST $LISTFROMSTRING($TRANSLATE(Aliases,' ')))";
392+
"SELECT Name, Origin, Stub FROM %Dictionary.CompiledMethod WHERE Parent = ? AND name = ? UNION ALL " +
393+
"SELECT Name, Origin, NULL AS Stub FROM %Dictionary.CompiledProperty WHERE Parent = ? AND (Name = ? OR ? %INLIST $LISTFROMSTRING($TRANSLATE(Aliases,' ')))";
394394
data.parameters = [membercontext.baseclass,unquotedname,membercontext.baseclass,unquotedname,unquotedname.replace(/\s+/g,"")];
395395
}
396396
let originclass = "";
@@ -411,19 +411,19 @@ export async function onDefinition(params: TextDocumentPositionParams) {
411411
memberKeywords = "Method|ClassMethod|ClientMethod";
412412
if (stubarr[2] === "i") {
413413
// This is a method generated from an index
414-
stubquery = "SELECT Origin FROM %Dictionary.CompiledIndexMethod WHERE Name = ? AND parent->parent->ID = ? AND parent->Name = ?";
414+
stubquery = "SELECT Origin FROM %Dictionary.CompiledIndexMethod WHERE Name = ? AND parent->Parent = ? AND parent->Name = ?";
415415
}
416416
if (stubarr[2] === "q") {
417417
// This is a method generated from a query
418-
stubquery = "SELECT Origin FROM %Dictionary.CompiledQueryMethod WHERE Name = ? AND parent->parent->ID = ? AND parent->Name = ?";
418+
stubquery = "SELECT Origin FROM %Dictionary.CompiledQueryMethod WHERE Name = ? AND parent->Parent = ? AND parent->Name = ?";
419419
}
420420
if (stubarr[2] === "a") {
421421
// This is a method generated from a property
422-
stubquery = "SELECT Origin FROM %Dictionary.CompiledPropertyMethod WHERE Name = ? AND parent->parent->ID = ? AND parent->Name = ?";
422+
stubquery = "SELECT Origin FROM %Dictionary.CompiledPropertyMethod WHERE Name = ? AND parent->Parent = ? AND parent->Name = ?";
423423
}
424424
if (stubarr[2] === "n") {
425425
// This is a method generated from a constraint
426-
stubquery = "SELECT Origin FROM %Dictionary.CompiledConstraintMethod WHERE Name = ? AND parent->parent->ID = ? AND parent->Name = ?";
426+
stubquery = "SELECT Origin FROM %Dictionary.CompiledConstraintMethod WHERE Name = ? AND parent->Parent = ? AND parent->Name = ?";
427427
}
428428
if (stubquery !== "") {
429429
const stubrespdata = await makeRESTRequest("POST",1,"/action/query",server,{
@@ -773,7 +773,7 @@ export async function onDefinition(params: TextDocumentPositionParams) {
773773
if (normalizedname !== "") {
774774
// Query the server to get the origin class of this property
775775
const data: QueryData = {
776-
query: "SELECT Origin FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND name = ?",
776+
query: "SELECT Origin FROM %Dictionary.CompiledProperty WHERE Parent = ? AND name = ?",
777777
parameters: [normalizedname,propname]
778778
};
779779
const queryrespdata = await makeRESTRequest("POST",1,"/action/query",server,data);
@@ -838,8 +838,8 @@ export async function onDefinition(params: TextDocumentPositionParams) {
838838
const normalizedname = await normalizeClassname(doc,parsed,clsname,server,params.position.line);
839839
if (normalizedname !== "") {
840840
// Query the server to get the origin class
841-
var querystr = "SELECT Origin FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND name = ? UNION ALL ";
842-
querystr = querystr.concat("SELECT Origin FROM %Dictionary.CompiledQuery WHERE parent->ID = ? AND name = ?");
841+
var querystr = "SELECT Origin FROM %Dictionary.CompiledMethod WHERE Parent = ? AND name = ? UNION ALL ";
842+
querystr = querystr.concat("SELECT Origin FROM %Dictionary.CompiledQuery WHERE Parent = ? AND name = ?");
843843
const data: QueryData = {
844844
query: querystr,
845845
parameters: [normalizedname,procname,normalizedname,procname]
@@ -870,7 +870,7 @@ export async function onDefinition(params: TextDocumentPositionParams) {
870870
if (normalizedname !== "") {
871871
// Query the server to get the origin class of this property
872872
const data: QueryData = {
873-
query: "SELECT Origin FROM %Dictionary.CompiledProperty WHERE parent->ID = ? AND name = ?",
873+
query: "SELECT Origin FROM %Dictionary.CompiledProperty WHERE Parent = ? AND name = ?",
874874
parameters: [normalizedname,propname]
875875
};
876876
const queryrespdata = await makeRESTRequest("POST",1,"/action/query",server,data);
@@ -951,8 +951,8 @@ export async function onDefinition(params: TextDocumentPositionParams) {
951951

952952
// The parameter is defined in another class
953953
const queryrespdata = await makeRESTRequest("POST",1,"/action/query",server,{
954-
query: "SELECT Origin FROM %Dictionary.CompiledParameter WHERE Name = ? AND (parent->ID = ? OR " +
955-
"parent->ID %INLIST (SELECT $LISTFROMSTRING(PropertyClass) FROM %Dictionary.CompiledClass WHERE Name = ?))",
954+
query: "SELECT Origin FROM %Dictionary.CompiledParameter WHERE Name = ? AND (Parent = ? OR " +
955+
"Parent %INLIST (SELECT $LISTFROMSTRING(PropertyClass) FROM %Dictionary.CompiledClass WHERE Name = ?))",
956956
parameters: [param,normalizedcls,thisclass]
957957
});
958958
if (queryrespdata !== undefined) {
@@ -1046,7 +1046,7 @@ export async function onDefinition(params: TextDocumentPositionParams) {
10461046
if (superclasses.length && thisMethod) {
10471047
// Get the list of allsuperclasses that have this method
10481048
const queryrespdata = await makeRESTRequest("POST",1,"/action/query",server,{
1049-
query: "SELECT Origin, parent->ID AS Super FROM %Dictionary.CompiledMethod WHERE Name = ? AND parent->ID %INLIST $LISTFROMSTRING(?)",
1049+
query: "SELECT Origin, Parent AS Super FROM %Dictionary.CompiledMethod WHERE Name = ? AND Parent %INLIST $LISTFROMSTRING(?)",
10501050
parameters: [quoteUDLIdentifier(thisMethod,0),superclasses.join(",")]
10511051
});
10521052
if (Array.isArray(queryrespdata?.data?.result?.content) && queryrespdata.data.result.content.length) {

0 commit comments

Comments
 (0)