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


TypeScript vscode-languageserver-types.CompletionItem類代碼示例

本文整理匯總了TypeScript中vscode-languageserver-types.CompletionItem的典型用法代碼示例。如果您正苦於以下問題:TypeScript CompletionItem類的具體用法?TypeScript CompletionItem怎麽用?TypeScript CompletionItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CompletionItem類的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: ProviderPosition

 .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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。