@@ -7,34 +7,16 @@ import {
7
7
FILESYSTEM_READONLY_SCHEMA ,
8
8
explorerProvider ,
9
9
} from "../extension" ;
10
- import {
11
- connectionTarget ,
12
- terminalWithDocker ,
13
- shellWithDocker ,
14
- currentFile ,
15
- } from "../utils" ;
10
+ import { connectionTarget , terminalWithDocker , shellWithDocker , currentFile } from "../utils" ;
16
11
import { mainCommandMenu , mainSourceControlMenu } from "./studio" ;
17
12
import { AtelierAPI } from "../api" ;
18
13
import { getCSPToken } from "../utils/getCSPToken" ;
19
14
20
- type ServerAction = {
21
- detail : string ;
22
- id : string ;
23
- label : string ;
24
- rawLink ?: string ;
25
- } ;
15
+ type ServerAction = { detail : string ; id : string ; label : string ; rawLink ?: string } ;
26
16
export async function serverActions ( ) : Promise < void > {
27
17
const { apiTarget, configName : workspaceFolder } = connectionTarget ( ) ;
28
18
const api = new AtelierAPI ( apiTarget ) ;
29
- const {
30
- active,
31
- host = "" ,
32
- ns = "" ,
33
- https,
34
- port = 0 ,
35
- pathPrefix,
36
- docker,
37
- } = api . config ;
19
+ const { active, host = "" , ns = "" , https, port = 0 , pathPrefix, docker } = api . config ;
38
20
const explorerCount = ( await explorerProvider . getChildren ( ) ) . length ;
39
21
if ( ! explorerCount && ( ! docker || host === "" ) ) {
40
22
await vscode . commands . executeCommand ( "ObjectScriptExplorer.focus" ) ;
@@ -56,9 +38,7 @@ export async function serverActions(): Promise<void> {
56
38
detail : "Force attempt to connect to the server" ,
57
39
} ) ;
58
40
}
59
- const connectionActionsHandler = async (
60
- action : ServerAction
61
- ) : Promise < ServerAction > => {
41
+ const connectionActionsHandler = async ( action : ServerAction ) : Promise < ServerAction > => {
62
42
if ( ! action ) {
63
43
return ;
64
44
}
@@ -69,13 +49,8 @@ export async function serverActions(): Promise<void> {
69
49
? vscode . ConfigurationTarget . WorkspaceFolder
70
50
: vscode . ConfigurationTarget . Workspace ;
71
51
const targetConfig =
72
- connConfig . inspect ( "conn" ) . workspaceFolderValue ||
73
- connConfig . inspect ( "conn" ) . workspaceValue ;
74
- return connConfig . update (
75
- "conn" ,
76
- { ...targetConfig , active : ! active } ,
77
- target
78
- ) ;
52
+ connConfig . inspect ( "conn" ) . workspaceFolderValue || connConfig . inspect ( "conn" ) . workspaceValue ;
53
+ return connConfig . update ( "conn" , { ...targetConfig , active : ! active } , target ) ;
79
54
}
80
55
case "refreshConnection" : {
81
56
await checkConnection ( true , undefined , true ) ;
@@ -94,15 +69,10 @@ export async function serverActions(): Promise<void> {
94
69
} ) ;
95
70
}
96
71
const file = currentFile ( ) ;
97
- const classname =
98
- file && file . name . toLowerCase ( ) . endsWith ( ".cls" )
99
- ? file . name . slice ( 0 , - 4 )
100
- : "" ;
72
+ const classname = file && file . name . toLowerCase ( ) . endsWith ( ".cls" ) ? file . name . slice ( 0 , - 4 ) : "" ;
101
73
const classnameEncoded = encodeURIComponent ( classname ) ;
102
74
const connInfo = `${ host } :${ port } ${ pathPrefix } [${ nsEncoded . toUpperCase ( ) } ]` ;
103
- const serverUrl = `${
104
- https ? "https" : "http"
105
- } ://${ host } :${ port } ${ pathPrefix } `;
75
+ const serverUrl = `${ https ? "https" : "http" } ://${ host } :${ port } ${ pathPrefix } ` ;
106
76
const portalPath = `/csp/sys/UtilHome.csp?$NAMESPACE=${ nsEncoded } ` ;
107
77
const classRef = `/csp/documatic/%25CSP.Documatic.cls?LIBRARY=${ nsEncoded } ${
108
78
classname ? "&CLASSNAME=" + classnameEncoded : ""
@@ -111,11 +81,7 @@ export async function serverActions(): Promise<void> {
111
81
for ( const title in links ) {
112
82
const rawLink = String ( links [ title ] ) ;
113
83
// Skip link if it requires a classname and we don't currently have one
114
- if (
115
- classname == "" &&
116
- ( rawLink . includes ( "${classname}" ) ||
117
- rawLink . includes ( "${classnameEncoded}" ) )
118
- ) {
84
+ if ( classname == "" && ( rawLink . includes ( "${classname}" ) || rawLink . includes ( "${classnameEncoded}" ) ) ) {
119
85
continue ;
120
86
}
121
87
const link = rawLink
@@ -161,8 +127,7 @@ export async function serverActions(): Promise<void> {
161
127
if (
162
128
! vscode . window . activeTextEditor ||
163
129
vscode . window . activeTextEditor . document . uri . scheme === FILESYSTEM_SCHEMA ||
164
- vscode . window . activeTextEditor . document . uri . scheme ===
165
- FILESYSTEM_READONLY_SCHEMA
130
+ vscode . window . activeTextEditor . document . uri . scheme === FILESYSTEM_READONLY_SCHEMA
166
131
) {
167
132
actions . push ( {
168
133
id : "serverSourceControlMenu" ,
0 commit comments