[PATCH] D70041: register cuda language activation event and activate for .cuh files

Paul Taylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 14 10:06:37 PST 2019


ptaylor added inline comments.


================
Comment at: clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts:92
+  // *not* load itself automatically on '.cu' and '.cuh' files.
+  const cudaFilePatterns: {scheme: string, pattern: string}[] = [
+    {scheme : 'file', pattern : '**/*.{cu}'},
----------------
hokein wrote:
> I think we could simplify the code, we could move this part to the package.json under the `contributes` umbrella, something like
> 
> ```
>   "contributes": {
>         "languages": [
>             {
>                 "id": "cuda",
>                 "filenamePatterns": [
>                     "**/*.{cu}",
>                     "**/*.{cuh}",
>                 ],
>             }
>         ]
> ```
> 
> then in the extension.ts, we only need an entry `{ scheme: 'file', language: 'cuda' }` when initailizing the clientOptions.
Yes that's an option. I chose this approach to stay consistent with the current behavior, because `vscode-clangd` can do CUDA intellisense and refactoring, it doesn't contribute the CUDA grammar definitions for syntax highlighting.

The VSCode docs aren't clear on whether multiple extensions can contribute separate features for the same language, or what happens when two plugins both contribute languages with the same `languageId`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70041/new/

https://reviews.llvm.org/D70041





More information about the cfe-commits mailing list