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

Syntax highlighting #16

Open
kyunussov opened this issue Jul 12, 2022 · 1 comment
Open

Syntax highlighting #16

kyunussov opened this issue Jul 12, 2022 · 1 comment

Comments

@kyunussov
Copy link

Thanks for writing this extension, very helpful.

One issue I have is that syntax highlighting is not working right for me. Segment names and Data are the same color. How do I fix that?
Thanks.

@Silvenga
Copy link
Owner

Silvenga commented Jul 13, 2022

My guess this is due to the delimiter being non-standard (not X12 standard, which I understand isn't exactly normal EDI, but I wrote this against X12).

The EDI delimiter is dynamic, but unfortunately, VSCode syntax highlighting is static (and rather limited). I couldn't find a way to apply the grammar conditionally based on the lexed tokens. Also, VSCode only supports one grammar per file extension, so there isn't a way to switch grammars, even based on user input.

I haven't touched TextMate syntax in a while, this is just from memory writing the EDI syntax grammar 5 years ago.

Originally, my other plan was to handle syntax highlighting in the extension, rather than using VSCode's built-in handling of custom grammar, but performance wise (and that you can have multiple EDI documents in a file) made that a no-go.

If you want to mess with it, the grammar is here.

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

No branches or pull requests

2 participants