1
- import * as lsp from " @volar/vscode" ;
2
- import type { VueInitializationOptions } from " @vue/language-server" ;
1
+ import * as lsp from ' @volar/vscode' ;
2
+ import type { VueInitializationOptions } from ' @vue/language-server' ;
3
3
import {
4
4
executeCommand ,
5
5
nextTick ,
@@ -9,14 +9,14 @@ import {
9
9
useCommand ,
10
10
useVscodeContext ,
11
11
watch ,
12
- } from " reactive-vscode" ;
13
- import * as vscode from " vscode" ;
14
- import { config } from " ./config" ;
15
- import { activate as activateDoctor } from " ./features/doctor" ;
16
- import { activate as activateNameCasing } from " ./features/nameCasing" ;
17
- import { activate as activateSplitEditors } from " ./features/splitEditors" ;
18
- import { enabledHybridMode , enabledTypeScriptPlugin , useHybridModeStatusItem , useHybridModeTips } from " ./hybridMode" ;
19
- import { useInsidersStatusItem } from " ./insiders" ;
12
+ } from ' reactive-vscode' ;
13
+ import * as vscode from ' vscode' ;
14
+ import { config } from ' ./config' ;
15
+ import { activate as activateDoctor } from ' ./features/doctor' ;
16
+ import { activate as activateNameCasing } from ' ./features/nameCasing' ;
17
+ import { activate as activateSplitEditors } from ' ./features/splitEditors' ;
18
+ import { enabledHybridMode , enabledTypeScriptPlugin , useHybridModeStatusItem , useHybridModeTips } from ' ./hybridMode' ;
19
+ import { useInsidersStatusItem } from ' ./insiders' ;
20
20
21
21
let client : lsp . BaseLanguageClient ;
22
22
@@ -54,13 +54,13 @@ async function activateLc(
54
54
context : vscode . ExtensionContext ,
55
55
createLc : CreateLanguageClient
56
56
) {
57
- useVscodeContext ( " vue.activated" , true ) ;
58
- const outputChannel = useOutputChannel ( " Vue Language Server" ) ;
57
+ useVscodeContext ( ' vue.activated' , true ) ;
58
+ const outputChannel = useOutputChannel ( ' Vue Language Server' ) ;
59
59
const selectors = config . server . value . includeLanguages ;
60
60
61
61
client = createLc (
62
- " vue" ,
63
- " Vue" ,
62
+ ' vue' ,
63
+ ' Vue' ,
64
64
selectors ,
65
65
await getInitializationOptions ( context , enabledHybridMode . value ) ,
66
66
6009 ,
@@ -71,46 +71,44 @@ async function activateLc(
71
71
if ( newValues [ 0 ] !== oldValues [ 0 ] ) {
72
72
requestReloadVscode (
73
73
newValues [ 0 ]
74
- ? " Please reload VSCode to enable Hybrid Mode."
75
- : " Please reload VSCode to disable Hybrid Mode."
74
+ ? ' Please reload VSCode to enable Hybrid Mode.'
75
+ : ' Please reload VSCode to disable Hybrid Mode.'
76
76
) ;
77
77
} else if ( newValues [ 1 ] !== oldValues [ 1 ] ) {
78
78
requestReloadVscode (
79
79
newValues [ 1 ]
80
- ? " Please reload VSCode to enable Vue TypeScript Plugin."
81
- : " Please reload VSCode to disable Vue TypeScript Plugin."
80
+ ? ' Please reload VSCode to enable Vue TypeScript Plugin.'
81
+ : ' Please reload VSCode to disable Vue TypeScript Plugin.'
82
82
) ;
83
83
}
84
84
} ) ;
85
85
86
86
watch ( ( ) => config . server . value . includeLanguages , ( ) => {
87
87
if ( enabledHybridMode . value ) {
88
88
requestReloadVscode (
89
- " Please reload VSCode to apply the new language settings."
89
+ ' Please reload VSCode to apply the new language settings.'
90
90
) ;
91
91
}
92
92
} ) ;
93
93
94
94
watch ( config . server , ( ) => {
95
95
if ( ! enabledHybridMode . value ) {
96
- executeCommand ( " vue.action.restartServer" , false ) ;
96
+ executeCommand ( ' vue.action.restartServer' , false ) ;
97
97
}
98
98
} ) ;
99
99
100
100
watch ( Object . values ( config ) . filter ( ( conf ) => conf !== config . server ) , ( ) => {
101
- executeCommand ( " vue.action.restartServer" , false ) ;
101
+ executeCommand ( ' vue.action.restartServer' , false ) ;
102
102
} ) ;
103
103
104
- useCommand ( " vue.action.restartServer" , async ( restartTsServer : boolean = true ) => {
104
+ useCommand ( ' vue.action.restartServer' , async ( restartTsServer : boolean = true ) => {
105
105
if ( restartTsServer ) {
106
- await executeCommand ( " typescript.restartTsServer" ) ;
106
+ await executeCommand ( ' typescript.restartTsServer' ) ;
107
107
}
108
108
await client . stop ( ) ;
109
109
outputChannel . clear ( ) ;
110
- client . clientOptions . initializationOptions =
111
- await getInitializationOptions ( context , enabledHybridMode . value ) ;
110
+ client . clientOptions . initializationOptions = await getInitializationOptions ( context , enabledHybridMode . value ) ;
112
111
await client . start ( ) ;
113
- activateNameCasing ( client , selectors ) ;
114
112
} ) ;
115
113
116
114
activateDoctor ( context , client ) ;
@@ -119,17 +117,12 @@ async function activateLc(
119
117
120
118
lsp . activateAutoInsertion ( selectors , client ) ;
121
119
lsp . activateDocumentDropEdit ( selectors , client ) ;
122
- lsp . activateWriteVirtualFiles ( " vue.action.writeVirtualFiles" , client ) ;
120
+ lsp . activateWriteVirtualFiles ( ' vue.action.writeVirtualFiles' , client ) ;
123
121
124
122
if ( ! enabledHybridMode . value ) {
125
- lsp . activateTsConfigStatusItem ( selectors , "vue.tsconfig" , client ) ;
126
- lsp . activateTsVersionStatusItem (
127
- selectors ,
128
- "vue.tsversion" ,
129
- context ,
130
- ( text ) => "TS " + text
131
- ) ;
132
- lsp . activateFindFileReferences ( "vue.findAllFileReferences" , client ) ;
123
+ lsp . activateTsConfigStatusItem ( selectors , 'vue.tsconfig' , client ) ;
124
+ lsp . activateTsVersionStatusItem ( selectors , 'vue.tsversion' , context , ( text ) => 'TS ' + text ) ;
125
+ lsp . activateFindFileReferences ( 'vue.findAllFileReferences' , client ) ;
133
126
}
134
127
135
128
useHybridModeStatusItem ( ) ;
@@ -138,12 +131,12 @@ async function activateLc(
138
131
async function requestReloadVscode ( msg : string ) {
139
132
const reload = await vscode . window . showInformationMessage (
140
133
msg ,
141
- " Reload Window"
134
+ ' Reload Window'
142
135
) ;
143
136
if ( reload === undefined ) {
144
137
return ; // cancel
145
138
}
146
- executeCommand ( " workbench.action.reloadWindow" ) ;
139
+ executeCommand ( ' workbench.action.reloadWindow' ) ;
147
140
}
148
141
}
149
142
0 commit comments