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


TypeScript CompletionItem.create方法代码示例

本文整理汇总了TypeScript中vscode-languageserver-types.CompletionItem.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CompletionItem.create方法的具体用法?TypeScript CompletionItem.create怎么用?TypeScript CompletionItem.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode-languageserver-types.CompletionItem的用法示例。


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

示例1:

  return values.map(property => {
    const completionItem = CompletionItem.create(property.name);

    completionItem.documentation = property.desc;
    completionItem.kind = CompletionItemKind.Value;

    return completionItem;
  });
开发者ID:tiravata,项目名称:vetur,代码行数:8,代码来源:completion-item.ts

示例2: _functionSymbol

/**
 * Handler for function
 * @param {Object} node
 * @param {String[]} text - text editor content splitted by lines
 * @return {CompletionItem}
 */
function _functionSymbol(node: StylusNode, text: string[]): CompletionItem {
  const name = node.name;

  const completionItem = CompletionItem.create(name);
  completionItem.kind = CompletionItemKind.Function;

  return completionItem;
}
开发者ID:tiravata,项目名称:vetur,代码行数:14,代码来源:completion-item.ts

示例3:

export default builtIn.map(item => {
  const completionItem = CompletionItem.create(item.insertText);
  completionItem.detail = item.name;
  completionItem.insertText = item.insertText;
  completionItem.documentation = item.desc;
  completionItem.kind = CompletionItemKind.Function;

  return completionItem;
});
开发者ID:cryptobuks,项目名称:tandem,代码行数:9,代码来源:built-in.ts

示例4: _selectorCallSymbol

/**
 * Handler for selector call symbols
 * @param {Object} node
 * @param {String[]} text - text editor content splitted by lines
 * @return {CompletionItem}
 */
function _selectorCallSymbol(node: StylusNode, text: string[]): CompletionItem {
  const lineno = Number(node.lineno) - 1;
  const name = prepareName(text[lineno]);

  const completionItem = CompletionItem.create(name);
  completionItem.kind = CompletionItemKind.Class;

  return completionItem;
}
开发者ID:tiravata,项目名称:vetur,代码行数:15,代码来源:completion-item.ts

示例5: _variableSymbol

/**
 * Handler for variables
 * @param {Object} node
 * @param {String[]} text - text editor content splitted by lines
 * @return {SymbolInformation}
 */
function _variableSymbol(node: StylusNode, text: string[], currentWord: string): CompletionItem {
  const name = node.name;
  const lineno = Number(node.val!.lineno!) - 1;

  const completionItem = CompletionItem.create(name);
  completionItem.detail = text[lineno].trim();
  completionItem.kind = CompletionItemKind.Variable;

  return completionItem;
}
开发者ID:tiravata,项目名称:vetur,代码行数:16,代码来源:completion-item.ts

示例6: _selectorSymbol

/**
 * Handler for selectors
 * @param {Object} node
 * @param {String[]} text - text editor content splitted by lines
 * @param {String} currentWord
 * @return {CompletionItem}
 */
function _selectorSymbol(node: StylusNode, text: string[], currentWord: string): CompletionItem {
  const firstSegment = node.segments[0];
  const name = firstSegment.string
    ? node.segments!.map(s => s.string).join('')
    : firstSegment.nodes!.map(s => s.name).join('');

  const completionItem = CompletionItem.create(name);
  completionItem.kind = CompletionItemKind.Class;

  return completionItem;
}
开发者ID:tiravata,项目名称:vetur,代码行数:18,代码来源:completion-item.ts

示例7: ProviderRange

 .map((com: Completion) => {
     const lspCompletion: CompletionItem = CompletionItem.create(com.label);
     const ted: TextEdit = TextEdit.replace(
         com.range
             ? com.range
             : new ProviderRange(
                   new ProviderPosition(position.line, Math.max(position.character - 1, 0)),
                   position
               ),
         typeof com.insertText === 'string' ? com.insertText : com.insertText.source
     );
     lspCompletion.insertTextFormat = 2;
     lspCompletion.detail = com.detail;
     lspCompletion.textEdit = ted;
     lspCompletion.sortText = com.sortText;
     lspCompletion.filterText =
         typeof com.insertText === 'string' ? com.insertText : com.insertText.source;
     if (com.additionalCompletions) {
         lspCompletion.command = Command.create('additional', 'editor.action.triggerSuggest');
     } else if (com.triggerSignature) {
         lspCompletion.command = Command.create('additional', 'editor.action.triggerParameterHints');
     }
     return lspCompletion;
 })
开发者ID:wix,项目名称:stylable-intelligence,代码行数:24,代码来源:service.ts


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