当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript extraterm-extension-api.TextViewer类代码示例

本文整理汇总了TypeScript中extraterm-extension-api.TextViewer的典型用法代码示例。如果您正苦于以下问题:TypeScript TextViewer类的具体用法?TypeScript TextViewer怎么用?TypeScript TextViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TextViewer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: textViewerCommandExecutor

async function textViewerCommandExecutor(textViewer: TextViewer, commandId: string, commandArguments?: object): Promise<any> {
  const selectedTabSize = await textViewer.getTab().showNumberInput({
    title: "Tab Size",
    value: textViewer.getTabSize(),
    minimum: 0,
    maximum: 32
  });
  if (selectedTabSize !== undefined) {
    textViewer.setTabSize(selectedTabSize);
  }
}
开发者ID:mathpunk,项目名称:extraterm,代码行数:11,代码来源:TextViewerTabWidthExtension.ts

示例2: tabCommand

async function tabCommand(textViewer: TextViewer): Promise<any> {
  const selectedTabSize = await textViewer.getTab().showNumberInput({
    title: "Tab Size",
    value: textViewer.getTabSize(),
    minimum: 0,
    maximum: 32
  });
  if (selectedTabSize !== undefined) {
    textViewer.setTabSize(selectedTabSize);
  }
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:11,代码来源:TextViewerOptionsExtension.ts

示例3: syntaxHighlightingCommandExecutor

async function syntaxHighlightingCommandExecutor(textViewer: TextViewer): Promise<any> {
  const modesByNameObject = extensionContext.aceModule.ModeList.modesByName
  const mimeList: {name: string, nameLower: string, mime: string}[] =  [];
  for (let key in modesByNameObject) {
    const mode = modesByNameObject[key];
    mimeList.push({name: mode.friendlyName, nameLower: mode.friendlyName.toLowerCase(), mime: mode.mimeTypes[0]});
  }

  sortArrayBy(mimeList, item => item.nameLower);

  const items = mimeList.map(item => item.name + ' ' + item.mime);
  const mimeTypeNames = mimeList.map(item => item.name);
  const selectedItemIndex = mimeTypeNames.indexOf(getMimeTypeName(textViewer));

  const newSelectedItemIndex = await textViewer.getTab().showListPicker({
    title: "Syntax Highlighting",
    items: items,
    selectedItemIndex
  });
  if (newSelectedItemIndex !== undefined) {
    textViewer.setMimeType(mimeList[newSelectedItemIndex].mime);
  }
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:23,代码来源:TextViewerOptionsExtension.ts

示例4: textViewerCommandLister

function textViewerCommandLister(textViewer: TextViewer): CommandEntry[] {
  return [{
    id: COMMAND_SET_TAB_WIDTH,
    label: "Tab Size: " + textViewer.getTabSize()
  }];
}
开发者ID:mathpunk,项目名称:extraterm,代码行数:6,代码来源:TextViewerTabWidthExtension.ts

示例5: getTabCommandTitle

function getTabCommandTitle(textViewer: TextViewer): CustomizedCommand {
  return {
    title: "Tab Size: " + textViewer.getTabSize(),
  };
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:5,代码来源:TextViewerOptionsExtension.ts

示例6: getMimeTypeName

function getMimeTypeName(textViewer: TextViewer): string {
  const mimeType = textViewer.getMimeType();
  const matchingMode = extensionContext.aceModule.ModeList.getModeByMimeType(mimeType);
  return matchingMode != null ? matchingMode.friendlyName : mimeType;
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:5,代码来源:TextViewerOptionsExtension.ts

示例7: toggleLineNumbers

async function toggleLineNumbers(textViewer: TextViewer): Promise<any> {
  textViewer.setShowLineNumbers( ! textViewer.getShowLineNumbers());
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:3,代码来源:TextViewerOptionsExtension.ts

示例8: getToggleLineNumbersTitle

//-------------------------------------------------------------------------
function getToggleLineNumbersTitle(textViewer: TextViewer): CustomizedCommand {
  return {
    checked: textViewer.getShowLineNumbers()
  };
}
开发者ID:sedwards2009,项目名称:extraterm,代码行数:6,代码来源:TextViewerOptionsExtension.ts


注:本文中的extraterm-extension-api.TextViewer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。