@@ -22,6 +22,7 @@ import {
2222 RevealOutputChannelOn ,
2323 TransportKind ,
2424 ProvideCodeLensesSignature ,
25+ DidChangeConfigurationNotification ,
2526} from "vscode-languageclient" ;
2627import * as Package from "./elmPackage" ;
2728import * as RefactorAction from "./refactorAction" ;
@@ -136,22 +137,7 @@ export function activate(context: ExtensionContext): void {
136137 synchronize : {
137138 fileEvents : Workspace . createFileSystemWatcher ( "**/*.elm" ) ,
138139 } ,
139- initializationOptions : config
140- ? {
141- elmAnalyseTrigger : config . elmAnalyseTrigger ,
142- elmFormatPath : config . elmFormatPath ,
143- elmPath : config . elmPath ,
144- elmTestPath : config . elmTestPath ,
145- trace : {
146- server : config . trace . server ,
147- } ,
148- extendedCapabilities : {
149- moveFunctionRefactoringSupport : true ,
150- exposeUnexposeSupport : true ,
151- } ,
152- disableElmLSDiagnostics : config . disableElmLSDiagnostics ,
153- }
154- : { } ,
140+ initializationOptions : getSettings ( config ) ,
155141 middleware : new CodeLensResolver ( ) ,
156142 outputChannel,
157143 progressOnInitialization : true ,
@@ -186,23 +172,54 @@ export function activate(context: ExtensionContext): void {
186172
187173 Workspace . onDidCreateFiles ( ( e ) => {
188174 if ( e . files . some ( ( file ) => file . toString ( ) . endsWith ( ".elm" ) ) ) {
189- clients . forEach ( ( client ) =>
190- client . sendRequest ( OnDidCreateFilesRequest , e ) ,
175+ clients . forEach (
176+ ( client ) => void client . sendRequest ( OnDidCreateFilesRequest , e ) ,
191177 ) ;
192178 }
193179 } ) ;
194180
195181 Workspace . onDidRenameFiles ( ( e ) => {
196182 if ( e . files . some ( ( { newUri } ) => newUri . toString ( ) . endsWith ( ".elm" ) ) ) {
183+ clients . forEach (
184+ ( client ) => void client . sendRequest ( OnDidRenameFilesRequest , e ) ,
185+ ) ;
186+ }
187+ } ) ;
188+
189+ Workspace . onDidChangeConfiguration ( ( event ) => {
190+ if ( event . affectsConfiguration ( "elmLS" ) ) {
197191 clients . forEach ( ( client ) =>
198- client . sendRequest ( OnDidRenameFilesRequest , e ) ,
192+ client . sendNotification ( DidChangeConfigurationNotification . type , {
193+ settings : getSettings (
194+ Workspace . getConfiguration ( ) . get < IClientSettings > ( "elmLS" ) ,
195+ ) ,
196+ } ) ,
199197 ) ;
200198 }
201199 } ) ;
202200
203201 const packageDisposables = Package . activatePackage ( ) ;
204202 packageDisposables . forEach ( ( d ) => context . subscriptions . push ( d ) ) ;
205203 context . subscriptions . push ( Restart . registerCommand ( clients ) ) ;
204+
205+ function getSettings ( config : IClientSettings | undefined ) : unknown {
206+ return config
207+ ? {
208+ elmAnalyseTrigger : config . elmAnalyseTrigger ,
209+ elmFormatPath : config . elmFormatPath ,
210+ elmPath : config . elmPath ,
211+ elmTestPath : config . elmTestPath ,
212+ trace : {
213+ server : config . trace . server ,
214+ } ,
215+ extendedCapabilities : {
216+ moveFunctionRefactoringSupport : true ,
217+ exposeUnexposeSupport : true ,
218+ } ,
219+ disableElmLSDiagnostics : config . disableElmLSDiagnostics ,
220+ }
221+ : { } ;
222+ }
206223}
207224
208225export function deactivate ( ) : Thenable < void > | undefined {
@@ -214,8 +231,8 @@ export function deactivate(): Thenable<void> | undefined {
214231}
215232class CachedCodeLensResponse {
216233 response ?: ProviderResult < CodeLens [ ] > ;
217- version : number = - 1 ;
218- document : string = "" ;
234+ version = - 1 ;
235+ document = "" ;
219236
220237 matches ( document : TextDocument ) : boolean {
221238 return (
0 commit comments