forked from OSchip/llvm-project
[clangd] Add "clangd.trace" VSCode setting to enable tracing.
Summary: Setting the CLANGD_TRACE environment variable directly is awkward with VSCode's "reload from the command palette" workflow. Reviewers: ilya-biryukov Subscribers: klimek, jkorous-apple, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D43385 llvm-svn: 325477
This commit is contained in:
parent
aeb626920c
commit
8a3698ada0
|
@ -43,8 +43,8 @@
|
|||
"@types/mocha": "^2.2.32"
|
||||
},
|
||||
"repository": {
|
||||
"type": "svn",
|
||||
"url": "http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/"
|
||||
"type": "svn",
|
||||
"url": "http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/"
|
||||
},
|
||||
"contributes": {
|
||||
"configuration": {
|
||||
|
@ -68,6 +68,10 @@
|
|||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Whether or not to send file events to clangd (File created, changed or deleted). This can be disabled for performance consideration."
|
||||
},
|
||||
"clangd.trace": {
|
||||
"type": "string",
|
||||
"description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,16 @@ function getConfig<T>(option: string, defaultValue?: any) : T {
|
|||
* your extension is activated the very first time the command is executed
|
||||
*/
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const clangdPath = getConfig<string>('path');
|
||||
const clangdArgs = getConfig<string[]>('arguments');
|
||||
const syncFileEvents = getConfig<boolean>('syncFileEvents', true);
|
||||
|
||||
const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: clangdArgs };
|
||||
const clangd: vscodelc.Executable = {
|
||||
command: getConfig<string>('path'),
|
||||
args: getConfig<string[]>('arguments')
|
||||
};
|
||||
const traceFile = getConfig<string>('trace');
|
||||
if (traceFile != null)
|
||||
clangd.options = {env: {CLANGD_TRACE: traceFile}};
|
||||
const serverOptions: vscodelc.ServerOptions = clangd;
|
||||
|
||||
const filePattern: string = '**/*.{' +
|
||||
['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'].join() + '}';
|
||||
|
|
Loading…
Reference in New Issue