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

Vscode extension quality of life changes #629

Merged

Conversation

Goju-Ryu
Copy link
Contributor

This PR adds and modifies a few behaviors of the vs-code extension to improve the developer experience. Some changes may be controversial so I will list them here to open a discussion about if some of them should be reverted before merge.

  • square brackets are now treated as brackets, allowing for colorization by vs code
  • square brackets and angle brackets now auto close the same way normal parenthesis do
  • The folding is changed to be based on code indentation1 (I expect this to be the most controversial)
  • Strings with interpolated portions will now highlight the interpolation as with normal code, while the rest of the string gets the usual color of strings.
  • Correctly display strings with escaped quotes (\") inside strings

Examples:
Before fold:
image
After fold:
image
Examples of interpolations and escaped brackets:
image
Example with escaped quotation mark:
image

Footnotes

  1. This isn't strictly correct, but aligns with the code style used and in my opinion gives more intuitive folding in the prelude files

Treat square brackets as brackets and auto close both square and angle brackets.
This may be controversial as it is achieved by pretending the language is indentation based
@sharkdp sharkdp merged commit b9260f3 into sharkdp:master Oct 23, 2024
15 checks passed
@sharkdp
Copy link
Owner

sharkdp commented Oct 23, 2024

Awesome — thank you. I'm surprised someone found the VScode extension :-)

@Goju-Ryu
Copy link
Contributor Author

Awesome — thank you. I'm surprised someone found the VScode extension :-)

I use it heavily when writing code for the prelude. I just decided to read up on how it worked so I could fix the quirks that annoyed me in my own workflow.

This also reminds me, is this extension available for install without running it in debug mode via vs code? I seem to remember reading about a reason it wasn't in the extensions catalog, but when i went looking for where I read it I couldn't find it.

@Goju-Ryu Goju-Ryu deleted the vscode-extension-quality-of-life-changes branch October 23, 2024 19:46
@sharkdp
Copy link
Owner

sharkdp commented Oct 23, 2024

This also reminds me, is this extension available for install without running it in debug mode via vs code?

No.

seem to remember reading about a reason it wasn't in the extensions catalog, but when i went looking for where I read it I couldn't find it.

There's no reason except that I never published a VS code extension and I'm afraid it might involve some boring organizational things 😄

@Goju-Ryu
Copy link
Contributor Author

seem to remember reading about a reason it wasn't in the extensions catalog, but when i went looking for where I read it I couldn't find it.

There's no reason except that I never published a VS code extension and I'm afraid it might involve some boring organizational things 😄

That's honestly very fair. I have looked into it a bit and it requires some setup of accounts and such in Azure DevOps and Visual Studio Market place. It is however also possible to distribute extension packages as standalone vsix files which are installable by code without any marketplace involvement. That looks pretty easy, so I wouldn't mind trying to set it up as a follow up to this PR if you'd like.

@sharkdp
Copy link
Owner

sharkdp commented Oct 23, 2024

That would be great — thanks!

@Goju-Ryu
Copy link
Contributor Author

No problem. Back when I first discovered numbat I was slightly disappointed that I couldn't find where to get the vs code extension, so I’m excited to hopefully make it easier for newcomers in the future.

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

Successfully merging this pull request may close these issues.

2 participants