Skip to content

Commit 9f340c5

Browse files
authored
fix(monaco-editor): avoid disposal of standalone services (#3517)
StandaloneServices is a singleton and can be initialized only once. Subsequent initializations are noops. This has a side effect which is inability to dispose of the services via StandaloneServices interface. Individual services can be disposed of separately, but if one decides to do that StandaloneServices will not able to initialize them again.
1 parent f049020 commit 9f340c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/plugins/editor-monaco/workers/apidom/apidom-mode.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ export function setupMode(defaults) {
6363
const protocolConverter = createProtocolConverter(undefined, true, true);
6464
const client = new WorkerManager(defaults);
6565

66+
/**
67+
* StandaloneServices is a singleton and can be initialized only once.
68+
* Subsequent initializations are noops. This has a side effect which
69+
* is inability to dispose of the services via StandaloneServices interface.
70+
* Individual services can be disposed of separately, but if one decides
71+
* to do that StandaloneServices will not able to initialize them again.
72+
*/
6673
StandaloneServices.initialize({});
74+
6775
// enable showing documentation while autocomplete suggestions are listed
6876
StandaloneServices.get(IStorageService).store('expandSuggestionDocs', true, 0, 0);
6977

@@ -81,7 +89,6 @@ export function setupMode(defaults) {
8189

8290
disposables.push(vscode.languages.setLanguageConfiguration(languageId, richLanguage));
8391
disposables.push(asDisposable(registeredProviders));
84-
disposables.push(asDisposable([StandaloneServices]));
8592

8693
return asDisposable(disposables);
8794
}

0 commit comments

Comments
 (0)