From 2b8501ca858cf3bc21f5258138cd9094a1166eb6 Mon Sep 17 00:00:00 2001 From: Griffin Downs Date: Fri, 4 May 2018 15:19:45 -0700 Subject: [PATCH 1/7] Set to use opacity at 0.5 --- Extension/src/LanguageServer/client.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 20ca0228f..479259d8b 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -714,12 +714,9 @@ class DefaultClient implements Client { } private updateInactiveRegions(params: InactiveRegionParams): void { - let renderOptions: vscode.DecorationRenderOptions = { - light: { color: "rgba(175,175,175,1.0)" }, - dark: { color: "rgba(155,155,155,1.0)" }, - rangeBehavior: vscode.DecorationRangeBehavior.ClosedOpen - }; - let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType(renderOptions); + let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ + opacity: '0.5' + }); // We must convert to vscode.Ranges in order to make use of the API's let ranges: vscode.Range[] = []; From 28b55d9120b01dfc945e334b18da9c72ef9f09da Mon Sep 17 00:00:00 2001 From: Griffin Downs Date: Fri, 4 May 2018 15:57:00 -0700 Subject: [PATCH 2/7] Add and use setting for change opacity level --- Extension/package.json | 8 +++++++- Extension/src/LanguageServer/client.ts | 7 ++++--- Extension/src/LanguageServer/settings.ts | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Extension/package.json b/Extension/package.json index 3bfd9cf9c..5149603ff 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -12,7 +12,7 @@ }, "license": "SEE LICENSE IN LICENSE.txt", "engines": { - "vscode": "^1.22.0" + "vscode": "^1.23.0" }, "bugs": { "url": "https://github.com/Microsoft/vscode-cpptools/issues", @@ -146,6 +146,12 @@ "description": "Controls whether inactive preprocessor blocks are colored differently than active code. This setting is ignored by the Tag Parser engine.", "scope": "resource" }, + "C_Cpp.inactiveRegionOpacity": { + "type:": "number", + "default": 0.5, + "Description": "Controls the opacity of inactive preprocessor blocks. Scales between 0.0 and 1.0. This setting is overridden by dimInactiveRegions.", + "scope": "resource" + }, "C_Cpp.formatting": { "type": "string", "enum": [ diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 479259d8b..2191bbfe9 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -712,10 +712,12 @@ class DefaultClient implements Client { private updateTagParseStatus(notificationBody: ReportStatusNotificationBody): void { this.model.tagParserStatus.Value = notificationBody.status; } - + private updateInactiveRegions(params: InactiveRegionParams): void { + let settings: CppSettings = new CppSettings(this.RootUri); + let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ - opacity: '0.5' + opacity: String(settings.inactiveRegionOpacity) }); // We must convert to vscode.Ranges in order to make use of the API's @@ -742,7 +744,6 @@ class DefaultClient implements Client { this.inactiveRegionsDecorations.set(params.uri, toInsert); } - let settings: CppSettings = new CppSettings(this.RootUri); if (settings.dimInactiveRegions) { // Apply the decorations to all *visible* text editors let editors: vscode.TextEditor[] = vscode.window.visibleTextEditors.filter(e => e.document.uri.toString() === params.uri); diff --git a/Extension/src/LanguageServer/settings.ts b/Extension/src/LanguageServer/settings.ts index 40a3557f9..0b792be4d 100644 --- a/Extension/src/LanguageServer/settings.ts +++ b/Extension/src/LanguageServer/settings.ts @@ -40,6 +40,7 @@ export class CppSettings extends Settings { public get intelliSenseEngineFallback(): string { return super.Section.get("intelliSenseEngineFallback"); } public get errorSquiggles(): string { return super.Section.get("errorSquiggles"); } public get dimInactiveRegions(): boolean { return super.Section.get("dimInactiveRegions"); } + public get inactiveRegionOpacity(): string { return super.Section.get("inactiveRegionOpacity"); } public get autoComplete(): string { return super.Section.get("autocomplete"); } public get loggingLevel(): string { return super.Section.get("loggingLevel"); } public get navigationLength(): number { return super.Section.get("navigation.length", 60); } From 62f4038540b95d6306b286c474c9b49230137d91 Mon Sep 17 00:00:00 2001 From: grdowns Date: Wed, 30 May 2018 09:51:39 -0700 Subject: [PATCH 3/7] Remove whitespace --- Extension/src/LanguageServer/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 47fc7a22b..cad611374 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -703,7 +703,7 @@ class DefaultClient implements Client { private updateTagParseStatus(notificationBody: ReportStatusNotificationBody): void { this.model.tagParserStatus.Value = notificationBody.status; } - + private updateInactiveRegions(params: InactiveRegionParams): void { let settings: CppSettings = new CppSettings(this.RootUri); From 573b7129d8e9b61d99c4a29a17bc7634cd00e558 Mon Sep 17 00:00:00 2001 From: grdowns Date: Tue, 5 Jun 2018 15:19:33 -0700 Subject: [PATCH 4/7] Do not construct string from string; Change description; Constrain values --- Extension/package.json | 6 ++++-- Extension/src/LanguageServer/client.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Extension/package.json b/Extension/package.json index 1400ec2fb..53e33ff73 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -149,8 +149,10 @@ "C_Cpp.inactiveRegionOpacity": { "type:": "number", "default": 0.5, - "Description": "Controls the opacity of inactive preprocessor blocks. Scales between 0.0 and 1.0. This setting is overridden by dimInactiveRegions.", - "scope": "resource" + "Description": "Controls the opacity of inactive preprocessor blocks. Scales between 0.0 and 1.0. This setting only applies when inactive region dimming is enabled.", + "scope": "resource", + "minimum": 0, + "maximum": 1 }, "C_Cpp.formatting": { "type": "string", diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index cad611374..ad24e8382 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -708,7 +708,7 @@ class DefaultClient implements Client { let settings: CppSettings = new CppSettings(this.RootUri); let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ - opacity: String(settings.inactiveRegionOpacity) + opacity: settings.inactiveRegionOpacity }); // We must convert to vscode.Ranges in order to make use of the API's From aa01d5976ca9097977e68884eb3e619370ff38e2 Mon Sep 17 00:00:00 2001 From: grdowns Date: Tue, 5 Jun 2018 15:35:22 -0700 Subject: [PATCH 5/7] Re-add string to String conversion --- Extension/src/LanguageServer/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 44b1be6d1..5870a5ea9 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -708,7 +708,7 @@ class DefaultClient implements Client { let settings: CppSettings = new CppSettings(this.RootUri); let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ - opacity: settings.inactiveRegionOpacity + opacity: String(settings.inactiveRegionOpacity) }); // We must convert to vscode.Ranges in order to make use of the API's From 86fa3fb5d4ee6c37903126a72ced605fbd0da633 Mon Sep 17 00:00:00 2001 From: grdowns Date: Tue, 5 Jun 2018 15:57:22 -0700 Subject: [PATCH 6/7] Make setting num; Convert num to string --- Extension/src/LanguageServer/client.ts | 2 +- Extension/src/LanguageServer/settings.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 5870a5ea9..fe1c25792 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -708,7 +708,7 @@ class DefaultClient implements Client { let settings: CppSettings = new CppSettings(this.RootUri); let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ - opacity: String(settings.inactiveRegionOpacity) + opacity: settings.inactiveRegionOpacity.toString() }); // We must convert to vscode.Ranges in order to make use of the API's diff --git a/Extension/src/LanguageServer/settings.ts b/Extension/src/LanguageServer/settings.ts index 0b792be4d..766142db6 100644 --- a/Extension/src/LanguageServer/settings.ts +++ b/Extension/src/LanguageServer/settings.ts @@ -40,7 +40,7 @@ export class CppSettings extends Settings { public get intelliSenseEngineFallback(): string { return super.Section.get("intelliSenseEngineFallback"); } public get errorSquiggles(): string { return super.Section.get("errorSquiggles"); } public get dimInactiveRegions(): boolean { return super.Section.get("dimInactiveRegions"); } - public get inactiveRegionOpacity(): string { return super.Section.get("inactiveRegionOpacity"); } + public get inactiveRegionOpacity(): number { return super.Section.get("inactiveRegionOpacity"); } public get autoComplete(): string { return super.Section.get("autocomplete"); } public get loggingLevel(): string { return super.Section.get("loggingLevel"); } public get navigationLength(): number { return super.Section.get("navigation.length", 60); } From e01192807ffc64916dbe4c67862224c470809296 Mon Sep 17 00:00:00 2001 From: grdowns Date: Wed, 6 Jun 2018 11:04:21 -0700 Subject: [PATCH 7/7] Constrain opacity; Re-add range behavior --- Extension/package.json | 8 ++++---- Extension/src/LanguageServer/client.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Extension/package.json b/Extension/package.json index 535f12f75..2233caec8 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -148,10 +148,10 @@ }, "C_Cpp.inactiveRegionOpacity": { "type:": "number", - "default": 0.5, - "Description": "Controls the opacity of inactive preprocessor blocks. Scales between 0.0 and 1.0. This setting only applies when inactive region dimming is enabled.", + "default": 0.55, + "Description": "Controls the opacity of inactive preprocessor blocks. Scales between 0.1 and 1.0. This setting only applies when inactive region dimming is enabled.", "scope": "resource", - "minimum": 0, + "minimum": 0.1, "maximum": 1 }, "C_Cpp.formatting": { @@ -1489,4 +1489,4 @@ "binaries": [] } ] -} +} \ No newline at end of file diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index fe1c25792..acb288097 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -708,7 +708,8 @@ class DefaultClient implements Client { let settings: CppSettings = new CppSettings(this.RootUri); let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({ - opacity: settings.inactiveRegionOpacity.toString() + opacity: settings.inactiveRegionOpacity.toString(), + rangeBehavior: vscode.DecorationRangeBehavior.ClosedOpen }); // We must convert to vscode.Ranges in order to make use of the API's