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
|
@ -68,6 +68,10 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "Whether or not to send file events to clangd (File created, changed or deleted). This can be disabled for performance consideration."
|
"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
|
* your extension is activated the very first time the command is executed
|
||||||
*/
|
*/
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
const clangdPath = getConfig<string>('path');
|
|
||||||
const clangdArgs = getConfig<string[]>('arguments');
|
|
||||||
const syncFileEvents = getConfig<boolean>('syncFileEvents', true);
|
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 = '**/*.{' +
|
const filePattern: string = '**/*.{' +
|
||||||
['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'].join() + '}';
|
['cpp', 'c', 'cc', 'cxx', 'c++', 'm', 'mm', 'h', 'hh', 'hpp', 'hxx', 'inc'].join() + '}';
|
||||||
|
|
Loading…
Reference in New Issue