@@ -21,6 +21,11 @@ let windows: boolean = process.platform == 'win32';
21
21
let osx : boolean = process . platform == 'darwin' ;
22
22
let linux : boolean = process . platform == 'linux' ;
23
23
24
+ export function isInsiders ( ) : boolean {
25
+ // I have no idea if this works for non english :|
26
+ return vscode . env . appName . toLowerCase ( ) . includes ( "insider" ) ;
27
+ }
28
+
24
29
export function getInstalledExtensions ( ) : vscode . Extension < any > [ ] {
25
30
return vscode . extensions . all . filter ( e => {
26
31
return e . extensionPath . startsWith ( os . homedir ( ) ) ;
@@ -34,19 +39,27 @@ export function getExtensionDir(): string {
34
39
return p . dir ;
35
40
}
36
41
else {
37
- return path . join ( os . homedir ( ) , '.vscode/extensions' ) ;
42
+ let extensionsPath : string = '.vscode/extensions' ;
43
+ if ( isInsiders ( ) ) {
44
+ extensionsPath = '.vscode-insiders/extensions' ;
45
+ }
46
+ return path . join ( os . homedir ( ) , extensionsPath ) ;
38
47
}
39
48
}
40
49
41
50
function getCodeSettingsFolderPath ( ) : string {
51
+ let codeString = 'Code' ;
52
+ if ( isInsiders ( ) ) {
53
+ codeString = 'Code - Insiders'
54
+ }
42
55
if ( windows ) {
43
- return path . join ( process . env . APPDATA , 'Code /User/' ) ;
56
+ return path . join ( process . env . APPDATA , ` ${ codeString } /User/` ) ;
44
57
}
45
58
else if ( osx ) {
46
- return path . join ( os . homedir ( ) , ' Library/Application Support/Code /User/' ) ;
59
+ return path . join ( os . homedir ( ) , ` Library/Application Support/${ codeString } /User/` ) ;
47
60
}
48
61
else if ( linux ) {
49
- return path . join ( os . homedir ( ) , ' .config/Code /User/' ) ;
62
+ return path . join ( os . homedir ( ) , ` .config/${ codeString } /User/` ) ;
50
63
}
51
64
else {
52
65
return '' ;
@@ -136,11 +149,16 @@ export function logError(err: Error): void {
136
149
}
137
150
138
151
function getCodeCommand ( ) : string {
152
+ let codeString : string = 'code' ;
153
+ if ( isInsiders ( ) ) {
154
+ codeString = 'code-insiders' ;
155
+ }
156
+
139
157
if ( windows ) {
140
- return 'code .cmd' ;
158
+ return ` ${ codeString } .cmd` ;
141
159
}
142
160
else {
143
- return 'code' ;
161
+ return codeString ;
144
162
}
145
163
}
146
164
0 commit comments