Skip to content

Commit

Permalink
Merge pull request #187683 from microsoft/joh/fix/187642
Browse files Browse the repository at this point in the history
Make sure to register the actual disposable that's for the exclusive …
  • Loading branch information
jrieken authored Jul 12, 2023
2 parents e546b82 + 0f871d1 commit 36bfa70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vs/editor/contrib/snippet/browser/snippetController2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

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

const model = this._editor.getModel();

let registration: IDisposable = Disposable.None;
let registration: IDisposable | undefined;
let isRegistered = false;
const disable = () => {
registration.dispose();
registration?.dispose();
isRegistered = false;
};

Expand All @@ -203,11 +203,11 @@ export class SnippetController2 implements IEditorContribution {
scheme: model.uri.scheme,
exclusive: true
}, provider);
this._snippetListener.add(registration);
isRegistered = true;
}
};

this._snippetListener.add(registration);
this._choiceCompletions = { provider, enable, disable };
}

Expand Down

0 comments on commit 36bfa70

Please sign in to comment.