本文整理匯總了TypeScript中vscode.TextEditor.revealRange方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TextEditor.revealRange方法的具體用法?TypeScript TextEditor.revealRange怎麽用?TypeScript TextEditor.revealRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.TextEditor
的用法示例。
在下文中一共展示了TextEditor.revealRange方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: cursorPrevWordStartJa
export function cursorPrevWordStartJa(
editor: TextEditor,
wordSeparators: string
) {
const document = editor.document;
editor.selections = editor.selections
.map(s => positionOfPrevWordStart(document, s.active, wordSeparators))
.map(p => new Selection(p, p));
if (editor.selections.length === 1) {
editor.revealRange(editor.selection);
}
}
示例2: cursorNextWordEndSelectJa
export function cursorNextWordEndSelectJa(
editor: TextEditor,
wordSeparators: string
) {
editor.selections = editor.selections
.map(s => new Selection(
s.anchor,
positionOfNextWordEnd(editor.document, s.active, wordSeparators))
);
if (editor.selections.length === 1) {
editor.revealRange(editor.selection);
}
}
示例3: cursorParagraphMove
function cursorParagraphMove(
editor: TextEditor,
next: (l: number) => number,
limit: (l: number) => boolean,
end: Position,
select: boolean
) {
const doc = editor.document;
editor.selections = editor.selections.map(s => {
var l = s.active.line;
for (var flag = false; limit(l); l = next(l)) {
if (!doc.lineAt(l).isEmptyOrWhitespace) flag = true;
if (flag && doc.lineAt(l).isEmptyOrWhitespace) {
const p = new vscode.Position(l, 0);
return new vscode.Selection(select ? s.anchor : p, p);
}
}
return new Selection(select ? s.anchor : end, end);
});
editor.revealRange(editor.selections[editor.selections.length - 1].with());
}
示例4: revealPosition
function revealPosition(editor: TextEditor, line: number, char: number): void {
editor.revealRange(new Range(line, char, line, char), TextEditorRevealType.Default);
}
示例5: setPosReveal
protected setPosReveal(ed:TextEditor, line: number, char: number): void {
ed.selection = new Selection(new Position(line, char), new Position(line, char));
ed.revealRange(ed.selection, TextEditorRevealType.Default);
}
示例6:
}).then(() => {
if (editor.selections.length === 1) {
editor.revealRange(editor.selection);
}
});
示例7:
.then( (val) => {
editor.revealRange( editor.selection, TextEditorRevealType.InCenterIfOutsideViewport );
},
示例8: selection
set selection(range: FlatRange) {
this.editor.revealRange(this.getRange(range), TextEditorRevealType.InCenterIfOutsideViewport);
this.editor.selection = this.getSelection(range);
}