@@ -83,7 +83,7 @@ export function startServer(options?: LSOptions) {
83
83
( textDocument ) => new Document ( textDocument . uri , textDocument . text )
84
84
) ;
85
85
const configManager = new LSConfigManager ( ) ;
86
- const pluginHost = new PluginHost ( docManager , configManager ) ;
86
+ const pluginHost = new PluginHost ( docManager ) ;
87
87
let sveltePlugin : SveltePlugin = undefined as any ;
88
88
89
89
connection . onInitialize ( ( evt ) => {
@@ -95,25 +95,19 @@ export function startServer(options?: LSOptions) {
95
95
Logger . error ( 'No workspace path set' ) ;
96
96
}
97
97
98
+ configManager . update ( evt . initializationOptions ?. config || { } ) ;
99
+ configManager . updateTsJsUserPreferences ( evt . initializationOptions ?. typescriptConfig || { } ) ;
100
+ configManager . updateEmmetConfig ( evt . initializationOptions ?. emmetConfig || { } ) ;
101
+ configManager . updatePrettierConfig ( evt . initializationOptions ?. prettierConfig || { } ) ;
102
+
98
103
pluginHost . initialize ( {
99
104
filterIncompleteCompletions : ! evt . initializationOptions
100
105
?. dontFilterIncompleteCompletions ,
101
106
definitionLinkSupport : ! ! evt . capabilities . textDocument ?. definition ?. linkSupport
102
107
} ) ;
103
- pluginHost . updateConfig ( evt . initializationOptions ?. config || { } ) ;
104
- pluginHost . updateTsUserPreferences ( evt . initializationOptions ?. typescriptConfig || { } ) ;
105
- pluginHost . register (
106
- ( sveltePlugin = new SveltePlugin (
107
- configManager ,
108
- evt . initializationOptions ?. prettierConfig
109
- ) )
110
- ) ;
111
- pluginHost . register (
112
- new HTMLPlugin ( docManager , configManager , evt . initializationOptions ?. emmetConfig )
113
- ) ;
114
- pluginHost . register (
115
- new CSSPlugin ( docManager , configManager , evt . initializationOptions ?. emmetConfig )
116
- ) ;
108
+ pluginHost . register ( ( sveltePlugin = new SveltePlugin ( configManager ) ) ) ;
109
+ pluginHost . register ( new HTMLPlugin ( docManager , configManager ) ) ;
110
+ pluginHost . register ( new CSSPlugin ( docManager , configManager ) ) ;
117
111
pluginHost . register ( new TypeScriptPlugin ( docManager , configManager , workspaceUris ) ) ;
118
112
119
113
const clientSupportApplyEditCommand = ! ! evt . capabilities . workspace ?. applyEdit ;
@@ -206,8 +200,10 @@ export function startServer(options?: LSOptions) {
206
200
connection . onPrepareRename ( ( req ) => pluginHost . prepareRename ( req . textDocument , req . position ) ) ;
207
201
208
202
connection . onDidChangeConfiguration ( ( { settings } ) => {
209
- pluginHost . updateConfig ( settings . svelte ?. plugin ) ;
210
- pluginHost . updateTsUserPreferences ( settings ) ;
203
+ configManager . update ( settings . svelte ?. plugin ) ;
204
+ configManager . updateTsJsUserPreferences ( settings ) ;
205
+ configManager . updateEmmetConfig ( settings . emmet ) ;
206
+ configManager . updatePrettierConfig ( settings . prettier ) ;
211
207
} ) ;
212
208
213
209
connection . onDidOpenTextDocument ( ( evt ) => {
@@ -284,10 +280,12 @@ export function startServer(options?: LSOptions) {
284
280
) ;
285
281
286
282
connection . onDidChangeWatchedFiles ( ( para ) => {
287
- const onWatchFileChangesParas = para . changes . map ( ( change ) => ( {
288
- fileName : urlToPath ( change . uri ) ,
289
- changeType : change . type
290
- } ) ) . filter ( ( change ) : change is OnWatchFileChangesPara => ! ! change . fileName ) ;
283
+ const onWatchFileChangesParas = para . changes
284
+ . map ( ( change ) => ( {
285
+ fileName : urlToPath ( change . uri ) ,
286
+ changeType : change . type
287
+ } ) )
288
+ . filter ( ( change ) : change is OnWatchFileChangesPara => ! ! change . fileName ) ;
291
289
292
290
pluginHost . onWatchFileChanges ( onWatchFileChangesParas ) ;
293
291
0 commit comments