-
Notifications
You must be signed in to change notification settings - Fork 8
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
Otp 27 #9
Otp 27 #9
Conversation
Thanks! Not sure if there's a way to have programmatic tests for the grammar. Either way, would it make sense to commit your examples in a dedicated folder, even if only for visual inspection? |
</dict> | ||
</dict> | ||
<key>comment</key> | ||
<string>Only whitespace characters are allowed after the beggining and before the closing sequences and those cannot be in the same line</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<string>Only whitespace characters are allowed after the beggining and before the closing sequences and those cannot be in the same line</string> | |
<string>Only whitespace characters are allowed after the beginning and before the closing sequences and those cannot be in the same line</string> |
@KornelH This is an amazing and very welcome contribution! Let me know when you're ready, so I can merge this. I also like the idea of splitting this into multiple PRs (like you already did for the io:format parts). 🚀 |
Unfortunately, I neither know any automatic way to test syntax highlight. Therefore, I'll add the example files for visual inspection similar to pull request #10. Also, I will break this commit into two separate commits about docstrings and sigils. I don't think these will change in the final version of OTP 27, so I will do it in 1-2 days. |
As it happens I was also looking into providing the changes in this PR and started looking at how to do CI for the grammar. I've opened #11 with a first draft how we can run tests. |
Another things I was looking at was seeing if we can provide an included grammar for docstrings so that they can be highlighted using the Markdown highlighter? |
That would be awesome! |
A small note, as far as I understand it, only |
Any literal string (normal |
That's true. However in simple strings ( |
Erlang/OTP 27 [1] introduces triple-quoted strings (docstrings) [2]. [1] https://www.erlang.org/news/168 [2] https://www.erlang.org/docs/27/system/data_types.html#string
Erlang/OTP 27 [1] introduces sigils (type prefix for string literals) [2]. [1] https://www.erlang.org/news/168 [2] https://www.erlang.org/docs/27/system/data_types.html#sigil
@KornelH I noticed you opened this for review. Is that intentional or do you still want to break it into separate contributions for sigils and quoted strings? I am happy either way. |
Well, I can split into two requests. |
@garazdawi, I was playing a bit with embedding Markdown into |
hmm, yeah that was not very nice. Pretty neat that it highlights erlang examples in the markdown though :) Do you know if it possible to configure the markdown style individually? Would you mind opening a PR (or just pointing to a branch) with what you have so that I can have a look at how it looks? |
I'm just learning it too and I have no idea if it's possible e.g. set a custom background or shade to embedded languages so it visually would look like a "comment blob" just like eDoc comments, and so it doesn't steal your attention unless you really want to read the documentation. I'll share my grammar changes soon. |
It could also be the case this it becomes better if you indent the docs with 4 spaces. That way you get a visual queue that it is something different. |
@garazdawi, Please find my change in here: KornelH@309ded8 My problem with "indent the docs with 4 spaces" is that, most of the code that I read is not written by me and we cannot enforce the world how to write documentation comments. So, I think most of those will be just like in OTP as shown above. 🫤 |
Yeah, I was mostly wondering if that fixed the issue. I'll have a look at what you have done and see if I can come up with any clever ideas :) |
I wonder how do other languages (e.g. Elixir) tackle this. Any approach which we can take inspiration from? Would it make sense to use the concept of a "scope" that could then be styled via themes? |
There's also something called embedded language. Maybe we could leverage that one? |
While digging about I found this comment: microsoft/vscode#169956 (comment) Seems like the way rust/js/ts does it is by having Markdown highlighting as a separate VS Code extension. That way the user can decide if they want it or not and possibly configure how it should look as well.
This is what @KornelH has done in the prototype. |
Erlang/OTP 27 introduces two new language elements, triple-quoted strings (docstrings) and sigils (type prefix for string literals).
Two simple example modules to test the syntax highlight with the original and updated TextMate language definition: