Skip to content

adds settings for inactive region font & bg color#2308

Merged
sean-mcmanus merged 3 commits into
microsoft:masterfrom
john-patterson:feat/inactive-region-coloring
Jul 23, 2018
Merged

adds settings for inactive region font & bg color#2308
sean-mcmanus merged 3 commits into
microsoft:masterfrom
john-patterson:feat/inactive-region-coloring

Conversation

@john-patterson

Copy link
Copy Markdown
Contributor

This adds the inactiveRegionFontColor and inactiveRegionBackgroundColor
settings. If a preprocessor block is found to be inactive, it will be
colored by these fields if they are set. They accept hexadecimal font
strings or valid theme colors as their values.These fields also
interactive with the dimInactiveRegions setting.

This was requested in issue
#2212.

I tried launching the tests, but they crashed for me with error Error: Cannot find module 'C:\Users\John\Projects\vscode-cpptools\Extension\out\test' but I don't think this is related to my change.

I also feel like dimInactiveRegions should now be changes to colorizeInactiveRegions as this verb change captures both changes in opacity and color, but I wanted to get input before I made a user-facing alteration.

This adds the inactiveRegionFontColor and inactiveRegionBackgroundColor
settings. If a preprocessor block is found to be inactive, it will be
colored by these fields if they are set. They accept hexadecimal font
strings or valid theme colors as their values.These fields also
interactive with the dimInactiveRegions setting.

This was requested in issue
microsoft#2212.
Comment thread Extension/CHANGELOG.md
# C/C++ for Visual Studio Code Change Log

## Version 0.17.7: July 19, 2018
## Version 0.17.7: July 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.17.7 already shipped -- can you add a 0.17.8, with some date such as August 16?

Comment thread Extension/package.json Outdated
"C_Cpp.inactiveRegionFontColor": {
"type": "string",
"default": null,
"description": "Controls the font coloring of inactive preprocessor blocks. Input is in the form a hexidecimal color code or a valid Theme Color. If not set, this defaults to the syntax coloring scheme of the editor. This setting only applies when inactive region dimming is enabled.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "hexadecimal".

@sean-mcmanus

Copy link
Copy Markdown
Contributor

I think the tests are run as part of the GitHub Travis CI so you don't have to run it locally.

Comment thread Extension/package.json Outdated
"maximum": 1
},
"C_Cpp.inactiveRegionFontColor": {
"type": "string",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type should accept "null" as valid, since that's the default, e.g.
[
"string",
"null"
],

Comment thread Extension/package.json Outdated
"minimum": 0.1,
"maximum": 1
},
"C_Cpp.inactiveRegionFontColor": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "inactiveRegionForegroundColor"? VS Code seems to use the foreground instead of font term: https://code.visualstudio.com/docs/getstarted/theme-color-reference .

@bobbrow

bobbrow commented Jul 23, 2018

Copy link
Copy Markdown
Member

We do plan to rename a bunch of settings in the future. I'll add this one to the list. I'd rather do it all at once.

* Cleanup CHANGELOG to new release
* FontColor -> ForegroundColor
* hexidecimal -> hexadecimal
* fixing inactiveRegionForegroundColor typing
@john-patterson john-patterson force-pushed the feat/inactive-region-coloring branch from 1cb7dd5 to 55f6695 Compare July 23, 2018 17:18
Comment thread Extension/package.json Outdated
"scope": "resource"
},
"C_Cpp.inactiveRegionBackgroundColor": {
"type": "string",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property should be string | null as well.

* inactiveRegionBackgroundColor still had string typing instead of
string | null
@john-patterson john-patterson force-pushed the feat/inactive-region-coloring branch from 719eb4d to 917fb82 Compare July 23, 2018 20:49

@sean-mcmanus sean-mcmanus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot 👍

@sean-mcmanus sean-mcmanus merged commit 913f740 into microsoft:master Jul 23, 2018
@yachnyymaxim

Copy link
Copy Markdown

Is this an intended behavior: if you select a piece of text within an inactive code block your selection is not visible?
Here is the example below, it has "text2" string selected on the line 4:
image

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants