Skip to content

Commit 09ace4f

Browse files
Merge pull request #31 from gjsjohnmurray/fix-30
fix #30 rename the three built-in (default) connections
2 parents 8e95689 + e2b5ea2 commit 09ace4f

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,31 @@
7272
"markdownDescription": "[InterSystems](https://www.intersystems.com)® servers that other extensions connect to. Each property of this object names a server and holds nested properties specifying how to connect to it. Server names may only contain characters 'A' to 'Z', 'a' to 'z', digits, '-', '.', '_' and '~' characters.",
7373
"scope": "resource",
7474
"default": {
75-
"iris": {
75+
"default~iris": {
7676
"webServer": {
7777
"scheme": "http",
7878
"host": "127.0.0.1",
7979
"port": 52773
8080
},
8181
"description": "Connection to local InterSystems IRIS™ installed with default settings."
8282
},
83-
"cache": {
83+
"default~cache": {
8484
"webServer": {
8585
"scheme": "http",
8686
"host": "127.0.0.1",
8787
"port": 57772
8888
},
8989
"description": "Connection to local InterSystems Caché® installed with default settings."
9090
},
91-
"ensemble": {
91+
"default~ensemble": {
9292
"webServer": {
9393
"scheme": "http",
9494
"host": "127.0.0.1",
9595
"port": 57772
9696
},
9797
"description": "Connection to local InterSystems Ensemble® installed with default settings."
9898
},
99-
"/default": "iris"
99+
"/default": "default~iris"
100100
},
101101
"patternProperties": {
102102
"^[a-z0-9-._~]+$": {

src/api/getServerNames.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ServerName, ServerSpec } from '../extension';
33

44
export function getServerNames(scope?: vscode.ConfigurationScope): ServerName[] {
55
let names: ServerName[] = [];
6+
let defaultNames: ServerName[] = [];
67
const servers = vscode.workspace.getConfiguration('intersystems', scope).get('servers');
78

89
if (typeof servers === 'object' && servers) {
@@ -16,14 +17,27 @@ export function getServerNames(scope?: vscode.ConfigurationScope): ServerName[]
1617
}
1718
for (const key in servers) {
1819
if (!key.startsWith('/') && key !== defaultName) {
19-
names.push({
20-
name: key,
21-
description: servers[key].description || '',
22-
detail: serverDetail(servers[key])
23-
});
20+
const inspected = vscode.workspace.getConfiguration('intersystems.servers', scope).inspect(key);
21+
22+
// At least in VS Code 1.49 the defaultValue unexpectedly returns undefined
23+
// even for keys that are defined in package.json as defaults. So we have to check negatively all the other possibilities.
24+
if (!inspected?.globalLanguageValue && !inspected?.globalValue && !inspected?.workspaceFolderLanguageValue && !inspected?.workspaceFolderValue && !inspected?.workspaceLanguageValue && !inspected?.workspaceValue) {
25+
defaultNames.push({
26+
name: key,
27+
description: servers[key].description || '',
28+
detail: serverDetail(servers[key])
29+
});
30+
} else {
31+
names.push({
32+
name: key,
33+
description: servers[key].description || '',
34+
detail: serverDetail(servers[key])
35+
});
36+
}
2437
}
2538
}
2639
}
40+
names.push(...defaultNames);
2741
return names;
2842
}
2943

0 commit comments

Comments
 (0)