本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例4: textViewerCommandLister
function textViewerCommandLister(textViewer: TextViewer): CommandEntry[] {
return [{
id: COMMAND_SET_TAB_WIDTH,
label: "Tab Size: " + textViewer.getTabSize()
}];
}
示例5: getTabCommandTitle
function getTabCommandTitle(textViewer: TextViewer): CustomizedCommand {
return {
title: "Tab Size: " + textViewer.getTabSize(),
};
}
示例6: getMimeTypeName
function getMimeTypeName(textViewer: TextViewer): string {
const mimeType = textViewer.getMimeType();
const matchingMode = extensionContext.aceModule.ModeList.getModeByMimeType(mimeType);
return matchingMode != null ? matchingMode.friendlyName : mimeType;
}
示例7: toggleLineNumbers
async function toggleLineNumbers(textViewer: TextViewer): Promise<any> {
textViewer.setShowLineNumbers( ! textViewer.getShowLineNumbers());
}
示例8: getToggleLineNumbersTitle
//-------------------------------------------------------------------------
function getToggleLineNumbersTitle(textViewer: TextViewer): CustomizedCommand {
return {
checked: textViewer.getShowLineNumbers()
};
}