Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the colorizer (IntelliSense/Semantic-based) #230

Closed
be5invis opened this issue Sep 16, 2016 · 57 comments
Closed

Improve the colorizer (IntelliSense/Semantic-based) #230

be5invis opened this issue Sep 16, 2016 · 57 comments
Assignees
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@be5invis
Copy link

The current built-in colorizer for C/C++ does not support:

  • color operators
  • color type names separately
@bobbrow
Copy link
Member

bobbrow commented Jul 6, 2017

  • Also need to support colorization for inactive preprocessor blocks.

@Srekel
Copy link

Srekel commented Aug 24, 2017

@be5invis Not sure if this is what you want, but it could be a workaround for now. Since the latest VS code you can indeed set colors for operators, like so:

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "keyword.operator",
        "settings": {
          "foreground": "#D2B17B"
        }
      }
    ]
  },

@Srekel
Copy link

Srekel commented Aug 28, 2017

Another thing I would like to be colorized, and I'm assuming it falls on this extension: Different colors for function definitions vs function calls.

Like this:

image

It would make it much easier to see the structure of the code at a glance.

Actually they do have slightly different TM scopes, but I tried overriding the function call's color like this but it doesn't seem to change anything:

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "meta.function-call",
        "settings": {
          "foreground": "#D2B17B"
        }
      }
    ]
  }

@bobbrow
Copy link
Member

bobbrow commented Sep 1, 2017

There doesn't appear to be a way for us to do much of what we want right now because colorization is managed by TextMate grammars (regular expressions) instead of based on semantic parsing of the file. I do see a feature request open on VS Code to enable a better mechanism microsoft/vscode#1967

@bobbrow
Copy link
Member

bobbrow commented Sep 1, 2017

(go and upvote that vscode issue and maybe they'll prioritize implementing it)

@DaOnlyOwner
Copy link

Any updates on this issue?

@sean-mcmanus
Copy link
Collaborator

@DaOnlyOwner No progress has been made in regards to improving colorization, other than general infrastructure/porting. The cpptools extension doesn't currently implement any colorization for C++. It's done by VS Code using TextMate and atom/language-c.

@bobbrow
Copy link
Member

bobbrow commented Oct 18, 2017

Did you upvote the issue I linked? VS Code needs to give us a better API before we can make any progress on this.

@DaOnlyOwner
Copy link

What do you need to improve the colorizer? Is it enough to expose ITokenizationSupport to extensions as suggested by the author of the linked issue?

@DaOnlyOwner
Copy link

No, how do I upvote an issue?

@bobbrow
Copy link
Member

bobbrow commented Oct 19, 2017

Open the issue and click the "thumbs up" icon on the original post to add your vote.

@DaOnlyOwner
Copy link

Oh so you upvote the post not the issue itself, gotcha ;)

@bobbrow
Copy link
Member

bobbrow commented Oct 31, 2017

microsoft/vscode#1967 was closed as a dupe of microsoft/vscode#585, so we'll track that instead now. Be sure to go and upvote it.

@hyeonchang
Copy link

I hope that this issue solved as soon as possible.

@bobbrow
Copy link
Member

bobbrow commented Jan 18, 2018

VSCode has a text decoration API that we intend to use for graying out inactive regions in the February update. We're tracking that implementation with #1466. Still need to investigate whether this will be fast enough to be used to replace the textmate coloring for the entire file or not.

@mixandmatch025
Copy link

colorizing structs and macros would be really helpful

@sean-mcmanus sean-mcmanus changed the title Improve the colorizer Improve the colorizer (IntelliSense/Semantic-based) Apr 12, 2019
@sborkowski
Copy link

I too would like to see improved syntax highlighting. My biggest annoyance is that defines, macros and typedefs are not colorized when used, and they should be. Typedefs, at the very least, should use the same colors as built in types (int, char).

@qzxuhui
Copy link

qzxuhui commented Apr 24, 2019

If the member and member function can be highlighted in different color, it would be great help.

@Lennon925
Copy link

@sean-mcmanus I saw you modified the milestones to June 2019, So this will be supported at the end of June?

@bobbrow
Copy link
Member

bobbrow commented May 10, 2019

That's the goal. We're still working with the VS Code team to provide us a proper API for this, but in the meantime we've figured out a way to get the colors in the editor without it and the performance looks acceptable. We will also provide a setting to disable the experimental coloring in the event that anyone has performance problems or prefers the TextMate coloring.

@Lennon925
Copy link

That's the goal. We're still working with the VS Code team to provide us a proper API for this, but in the meantime we've figured out a way to get the colors in the editor without it and the performance looks acceptable. We will also provide a setting to disable the experimental coloring in the event that anyone has performance problems or prefers the TextMate coloring.

It sounds good. Thanks for your reply.

@Lennon925
Copy link

That's the goal. We're still working with the VS Code team to provide us a proper API for this, but in the meantime we've figured out a way to get the colors in the editor without it and the performance looks acceptable. We will also provide a setting to disable the experimental coloring in the event that anyone has performance problems or prefers the TextMate coloring.

Is it possible to set different colors for macro/struct/Union/enum variables and local/global variables if semantic-based finished?

@aminukano585
Copy link

That's the goal. We're still working with the VS Code team to provide us a proper API for this, but in the meantime we've figured out a way to get the colors in the editor without it and the performance looks acceptable. We will also provide a setting to disable the experimental coloring in the event that anyone has performance problems or prefers the TextMate coloring.

Nice to hear this, so we should expect the rollout in a months time or less right?

@bobbrow
Copy link
Member

bobbrow commented May 24, 2019

@Lennon925 you can customize the colors using the "editor.tokenColorCustomizations" setting. I'm not seeing a good reference online on all the scopes available, so we might need to write up some documentation on this ourselves. Not all themes provide colors for all of the scopes either, so we expect people to need to make some customizations to get the exact colorization they want.

@aminukano585 we are currently testing the implementation and doing some optimizations. We're hoping to have something available for insiders to try in about 2 weeks or so.

@Lennon925
Copy link

@bobbrow

It can't solve my problem to customize the colors using the 'editor.tokenColorCustomizations' setting. Because it can't distinguish variables type. It colorize ENUM/Struct/Union/Macro with the same color.

@sean-mcmanus
Copy link
Collaborator

@Lennon925 We support local/global var colors with variable.other.local and variable.other.global, and macros with entity.name.function.preprocessor, but enum/struct/union appear to just map to entity.name.type -- @Colengms would it be easy/possible to distinguish between enum/struct/unions?

@Lennon925
Copy link

@Lennon925 We support local/global var colors with variable.other.local and variable.other.global, and macros with entity.name.function.preprocessor, but enum/struct/union appear to just map to entity.name.type -- @Colengms would it be easy/possible to distinguish between enum/struct/unions?

It seems that it works just for definitions. For references, it doesn't work.
3

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented May 28, 2019

@Lennon925 We haven't shipped the feature yet -- if you're using the in-progress TypeScript branch, it won't work due to the binaries not being published yet -- I think we'll need to publish the pre-release binaries when the change is ready to be checked in in order for the GitHub tests to pass.

UPDATE: Fixed via #3651 and #3738 .

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Jun 13, 2019
@bobbrow
Copy link
Member

bobbrow commented Jun 14, 2019

We have released an insiders build with the colorizer improvements.

We would encourage you to try out the feature and provide feedback on the experience. Please note that many VS Code themes don't have full support for all of the code items (yet), so you might need to augment your themes with customizations. There is more information, including full example settings for light/dark themes here: Colorization docs

@VesCodes
Copy link

VesCodes commented Jul 6, 2019

Really appreciate we have typedef colourisation now! However one issue that introduces is that it seems to always take precedence over whatever the original scope colourisation was? In this example case AClass gets scoped as an entity.name.type, which it is, BUT the original scope for this scenario is entity.name.scope-resolution which I'd rather it retain so it retains the same colouration as ::AMethod.
image

Also would be nice if non-function macros could get a separate scope so defines used as variables wouldn't get colourised the same as defines used as functions.

@JimmyDeemo
Copy link

Really appreciate we have typedef colourisation now!

Please can you tell me how to access this? Or does it not work with objective-c files?

image

@sean-mcmanus
Copy link
Collaborator

@JimmyDeemo Our extension doesn't run on Objective-C/C++ files. Our parser isn't configured to parse it correctly, so semantic colorization wouldn't be correct.

@JimmyDeemo
Copy link

Thanks for explaining. 👍

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests