@@ -19,7 +19,6 @@ import { config } from './lib/config';
19
19
import { activate as activateWelcome } from './lib/welcome' ;
20
20
21
21
let client : lsp . BaseLanguageClient | undefined ;
22
- let needRestart = false ;
23
22
24
23
export const { activate, deactivate } = defineExtension ( ( ) => {
25
24
const context = extensionContext . value ! ;
@@ -56,22 +55,6 @@ export const { activate, deactivate } = defineExtension(() => {
56
55
}
57
56
}
58
57
59
- if ( needRestart ) {
60
- vscode . window . showInformationMessage (
61
- 'Please restart the extension host to activate Vue support in remote environments.' ,
62
- 'Restart Extension Host' ,
63
- 'Reload Window' ,
64
- ) . then ( action => {
65
- if ( action === 'Restart Extension Host' ) {
66
- vscode . commands . executeCommand ( 'workbench.action.restartExtensionHost' ) ;
67
- }
68
- else if ( action === 'Reload Window' ) {
69
- vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
70
- }
71
- } ) ;
72
- return ;
73
- }
74
-
75
58
watch ( ( ) => config . server . includeLanguages , async ( ) => {
76
59
const reload = await vscode . window . showInformationMessage (
77
60
'Please restart extension host to apply the new language settings.' ,
@@ -172,7 +155,9 @@ function launch(context: vscode.ExtensionContext) {
172
155
return client ;
173
156
}
174
157
175
- try {
158
+ patchTypescriptExtension ( ) ;
159
+
160
+ function patchTypescriptExtension ( ) {
176
161
const fs = require ( 'node:fs' ) ;
177
162
const tsExtension = vscode . extensions . getExtension ( 'vscode.typescript-language-features' ) ! ;
178
163
const readFileSync = fs . readFileSync ;
@@ -221,21 +206,4 @@ try {
221
206
}
222
207
return readFileSync ( ...args ) ;
223
208
} ;
224
-
225
- const loadedModule = require . cache [ extensionJsPath ] ;
226
- if ( loadedModule ) {
227
- delete require . cache [ extensionJsPath ] ;
228
- const patchedModule = require ( extensionJsPath ) ;
229
- Object . assign ( loadedModule . exports , patchedModule ) ;
230
- }
231
-
232
- if ( tsExtension . isActive ) {
233
- if ( ! vscode . env . remoteName ) {
234
- vscode . commands . executeCommand ( 'workbench.action.restartExtensionHost' ) ;
235
- }
236
- else {
237
- needRestart = true ;
238
- }
239
- }
240
209
}
241
- catch { }
0 commit comments