Open TimWhiting opened 1 month ago
It doesn't look like VSCode supports non-declarative rules for the comment API. Maybe the extension could contribute a second language like rhombus
and configure it's declarative features differently? Is that possible with the same extension?
Thanks for reporting the issue! I believe you're correct: I am not currently aware of non-declarative API to set the comment characters. (If anyone knows of a way, please let us know!)
Yes, an extension can contribute multiple languages, so the Rhombus case could be handled... Ideally it could be programmatic, since as we know, Racket allows you to define essentially any language via #lang
features.
It probably makes sense to special case Rhombus, even though it's unfortunate that it's necessary to do so.
@TimWhiting, is there any way to identify Shplait files (e.g. by file extension)...? For Rhombus, I believe rhm
is common, so we can use that. I wasn't sure about Shplait though.
If there's no extension for Shplait, you could still override VS Code's language detection (per file or per project) to treat Shplait files as Rhombus (once we've added a Rhombus language).
Shplait recommends using the .rhm extension as well. So it should work fine.
Adding just the .rhm
file extension via an additional language should be pretty simple, mainly a matter of extending this list.
The harder part would be defining a grammar for Rhombus files so that syntax highlighting works correctly as well. Perhaps someone has done that work already...?
I don't anticipate having time to do this work myself in short term, but I am happy to review PRs that contribute this feature.
Environment
Error message
None
Additional context
When using languages with C style comments (Shplait / Rhombus) the racket extension does not insert the correct comment characters (i.e. // instead of ;).
To reproduce: Install
Shplait
raco pkg install shplait
. Add#lang shplait
. Type an expression like1 + 2
. TypeCtrl/Cmd + /
, it inserts;
instead of//
.