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

Wrong comment character inserted for Shplait / Rhombus. #130

Open
TimWhiting opened this issue Sep 30, 2024 · 4 comments
Open

Wrong comment character inserted for Shplait / Rhombus. #130

TimWhiting opened this issue Sep 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@TimWhiting
Copy link

Environment

  • OS: All
  • OS Version: All
  • VS Code Version: latest
  • Racket version: 8.14
  • Racket Langserver checksum: 7481d2f98f175a545a0714ead3ec20ae327afec4
  • Magic Racket version: latest

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 like 1 + 2. Type Ctrl/Cmd + /, it inserts ; instead of //.

@TimWhiting TimWhiting added the bug Something isn't working label Sep 30, 2024
@TimWhiting
Copy link
Author

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?

@jryans
Copy link
Collaborator

jryans commented Oct 3, 2024

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).

@TimWhiting
Copy link
Author

Shplait recommends using the .rhm extension as well. So it should work fine.

@jryans
Copy link
Collaborator

jryans commented Oct 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants