From b968835b63354bd7e56d0304486d74007aa8cce2 Mon Sep 17 00:00:00 2001 From: Harikrishnan Date: Fri, 26 Oct 2018 10:41:32 +0530 Subject: [PATCH 1/2] Add Just My Code support for global symbol search --- package.json | 11 ++++++++++- src/extension.ts | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c074a70..93f000a 100644 --- a/package.json +++ b/package.json @@ -715,6 +715,15 @@ "default": null, "description": "The maximum number of global search (ie, Ctrl+P + #foo) search results to report. For small search strings on large projects there can be a massive number of results (ie, over 1,000,000) so this limit is important to avoid extremely long delays. null means use the default value provided by the cquery language server." }, + "cquery.misc.workspaceSearchResults": { + "type": "string", + "enum": [ + "All", + "Just My Code" + ], + "default": "Just My Code", + "description": "The symbols to include in the query results when 'Go to Symbol in Workspace' is invoked" + }, "cquery.misc.indexerCount": { "type": "number", "default": 0, @@ -866,4 +875,4 @@ "type": "git", "url": "https://github.com/cquery-project/vscode-cquery.git" } -} +} \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index 0c71df2..572c528 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -134,6 +134,7 @@ function getClientConfig(context: ExtensionContext) { ['extraClangArguments', 'index.extraClangArguments'], ['resourceDirectory', 'misc.resourceDirectory'], ['workspaceSymbol.maxNum', 'misc.maxWorkspaceSearchResults'], + ['workspaceSymbol.workspaceSearchResults', 'misc.workspaceSearchResults'], ['index.threads', 'misc.indexerCount'], ['index.enabled', 'misc.enableIndexing'], ['enableCacheWrite', 'misc.enableCacheWrite'], @@ -180,6 +181,11 @@ function getClientConfig(context: ExtensionContext) { } } + // Gather workspaceFolder paths in current workspace. + clientConfig["workspaceFolders"] = workspace.workspaceFolders.map(workspaceFolder => { + return workspaceFolder.uri.path; + }); + // Set up a cache directory if there is not one. if (!clientConfig.cacheDirectory) { if (!context.storagePath) { From f4d254e6977445eac3a29b6be81a90ceaff7853a Mon Sep 17 00:00:00 2001 From: Harikrishnan Date: Sat, 27 Oct 2018 09:22:39 +0530 Subject: [PATCH 2/2] Change misc.workspaceSearchResults config to misc.workspaceSymbolJustMyCode --- package.json | 12 ++++-------- src/extension.ts | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 93f000a..6e92fd8 100644 --- a/package.json +++ b/package.json @@ -715,14 +715,10 @@ "default": null, "description": "The maximum number of global search (ie, Ctrl+P + #foo) search results to report. For small search strings on large projects there can be a massive number of results (ie, over 1,000,000) so this limit is important to avoid extremely long delays. null means use the default value provided by the cquery language server." }, - "cquery.misc.workspaceSearchResults": { - "type": "string", - "enum": [ - "All", - "Just My Code" - ], - "default": "Just My Code", - "description": "The symbols to include in the query results when 'Go to Symbol in Workspace' is invoked" + "cquery.misc.workspaceSymbolJustMyCode": { + "type": "boolean", + "default": true, + "description": "If true, non workspace symbols are filtered from workspace symbols." }, "cquery.misc.indexerCount": { "type": "number", diff --git a/src/extension.ts b/src/extension.ts index 572c528..c3de0c3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -134,7 +134,7 @@ function getClientConfig(context: ExtensionContext) { ['extraClangArguments', 'index.extraClangArguments'], ['resourceDirectory', 'misc.resourceDirectory'], ['workspaceSymbol.maxNum', 'misc.maxWorkspaceSearchResults'], - ['workspaceSymbol.workspaceSearchResults', 'misc.workspaceSearchResults'], + ['workspaceSymbol.justMyCode', 'misc.workspaceSymbolJustMyCode'], ['index.threads', 'misc.indexerCount'], ['index.enabled', 'misc.enableIndexing'], ['enableCacheWrite', 'misc.enableCacheWrite'],