11import {
2- Configurations , ConfigurationChangeEvent , WorkspaceConfiguration , Event , Emitter
2+ Configurations , ConfigurationChangeEvent , WorkspaceConfiguration , Event , Emitter , Disposable , DisposableCollection
33} from 'monaco-languageclient'
44import * as monaco from 'monaco-editor'
55
@@ -38,8 +38,16 @@ class MemoryWorkspaceConfiguration implements WorkspaceConfiguration {
3838}
3939
4040const simpleConfigurationService = monaco . extra . StandaloneServices . get ( monaco . extra . IConfigurationService ) as monaco . extra . StandaloneConfigurationService
41- class Configuration implements Configurations {
41+ class Configuration implements Configurations , Disposable {
4242 protected readonly onDidChangeConfigurationEmitter = new Emitter < ConfigurationChangeEvent > ( )
43+ private disposableCollection = new DisposableCollection ( )
44+
45+ constructor ( ) {
46+ this . disposableCollection . push ( this . onDidChangeConfigurationEmitter )
47+ this . disposableCollection . push ( simpleConfigurationService . onDidChangeConfiguration ( ( event ) => {
48+ this . onDidChangeConfigurationEmitter . fire ( event )
49+ } ) )
50+ }
4351
4452 getConfiguration ( section ?: string , resource ?: string ) : MemoryWorkspaceConfiguration {
4553 return new MemoryWorkspaceConfiguration ( this . getValue ( section , resource ) )
@@ -56,7 +64,11 @@ class Configuration implements Configurations {
5664 }
5765
5866 get onDidChangeConfiguration ( ) : Event < ConfigurationChangeEvent > {
59- return simpleConfigurationService . onDidChangeConfiguration
67+ return this . onDidChangeConfigurationEmitter . event
68+ }
69+
70+ dispose ( ) : void {
71+ this . disposableCollection . dispose ( )
6072 }
6173}
6274
0 commit comments