-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Improve user experience when creating CSpell config or a custom …
…dictionary. (#1131) * dev: Improve VS Code Jest Mocks Support - workspace.openTextDocument - window.showTextDocument - TextEditor - TextDocument - unit tests * dev: scroll to the `cspell` section of `package.json` * dev: open the newly created dictionary
- Loading branch information
Showing
18 changed files
with
459 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export function scrollToText(editor: vscode.TextEditor, text: string): boolean { | ||
const doc = editor.document; | ||
const offset = doc.getText().indexOf(text); | ||
if (offset < 0) return false; | ||
|
||
const pos = doc.positionAt(offset); | ||
const range = new vscode.Range(pos.line, pos.character, pos.line, pos.character + text.length); | ||
range && editor.revealRange(range, vscode.TextEditorRevealType.InCenterIfOutsideViewport); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.