1
- import * as vscode from ' vscode' ;
2
- import { ServerName } from ' ../extension' ;
3
- import { serverDetail } from ' ./getServerSummary' ;
1
+ import * as vscode from " vscode" ;
2
+ import { IServerName } from " ../extension" ;
3
+ import { serverDetail } from " ./getServerSummary" ;
4
4
5
- export function getServerNames ( scope ?: vscode . ConfigurationScope , sorted ?: boolean ) : ServerName [ ] {
6
- const allNames : ServerName [ ] = [ ] ;
7
- let names : ServerName [ ] = [ ] ;
8
- const embeddedNames : ServerName [ ] = [ ] ;
9
- const servers = vscode . workspace . getConfiguration ( ' intersystems' , scope ) . get ( ' servers' ) ;
5
+ export function getServerNames ( scope ?: vscode . ConfigurationScope , sorted ?: boolean ) : IServerName [ ] {
6
+ const allNames : IServerName [ ] = [ ] ;
7
+ let names : IServerName [ ] = [ ] ;
8
+ const embeddedNames : IServerName [ ] = [ ] ;
9
+ const servers = vscode . workspace . getConfiguration ( " intersystems" , scope ) . get ( " servers" ) ;
10
10
11
- if ( typeof servers === 'object' && servers ) {
12
-
11
+ if ( typeof servers === "object" && servers ) {
13
12
// Helper function to return true iff inspected setting is not explicitly set at any level
14
- const notSet = ( inspected ) :boolean => {
15
- return ! inspected ?. globalLanguageValue && ! inspected ?. globalValue && ! inspected ?. workspaceFolderLanguageValue && ! inspected ?. workspaceFolderValue && ! inspected ?. workspaceLanguageValue && ! inspected ?. workspaceValue ;
16
- }
17
-
13
+ const notSet = ( inspected ) : boolean => {
14
+ return ! inspected ?. globalLanguageValue
15
+ && ! inspected ?. globalValue
16
+ && ! inspected ?. workspaceFolderLanguageValue
17
+ && ! inspected ?. workspaceFolderValue
18
+ && ! inspected ?. workspaceLanguageValue
19
+ && ! inspected ?. workspaceValue ;
20
+ } ;
21
+
18
22
// If a valid default has been explicitly nominated, add it first
19
- const inspectedDefault = vscode . workspace . getConfiguration ( ' intersystems.servers' , scope ) . inspect ( ' /default' ) ;
20
- const myDefault : string = notSet ( inspectedDefault ) ? '' : servers [ ' /default' ] || '' ;
23
+ const inspectedDefault = vscode . workspace . getConfiguration ( " intersystems.servers" , scope ) . inspect ( " /default" ) ;
24
+ const myDefault : string = notSet ( inspectedDefault ) ? "" : servers [ " /default" ] || "" ;
21
25
if ( myDefault . length > 0 && servers [ myDefault ] ) {
22
26
allNames . push ( {
27
+ description : `${ servers [ myDefault ] . description || "" } (default)` . trim ( ) ,
28
+ detail : serverDetail ( servers [ myDefault ] ) ,
23
29
name : myDefault ,
24
- description : `${ servers [ myDefault ] . description || '' } (default)` . trim ( ) ,
25
- detail : serverDetail ( servers [ myDefault ] )
26
30
} ) ;
27
31
}
28
-
32
+
29
33
// Process the rest
30
34
for ( const key in servers ) {
31
- if ( ! key . startsWith ( '/' ) && key !== myDefault ) {
32
- const inspected = vscode . workspace . getConfiguration ( ' intersystems.servers' , scope ) . inspect ( key ) ;
35
+ if ( ! key . startsWith ( "/" ) && key !== myDefault ) {
36
+ const inspected = vscode . workspace . getConfiguration ( " intersystems.servers" , scope ) . inspect ( key ) ;
33
37
34
38
// Collect embedded (default~*) servers separately
35
39
if ( notSet ( inspected ) ) {
36
40
embeddedNames . push ( {
41
+ description : servers [ key ] . description || "" ,
42
+ detail : serverDetail ( servers [ key ] ) ,
37
43
name : key ,
38
- description : servers [ key ] . description || '' ,
39
- detail : serverDetail ( servers [ key ] )
40
44
} ) ;
41
45
} else {
42
46
names . push ( {
47
+ description : servers [ key ] . description || "" ,
48
+ detail : serverDetail ( servers [ key ] ) ,
43
49
name : key ,
44
- description : servers [ key ] . description || '' ,
45
- detail : serverDetail ( servers [ key ] )
46
50
} ) ;
47
51
}
48
52
}
@@ -58,7 +62,7 @@ export function getServerNames(scope?: vscode.ConfigurationScope, sorted?: boole
58
62
allNames . push ( ...names ) ;
59
63
60
64
// Append the embedded servers unless suppressed
61
- if ( ! vscode . workspace . getConfiguration ( ' intersystems.servers' , scope ) . get ( ' /hideEmbeddedEntries' ) ) {
65
+ if ( ! vscode . workspace . getConfiguration ( " intersystems.servers" , scope ) . get ( " /hideEmbeddedEntries" ) ) {
62
66
allNames . push ( ...embeddedNames ) ;
63
67
}
64
68
return allNames ;
0 commit comments