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

Token Visualisation #417

Closed
gkjpettet opened this issue Oct 29, 2020 · 6 comments
Closed

Token Visualisation #417

gkjpettet opened this issue Oct 29, 2020 · 6 comments

Comments

@gkjpettet
Copy link

Hi,

Many thanks for this extension - it’s proving really useful when learning ANTLR.

Does the extension provide any way to see the tokens generated during lexing? I have figured out how to view the parse tree but I would really like to see the tokens generated before parsing. I'm having issues with certain tokens and I'd like to just throw the extension a large file and view the generated tokens.

Is this possible?

@bjansen
Copy link
Collaborator

bjansen commented Oct 29, 2020

Hi,

You can see lexer tokens in the Hierarchy view:

image

But it's not a detailed view of the whole token stream, if that's what you are looking for.

@gkjpettet
Copy link
Author

Ah I see - you can only view the tokens matching a rule? OK, thanks.

@bjansen
Copy link
Collaborator

bjansen commented Jan 19, 2021

Here's a simple implementation:

image

As you can see, it shows tokens that are not matched by any rule, like ERR.

Things that could be improved, depending on what would be useful for you:

  • show the token name instead of its int value (at the moment it's just a Token.toString())
  • highlight the corresponding text in the preview editor when a token is selected in the list
  • highlight the corresponding token in the list when moving the cursor in the preview editor
  • show/hide tokens based on their channel? (for example if you're not interested in what's in the HIDDEN channel, but that might be too far-fetched).

@bjansen
Copy link
Collaborator

bjansen commented Jan 23, 2021

Updated version:
image
It shows token names instead of token ids, and I added global "scroll from source/scroll to source" buttons on the left toolbar, which are also used by the Hierarchy tab:
image

WDYT @gkjpettet and @nmz787?

@bjansen bjansen added this to the 1.17 milestone Feb 28, 2021
@bjansen
Copy link
Collaborator

bjansen commented Feb 28, 2021

Will be in 1.17

@bjansen bjansen closed this as completed Feb 28, 2021
@parrt
Copy link
Member

parrt commented May 9, 2022

What about just looking in input stream at token of interest and just using ctrl + mouse hover? It pops up info on the token:

Screen Shot 2022-05-08 at 8 19 29 PM

@gkjpettet would this work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants