2016-07-14 6 views
0

私はSublime tmBundleを変換してVSコードの言語サポート拡張を開発しています。私はsiteleaf/liquid-syntax-modeからバンドルを使用しています。私はyo codeオプション4 & 5を使用して、次の出力を組み合わせることに成功含まれている:言語サポート拡張に補完(Intellisense)ファイルを追加することはできますか?

  1. 構文ファイル(.tmLanguage)私がやりたい何
  2. スニペット(.sublime-snippet

をオートコンプリートを追加することです/ Intellisenseのサポートは、.sublime-completionsファイルを直接インポートするか、何らかの形で書き換えることによってインポートできます。

VSコードのオートコンプリート/インテリセンスに項目を追加することは可能ですか?

答えて

0

Language Serverという拡張子を作成すると可能です。サイトから:

言語サーバーが通常実装する最初の興味深い機能は、ドキュメントの検証です。その意味では、リンターでさえ言語サーバーとしてカウントされ、VSコードでは通常、リンターは言語サーバーとして実装されます(例については、eslintとjshintを参照)。しかし、言語サーバーには多くのものがあります。コードの完成、すべての参照の検索、または定義への移動が可能です。以下のサンプルコードは、コード補完をサーバーに追加します。単に「TypeScript」と「JavaScript」という2つの単語を提案するだけです。

そして、いくつかのサンプルコード:

// This handler provides the initial list of the completion items. 
connection.onCompletion((textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => { 
    // The pass parameter contains the position of the text document in 
    // which code complete got requested. For the example we ignore this 
    // info and always provide the same completion items. 
    return [ 
     { 
      label: 'TypeScript', 
      kind: CompletionItemKind.Text, 
      data: 1 
     }, 
     { 
      label: 'JavaScript', 
      kind: CompletionItemKind.Text, 
      data: 2 
     } 
    ] 
}); 

// This handler resolve additional information for the item selected in 
// the completion list. 
connection.onCompletionResolve((item: CompletionItem): CompletionItem => { 
    if (item.data === 1) { 
     item.detail = 'TypeScript details', 
     item.documentation = 'TypeScript documentation' 
    } else if (item.data === 2) { 
     item.detail = 'JavaScript details', 
     item.documentation = 'JavaScript documentation' 
    } 
    return item; 
}); 
関連する問題