Open floitsch opened 3 years ago
@floitsch How would clients render this information to the user? Do you have some example screenshots and/or mock-up designs?
Isn't this what textDocument/documentSymbols is for?
I'm not good with graphics, but here is (more or less) what I would imagine. When I was using Microsoft Visual Studio a long time ago, I had this enabled for comments (as in my mockup), and it made reading the code much nicer.
Wrt documentSymbols: there is often an overlap. However, I would not have document-symbols for every semantic region.
A concrete example: a Doxygen comment would be a region, but would not be worthy of a document-symbol entry.
Similarly, you wouldn't use document-symbol entries for public
and private
in C++.
Finally, languages sometimes have embedded sections, like regular expressions. Take a Free-spacing regular expression that allows new lines and comments. You would want to mark the regular expression as reg-exp region, but still highlight the comments in it as "comment".
In some way I see regions as the semantic tokens for background.
I'm not good with graphics, but here is (more or less) what I would imagine.
@floitsch Sorry, I haven't used Visual Studio before. Could you attach an original picture so it is easier to compare what you are adding in your mockup versus what the default editor looks like in Visual Studio?
So the modified screen shot was from visual studio code (just the editor view). The difference is the background color for the comments and the private section.
Languages often have sections/regions that have different meaning. It would be great if the LSP server could inform the client about this regions, so they could handle them differently. Specifically, it is often a good idea to change the background of these regions to convey the information in a fast and easy way.
For example, in C++, the following regions have some meaning for the programmer: