summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-03-25 16:18:56 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-03-25 16:18:56 +0000
commitec5dbf5a7b7593fcbf04593d4fc0873f29859f45 (patch)
treefe117821755855adf24e03b517f8c653fe9f5bb7
parent77749567a1266651017aec31957cd2b5ae424980 (diff)
downloadbcm5719-llvm-ec5dbf5a7b7593fcbf04593d4fc0873f29859f45.tar.gz
bcm5719-llvm-ec5dbf5a7b7593fcbf04593d4fc0873f29859f45.zip
[clangd] Add .cu files to VSCode extension
Summary: clangd should be able to handle those with a proper compilation database. However, users using 'nvcc' might start seeing spurious errors in '.cu' files after this change. My plan is to land and release this, but be ready to revert in case of negative user feedback. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59759 llvm-svn: 356916
-rw-r--r--clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts b/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
index d4ab6787030..e02bb79e12a 100644
--- a/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
+++ b/clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
@@ -68,8 +68,18 @@ export function activate(context: vscode.ExtensionContext) {
}
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 }],
OpenPOWER on IntegriCloud