robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
177 stars 14 forks source link

[QUESTION] Could semantic tokenization be improved ? #265

Closed BriceBoy closed 3 months ago

BriceBoy commented 3 months ago

I'd like to know if semantic tokens could be better ? For example I used Robot Framework Language Server extension for a long moment with your extension only because I prefered the colorization. I think different elements are better recognized. I stopped recently using it because using both at the same time caused some issues. But I'd like to know if you could in some way the same type of semantic tokens to improve readability ? I tried creating editing colorization using editor.semanticTokenColorCustomizations and editor.tokenColorCustomizations but I think there isn't enough tokens.

It might be a personal preference but I find it easier to read with Robot Framework Language Server, for me :

These are few modifications I would really love in Robotcode !

Little comparison :

d-biehl commented 3 months ago

In the last release, a small error crept in where the suite documentation and the keyword/test case documentation were rendered differently. This should be fixed in the next release?

What exactly do you mean with "there isn't enough tokens"?

BriceBoy commented 3 months ago

In the last release, a small error crept in where the suite documentation and the keyword/test case documentation were rendered differently. This should be fixed in the next release?

What exactly do you mean with "there isn't enough tokens"?

If this is a question, I'd love to see all documentations the same format.

In this example you can see tokens available with Robotcode : image

As you can see more specific tokens are available using Robot Framework Language Server which permits better customization if needed : image

BriceBoy commented 3 months ago

By the way, seeing that you take all the questions in count like this is really pleasant, thank you very much @d-biehl !

d-biehl commented 3 months ago

Thank you! ;-)

Yes, exactly, that's the bug I was talking about above ;-)

In contrast to RFLS, I try to colour many things with RobotCode using the Textmate Language because it is simply faster and then provide additional information using semantic tokens. There are also a few other limitations when you only use semantic tokens. I also try to stick to the quasi-standards for tokens and also take different themes into account.

And just to show you, RFLS supports far fewer semantic tokens, see here:

https://github.com/robocorp/robotframework-lsp/blob/a711d9f4396093ad1b1d6988ec2200bbfe8996e9/robotframework-ls/package.json#L354

compared to RobotCode, see here:

https://github.com/robotcodedev/robotcode/blob/166cd2536d545c003fd8d7cdd5da31cfb74f94d4/package.json#L226

I have tried to group the settings into documentation settings and the import settings and runtime/suite test settings, so some are in italics and some are not, but also in different colours depending on the theme. Maybe you can talk about the grouping again and make it a bit clearer ;-)

You can also set all token colours and styles by adjusting the following settings in VSCode:

I know you have already mentioned them above ;-)

But just to mention it, if it already says something like "fontStyle": "bold" and you want to switch this off, then you have to write in an empty value, like this: "fontStyle": ""

BriceBoy commented 3 months ago

Thank you for your explanations !

I was actually playing with editor.semanticTokenColorCustomizations and editor.tokenColorCustomizations and didn't find a way to set the same color for both documentation levels without changing everything else ^^

Thus I juste updated my extension and it's now fixed so I'm really happy with it as it is now đŸ˜„