Snippet insertion extension API changes

- Basing snippet insertion failure on a new `_codeEditor` null-check.
- Now returns `Thenable<boolean>`.
- Removed vscode.proposed.d.ts copy of the `TextEditor` change.
- Removing empty options interface.
This commit is contained in:
Joel Day
2017-01-18 10:13:56 -08:00
parent 95fc03271c
commit c21734fd30
9 changed files with 22 additions and 33 deletions

View File

@@ -68,10 +68,6 @@ export interface IApplyEditsOptions extends IUndoStopOptions {
setEndOfLine: EndOfLine;
}
export interface IInsertSnippetOptions extends IUndoStopOptions {
}
/**
* Text Editor that is permanently bound to the same model.
* It can be bound or not to a CodeEditor.
@@ -392,9 +388,13 @@ export class MainThreadTextEditor {
return false;
}
insertSnippet(template: string, opts: IInsertSnippetOptions) {
insertSnippet(template: string, opts: IUndoStopOptions) {
const snippetController = SnippetController.get(this._codeEditor);
if (!this._codeEditor) {
return false;
}
this._codeEditor.focus();
if (opts.undoStopBefore) {
@@ -406,6 +406,8 @@ export class MainThreadTextEditor {
if (opts.undoStopAfter) {
this._codeEditor.pushUndoStop();
}
return true;
}
}