forked from OSchip/llvm-project
[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
This commit is contained in:
parent
77749567a1
commit
ec5dbf5a7b
|
@ -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 }],
|
||||
|
|
Loading…
Reference in New Issue