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

Provide an API for advanced/semantic source highlighting #585

Closed
seanmcbreen opened this issue Nov 24, 2015 · 52 comments
Closed

Provide an API for advanced/semantic source highlighting #585

seanmcbreen opened this issue Nov 24, 2015 · 52 comments
Assignees
Labels
api editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan tokenization Text tokenization
Milestone

Comments

@seanmcbreen
Copy link

From @Wosi on October 13, 2015 14:22

I'm looking for a way to implement an advanced source highlighting
where a language service changes the color of words in a file. The result would look similar to the output Visual Studio creates in C# files.
The screenshot shows C# code in Visual Studio. The word "Customer" is highlighted differently based on its context:
advancedhighlighting

To implement highlighting like this it's necassary to let a language service decide about the color of a word after the grammar based highlighter has done its job.
I would like to see an API for this in the future.

Copied from original issue: Microsoft/vscode-extensionbuilders#14

@seanmcbreen
Copy link
Author

From @egamma on October 13, 2015 14:40

The request makes sense OmniSharp supports semantic coloring and we currently have no API to expose this support.

@seanmcbreen
Copy link
Author

From @Krzysztof-Cieslak on October 13, 2015 14:43

👍 Same can be used for F# - Visual F# Power Tools for VS and F# support in Xamarin Studio are both using semantic highlighting.

@jrieken jrieken added feature-request Request for new features or functionality and removed enhancement labels Nov 25, 2015
@jrieken
Copy link
Member

jrieken commented Nov 25, 2015

We are close but we are missing meta-colours ala the-color-of-a-keyword

@Krzysztof-Cieslak
Copy link
Contributor

Any progress with it? :)

@vilicvane
Copy link

Desperately want to know whether there've been any progress on this.

@NPatch
Copy link

NPatch commented Sep 5, 2016

Me2. Could you or will you expose it as json settings kinda like settings.json or keybindings.json?

@DustinCampbell
Copy link
Member

Would love to see this happen. Honestly, it'd be great to have a way to provide colorization without a textmate grammar. The C# extension has incredibly accurate colorization information already available to it in OmniSharp (using the same Roslyn APIs that are used to colorize VS).

@nfantone
Copy link

nfantone commented Sep 23, 2016

This would be extra nice. And if what @jrieken said a year ago still holds true, it shouldn't be extra hard to implement.

@troshko111
Copy link

Opened similar issue before found this one, since Atom is already doing this to some extent (semantic highlighting based on omnisharp data, not regexp tm grammar) I would love If you guys could prioritize this higher and move from backlog, imo this is huge improvement to the productivity and can be a true killer feature

@alexdima alexdima removed their assignment Oct 27, 2016
@ferologics
Copy link

+1 ⌨️

@kobalicek
Copy link

Not just that, customizing some keywords based on project would also be amazing, there is a lot of C++ code that relies on macros or uses some specifics, and ability to highlight that "easily" would be nice.

@Wosi
Copy link

Wosi commented Jan 10, 2017

Do the changes made for #18317 bring us closer to semantic highlighting?

@kobalicek
Copy link

Suppose I want to highlight my own keywords / variables, how can I test this?

My solution https://github.com/kobalicek/reloaded-cpp is just a hack at the moment, rewriting it to use existing C++ parser and just hooking it to my own symbol highlighter would be the way.

@gulshan
Copy link

gulshan commented May 21, 2019

This tree-sitter based syntax hailighting seems pretty advanced-
#50140 (comment)

@gulshan
Copy link

gulshan commented Aug 9, 2019

Relevant #77140 and #77133

@dannymcgee
Copy link

Just noticed some blessed soul added the joggy boi emoji to this feature on the roadmap and it fills my heart with hope. I believe in you, VS Code.

@jrieken jrieken assigned aeschli and unassigned jrieken Oct 2, 2019
@HighCommander4
Copy link

HighCommander4 commented Oct 3, 2019

Just wanted to mention that, while we wait for the VSCode team to release an official API for semantic highlighting, in the C++ community we've been using editor.setDecorations() to implement semantic highlighting in extensions like vscode-clangd and vscode-cquery, and it has been working reasonably well.

@aeschli
Copy link
Contributor

aeschli commented Oct 4, 2019

We have started working on a vscode.d.ts API for semantic highlighting.
Please have a look at #77133. It's a a proposal on how to classify tokens as well as how to do theming. It would be great if you can give feedback there if we're heading in the right direction or if there's something missing.

There will be an other proposal on the provider API.

@alexdima
Copy link
Member

Done via #86415

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan tokenization Text tokenization
Projects
None yet
Development

No branches or pull requests