當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TextEditor.revealRange方法代碼示例

本文整理匯總了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);
    }
}
開發者ID:sgryjp,項目名稱:japanese-word-handler,代碼行數:12,代碼來源:extension.ts

示例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);
    }
}
開發者ID:sgryjp,項目名稱:japanese-word-handler,代碼行數:13,代碼來源:extension.ts

示例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());
}
開發者ID:yasuyuky,項目名稱:transient-emacs,代碼行數:21,代碼來源:extension.ts

示例4: revealPosition

function revealPosition(editor: TextEditor, line: number, char: number): void {
	editor.revealRange(new Range(line, char, line, char), TextEditorRevealType.Default);
}
開發者ID:DanEEStar,項目名稱:vscode-vim,代碼行數:3,代碼來源:controller.ts

示例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);
	}
開發者ID:DanEEStar,項目名稱:vscode-vim,代碼行數:4,代碼來源:operators.ts

示例6:

 }).then(() => {
     if (editor.selections.length === 1) {
         editor.revealRange(editor.selection);
     }
 });
開發者ID:sgryjp,項目名稱:japanese-word-handler,代碼行數:5,代碼來源:extension.ts

示例7:

 .then( (val) => { 
     editor.revealRange( editor.selection, TextEditorRevealType.InCenterIfOutsideViewport );
 }, 
開發者ID:docura-io,項目名稱:vscode-cm,代碼行數:3,代碼來源:commands.ts

示例8: selection

 set selection(range: FlatRange) {
     this.editor.revealRange(this.getRange(range), TextEditorRevealType.InCenterIfOutsideViewport);
     this.editor.selection = this.getSelection(range);
 }
開發者ID:ryu1kn,項目名稱:vscode-text-marker,代碼行數:4,代碼來源:text-editor.ts


注:本文中的vscode.TextEditor.revealRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。