Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -146,6 +146,14 @@
"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.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.1,
"maximum": 1
},
"C_Cpp.formatting": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -1481,4 +1489,4 @@
"binaries": []
}
]
}
}
11 changes: 5 additions & 6 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,12 @@ 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)" },
let settings: CppSettings = new CppSettings(this.RootUri);

let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType({
opacity: settings.inactiveRegionOpacity.toString(),
rangeBehavior: vscode.DecorationRangeBehavior.ClosedOpen
};
let decoration: vscode.TextEditorDecorationType = vscode.window.createTextEditorDecorationType(renderOptions);
});

// We must convert to vscode.Ranges in order to make use of the API's
let ranges: vscode.Range[] = [];
Expand All @@ -736,7 +736,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);
Expand Down
1 change: 1 addition & 0 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class CppSettings extends Settings {
public get intelliSenseEngineFallback(): string { return super.Section.get<string>("intelliSenseEngineFallback"); }
public get errorSquiggles(): string { return super.Section.get<string>("errorSquiggles"); }
public get dimInactiveRegions(): boolean { return super.Section.get<boolean>("dimInactiveRegions"); }
public get inactiveRegionOpacity(): number { return super.Section.get<number>("inactiveRegionOpacity"); }
public get autoComplete(): string { return super.Section.get<string>("autocomplete"); }
public get loggingLevel(): string { return super.Section.get<string>("loggingLevel"); }
public get navigationLength(): number { return super.Section.get<number>("navigation.length", 60); }
Expand Down