[PATCH] D59759: [clangd] Add .cu files to VSCode extension

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 09:19:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE356916: [clangd] Add .cu files to VSCode extension (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59759?vs=192109&id=192124#toc

Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59759

Files:
  clangd/clients/clangd-vscode/src/extension.ts


Index: clangd/clients/clangd-vscode/src/extension.ts
===================================================================
--- clangd/clients/clangd-vscode/src/extension.ts
+++ clangd/clients/clangd-vscode/src/extension.ts
@@ -68,8 +68,18 @@
     }
     const serverOptions: vscodelc.ServerOptions = clangd;
 
+    // Note that CUDA ('.cu') files are special. When opening files of all other
+    // extensions, VSCode would load clangd automatically. This is achieved by
+    // having a corresponding 'onLanguage:...' activation event in package.json.
+    // However, VSCode does not have CUDA as a supported language yet, so we
+    // cannot add a corresponding activationEvent for CUDA files and clangd will
+    // *not* load itself automatically on '.cu' files. When any of the files
+    // with other extensions are open, clangd will load itself and will also
+    // work on '.cu' files.
     const filePattern: string = '**/*.{' +
-        ['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'].join() + '}';
+        ['cpp', 'c', 'cc', 'cu', 'cxx', 'c++', 'm', 'mm',
+            'h', 'hh', 'hpp', 'hxx', 'inc'].join()
+        + '}';
     const clientOptions: vscodelc.LanguageClientOptions = {
         // Register the server for C/C++ files
         documentSelector: [{ scheme: 'file', pattern: filePattern }],


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59759.192124.patch
Type: text/x-patch
Size: 1347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190325/b85c1a2f/attachment.bin>


More information about the cfe-commits mailing list