1
1
import * as vscode from "vscode" ;
2
2
import { config , workspaceState , checkConnection } from "../extension" ;
3
- import { currentWorkspaceFolder , terminalWithDocker } from "../utils" ;
3
+ import { currentWorkspaceFolder , terminalWithDocker , currentFile } from "../utils" ;
4
4
5
5
export async function serverActions ( ) : Promise < void > {
6
6
const { active, host, ns, https, port : defaultPort , username, password : defaultPassword , links } = config ( "conn" ) ;
@@ -19,10 +19,18 @@ export async function serverActions(): Promise<void> {
19
19
? `&IRISUsername=${ usernameEncoded } &IRISPassword=${ passwordEncoded } `
20
20
: `&CacheUserName=${ usernameEncoded } &CachePassword=${ passwordEncoded } ` ;
21
21
const extraLinks = [ ] ;
22
+ const file = currentFile ( ) ;
23
+ const classname = file && file . name . match ( / c l s $ / i) ? file . name : "" ;
22
24
for ( const title in links ) {
23
- const link = String ( links [ title ] )
25
+ let link = String ( links [ title ] ) ;
26
+ if ( classname == "" && link . includes ( "${classname}" ) ) {
27
+ continue ;
28
+ }
29
+ link = link
24
30
. replace ( "${host}" , host )
25
- . replace ( "${port}" , port ) ;
31
+ . replace ( "${port}" , port )
32
+ . replace ( "${namespace}" , ns == "%SYS" ? "sys" : nsEncoded . toLowerCase ( ) )
33
+ . replace ( "${classname}" , classname ) ;
26
34
extraLinks . push ( {
27
35
id : "extraLink" + extraLinks . length ,
28
36
label : title ,
0 commit comments