本文整理汇总了TypeScript中vscode-languageserver.TextEdit类的典型用法代码示例。如果您正苦于以下问题:TypeScript TextEdit类的具体用法?TypeScript TextEdit怎么用?TypeScript TextEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEdit类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: createTextEdit
const edits: TextEdit[] = nodes.reduce<TextEdit[]>((acc, curr) => {
const edit = createTextEdit(curr, newName);
if (edit) {
acc.push(edit);
}
return acc;
}, []);
开发者ID:christianvoigt,项目名称:argdown,代码行数:7,代码来源:provideRenameWorkspaceEdit.ts
示例2:
return Object.keys(response.statements!).map((k: any) => {
const eqClass = response.statements![k];
const title = eqClass.title;
const item = CompletionItem.create(`[${title}]`);
item.textEdit = TextEdit.replace(range, `[${title}]`);
item.kind = CompletionItemKind.Variable;
item.detail = IEquivalenceClass.getCanonicalMemberText(eqClass);
return item;
});
开发者ID:christianvoigt,项目名称:argdown,代码行数:9,代码来源:provideCompletion.ts
示例3: editsToWorkspaceEdit
editsToWorkspaceEdit(edits: Iterable<Edit>): WorkspaceEdit {
const edit: WorkspaceEdit = {changes: {}};
const changes = edit.changes!;
for (const polymerEdit of edits) {
for (const replacement of polymerEdit) {
const uri = replacement.range.file;
if (!changes[uri]) {
changes[uri] = [];
}
changes[uri]!.push(TextEdit.replace(
this.convertPRangeToL(replacement.range),
replacement.replacementText));
}
}
return edit;
}
开发者ID:Polymer,项目名称:tools,代码行数:16,代码来源:converter.ts
示例4: switch
const createTextEdit = (node: IAstNode, newName: string): TextEdit | null => {
if (isTokenNode(node) && node.tokenType) {
switch (node.tokenType.tokenName) {
case "ArgumentReference":
return TextEdit.replace(createRange(node), `<${newName}>`);
case "ArgumentDefinition":
return TextEdit.replace(createRange(node), `<${newName}>:`);
case "ArgumentMention":
return TextEdit.replace(createRange(node), `@<${newName}>`);
case "StatementReference":
return TextEdit.replace(createRange(node), `[${newName}]`);
case "StatementDefinition":
return TextEdit.replace(createRange(node), `[${newName}]:`);
case "StatementMention":
return TextEdit.replace(createRange(node), `@[${newName}]`);
case "Tag":
return TextEdit.replace(createRange(node), `#(${newName})`); // we use the bracketed tag syntax, so we don't have to check the format of newName
}
}
return null;
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:21,代码来源:provideRenameWorkspaceEdit.ts
示例5: addEdit
function addEdit(text: string, startOffset: number, endOffset: number) {
if (documentText.substring(startOffset, endOffset) !== text) {
let replaceRange = Range.create(document.positionAt(startOffset), document.positionAt(endOffset));
editOperations.push(TextEdit.replace(replaceRange, text));
}
}
开发者ID:13572293130,项目名称:vscode,代码行数:6,代码来源:jsonFormatter.ts
示例6: replaceText
function replaceText(range: LangServer.Range, text?: string) {
return LangServer.TextEdit.replace(range, text || '');
}
开发者ID:Jason-Rev,项目名称:vscode-spell-checker,代码行数:3,代码来源:codeActions.ts
注:本文中的vscode-languageserver.TextEdit类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论