Skip to content

Commit 2edddd7

Browse files
committed
Update config options for inactive regions and semantic highlighting
1 parent 44ce42b commit 2edddd7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,11 @@
734734
"default": "",
735735
"description": "If not empty, the compilation database directory to use instead of the project root"
736736
},
737+
"cquery.misc.showInactiveRegions": {
738+
"type": "boolean",
739+
"default": true,
740+
"description": "If true, cquery will highlight inactive regions."
741+
},
737742
"cquery.completion.include.maximumPathLength": {
738743
"type": "integer",
739744
"default": 37,

src/extension.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,31 @@ class SemanticSymbol {
7979
function getClientConfig(context: ExtensionContext) {
8080
const kCacheDirPrefName = 'cacheDirectory';
8181

82+
function hasAnySemanticHighlighting() {
83+
let options = [
84+
'cquery.highlighting.enabled.types',
85+
'cquery.highlighting.enabled.freeStandingFunctions',
86+
'cquery.highlighting.enabled.memberFunctions',
87+
'cquery.highlighting.enabled.freeStandingVariables',
88+
'cquery.highlighting.enabled.memberVariables',
89+
'cquery.highlighting.enabled.namespaces',
90+
'cquery.highlighting.enabled.macros',
91+
'cquery.highlighting.enabled.enums',
92+
'cquery.highlighting.enabled.typeAliases',
93+
'cquery.highlighting.enabled.enumConstants',
94+
'cquery.highlighting.enabled.staticMemberFunctions',
95+
'cquery.highlighting.enabled.parameters',
96+
'cquery.highlighting.enabled.templateParameters',
97+
'cquery.highlighting.enabled.staticMemberVariables',
98+
'cquery.highlighting.enabled.globalVariables'];
99+
let config = workspace.getConfiguration();
100+
for (let name of options) {
101+
if (config.get(name, false))
102+
return true;
103+
}
104+
return false;
105+
}
106+
82107
// Read prefs; this map goes from `cquery/js name` => `vscode prefs name`.
83108
let configMapping = [
84109
['launchCommand', 'launch.command'],
@@ -105,10 +130,14 @@ function getClientConfig(context: ExtensionContext) {
105130
['diagnostics.onParse', 'diagnostics.onParse'],
106131
['diagnostics.onType', 'diagnostics.onType'],
107132
['codeLens.localVariables', 'codeLens.onLocalVariables'],
133+
['emitInactiveRegions', 'misc.showInactiveRegions'],
108134
];
109135
let clientConfig = {
110136
launchCommand: '',
111137
cacheDirectory: '',
138+
highlight: {
139+
enabled: hasAnySemanticHighlighting()
140+
},
112141
workspaceSymbol: {
113142
sort: false,
114143
}

0 commit comments

Comments
 (0)