Skip to content

Semantic tokens for escape/placeholder characters like %s, %.2f or \n #2682

New issue

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

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

Already on GitHub? # to your account

Closed
RedStylzZ opened this issue Feb 24, 2023 · 3 comments
Closed

Comments

@RedStylzZ
Copy link

Is your feature request related to a problem? Please describe.
I am coming from Goland and tried to modify my VSCode to have a pretty syntax highlighing. It seems like not all semantic tokens have been added, or only as textmate scopes. It seems like escape/placeholder characters like "%s" "%.2f" or "\n" are not captured as semantic tokens and are just seen as "string". I then tried to modify them with the textmate scopes. But it seems like semantic tokens overwrite textmate scopes.

Describe the solution you'd like
I would like to have semantic token for these escape/placeholder sequences to highlight them like here:

Describe alternatives you've considered
It is possible (if you know some regex) to use the Highlight Extension and try to build a regex to capture these escape sequences.

Additional context
Current VSCode token type:
image

Goland example:
image

@gopherbot gopherbot added this to the Untriaged milestone Feb 24, 2023
@pjweinb
Copy link

pjweinb commented Feb 24, 2023 via email

hyangah added a commit to hyangah/vscode-go that referenced this issue Feb 26, 2023
They are:

"ui.noSemanticNumber": true,
"ui.noSemanticString": true,

Updates golang#2682
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/471280 mentions this issue: docs: mention advanced semantic token options

gopherbot pushed a commit that referenced this issue Feb 26, 2023
They are:

"ui.noSemanticNumber": true,
"ui.noSemanticString": true

Updates #2682

Change-Id: I942b735af16ed7d070615baad231df4cdcba5d73
GitHub-Last-Rev: 9ac0a3e
GitHub-Pull-Request: #2684
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/471280
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
@RedStylzZ
Copy link
Author

Hey, thank you it worked :D

To enable semantic tokens, but let the underlying string processing show through, with these settings in the "gopls" section of settings.json: "ui.noSemanticNumber": true, "ui.noSemanticString": true, "ui.semanticTokens": true,

On Fri, Feb 24, 2023 at 3:21 AM Tizian @.> wrote: Is your feature request related to a problem? Please describe. I am coming from Goland and tried to modify my VSCode to have a pretty syntax highlighing. It seems like not all semantic tokens have been added, or only as textmate scopes. It seems like escape/placeholder characters like "%s" "%.2f" or "\n" are not captured as semantic tokens and are just seen as "string". I then tried to modify them with the textmate scopes. But it seems like semantic tokens overwrite textmate scopes. Describe the solution you'd like I would like to have semantic token for these escape/placeholder sequences to highlight them like here: Describe alternatives you've considered It is possible (if you know some regex) to use the Highlight Extension and try to build a regex to capture these escape sequences. Additional context Current VSCode token type: [image: image] https://user-images.githubusercontent.com/19490975/221127770-5cea2940-e9e5-45d5-a315-3bf5690aa683.png Goland example: [image: image] https://user-images.githubusercontent.com/19490975/221127832-15e003c7-48b7-4d4b-a080-fefeac98438f.png — Reply to this email directly, view it on GitHub <#2682>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJIAI3EDOA56TYOMOJITOLWZBVQXANCNFSM6AAAAAAVGTMVCU . You are receiving this because you are subscribed to this thread.Message ID: @.>

@golang golang locked and limited conversation to collaborators Feb 28, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants