Skip to content

Commit 36bfa70

Browse files
authored
Merge pull request #187683 from microsoft/joh/fix/187642
Make sure to register the actual disposable that's for the exclusive …
2 parents e546b82 + 0f871d1 commit 36bfa70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vs/editor/contrib/snippet/browser/snippetController2.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
7-
import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
7+
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
88
import { assertType } from 'vs/base/common/types';
99
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1010
import { EditorCommand, EditorContributionInstantiation, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
@@ -188,10 +188,10 @@ export class SnippetController2 implements IEditorContribution {
188188

189189
const model = this._editor.getModel();
190190

191-
let registration: IDisposable = Disposable.None;
191+
let registration: IDisposable | undefined;
192192
let isRegistered = false;
193193
const disable = () => {
194-
registration.dispose();
194+
registration?.dispose();
195195
isRegistered = false;
196196
};
197197

@@ -203,11 +203,11 @@ export class SnippetController2 implements IEditorContribution {
203203
scheme: model.uri.scheme,
204204
exclusive: true
205205
}, provider);
206+
this._snippetListener.add(registration);
206207
isRegistered = true;
207208
}
208209
};
209210

210-
this._snippetListener.add(registration);
211211
this._choiceCompletions = { provider, enable, disable };
212212
}
213213

0 commit comments

Comments
 (0)