diff options
| author | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2023-06-28 04:03:53 +0900 |
|---|---|---|
| committer | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2023-07-06 16:17:02 +0900 |
| commit | 72a3883a7128b4eae6f38d6479f33aaaaae4790b (patch) | |
| tree | 60b9d6f755bbefeca335bcbc10d0832abc719c48 /editors/code/src/snippets.ts | |
| parent | bb35d8fa8ef9de3c8282602b411c40b266dc3a4e (diff) | |
| download | rust-72a3883a7128b4eae6f38d6479f33aaaaae4790b.tar.gz rust-72a3883a7128b4eae6f38d6479f33aaaaae4790b.zip | |
editor/code: Enable `noUncheckedIndexedAccess` ts option
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess
Diffstat (limited to 'editors/code/src/snippets.ts')
| -rw-r--r-- | editors/code/src/snippets.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/editors/code/src/snippets.ts b/editors/code/src/snippets.ts index 299d29c27ee..1ad93d280ba 100644 --- a/editors/code/src/snippets.ts +++ b/editors/code/src/snippets.ts @@ -1,10 +1,11 @@ import * as vscode from "vscode"; import { assert } from "./util"; +import { unwrapUndefinable } from "./undefinable"; export async function applySnippetWorkspaceEdit(edit: vscode.WorkspaceEdit) { if (edit.entries().length === 1) { - const [uri, edits] = edit.entries()[0]; + const [uri, edits] = unwrapUndefinable(edit.entries()[0]); const editor = await editorFromUri(uri); if (editor) await applySnippetTextEdits(editor, edits); return; @@ -68,7 +69,8 @@ export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vs }); if (selections.length > 0) editor.selections = selections; if (selections.length === 1) { - editor.revealRange(selections[0], vscode.TextEditorRevealType.InCenterIfOutsideViewport); + const selection = unwrapUndefinable(selections[0]); + editor.revealRange(selection, vscode.TextEditorRevealType.InCenterIfOutsideViewport); } } |
