Mark readonly on insertSnippet

This function does not modify the input array
This commit is contained in:
Matt Bierner
2019-06-13 14:11:46 -07:00
parent bb48783c40
commit 3bb736272e
5 changed files with 5 additions and 5 deletions

View File

@@ -469,7 +469,7 @@ export class MainThreadTextEditor {
return true;
}
insertSnippet(template: string, ranges: IRange[], opts: IUndoStopOptions) {
insertSnippet(template: string, ranges: readonly IRange[], opts: IUndoStopOptions) {
if (!this._codeEditor) {
return false;

View File

@@ -213,7 +213,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
return this._bulkEditService.apply({ edits }, undefined).then(() => true, err => false);
}
$tryInsertSnippet(id: string, template: string, ranges: IRange[], opts: IUndoStopOptions): Promise<boolean> {
$tryInsertSnippet(id: string, template: string, ranges: readonly IRange[], opts: IUndoStopOptions): Promise<boolean> {
if (!this._documentsAndEditors.getEditor(id)) {
return Promise.reject(disposed(`TextEditor(${id})`));
}

View File

@@ -248,7 +248,7 @@ export interface MainThreadTextEditorsShape extends IDisposable {
$trySetSelections(id: string, selections: ISelection[]): Promise<void>;
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): Promise<boolean>;
$tryApplyWorkspaceEdit(workspaceEditDto: WorkspaceEditDto): Promise<boolean>;
$tryInsertSnippet(id: string, template: string, selections: IRange[], opts: IUndoStopOptions): Promise<boolean>;
$tryInsertSnippet(id: string, template: string, selections: readonly IRange[], opts: IUndoStopOptions): Promise<boolean>;
$getDiffInformation(id: string): Promise<editorCommon.ILineChange[]>;
}

View File

@@ -613,7 +613,7 @@ export class ExtHostTextEditor implements vscode.TextEditor {
});
}
insertSnippet(snippet: SnippetString, where?: Position | Position[] | Range | Range[], options: { undoStopBefore: boolean; undoStopAfter: boolean; } = { undoStopBefore: true, undoStopAfter: true }): Promise<boolean> {
insertSnippet(snippet: SnippetString, where?: Position | readonly Position[] | Range | readonly Range[], options: { undoStopBefore: boolean; undoStopAfter: boolean; } = { undoStopBefore: true, undoStopAfter: true }): Promise<boolean> {
if (this._disposed) {
return Promise.reject(new Error('TextEditor#insertSnippet not possible on closed editors'));
}