-
Notifications
You must be signed in to change notification settings - Fork 2
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
Any possibility of multi-language awareness? #2
Comments
Hello, I'm glad you found it useful. About this issue, there is currently an open issue for VS Code that would solve the problem (microsoft/vscode#26707), so I don't think it would be a good idea to try re-implementing the same thing. That being said, I do currently have plans to add support for setting up multiple box styles at the same time and being able to select one from a dropdown menu when using the extension. Possible example (doesn't work yet):
Even though this has a slightly different use case, I believe it will ease most of the pain until the VS Code feature lands. Please let me know what you think, thanks! |
Thanks, that sounds like there's definitely a way forward. TextMate (& Sublime, following them) had a bigger range of dynamic variables available (e.g. |
Comment Box version 2.0.0 is out and it includes support for multiple styles. Enjoy : ) |
Nice. Can't wait to try it out. Thanks for this! |
It seems that microsoft/vscode#26707 has been closed, and there are also other plugins like Comment Divider that have language awareness. Can you reopen this issue? |
Also, a nice setting to have for this would be something like: "commentStart": "block", // in JS, equivalent to `/*`
"commentEnd": "block", // in JS, equivalent to `*/`
"commentStart": "inline", // in JS, equivalent to `//`
"commentEnd": "inline", // in JS, equivalent to `//` For example, I would use the |
I've looked into this and I have some news. There's currently an issue in the backlog to allow extensions to have access to the Language Configuration, which includes among other things, which characters to use to start and end both line and block comments. I think it's better to wait for this than to implement and maintain a table with the characters used by each language. That said, there's a feature I've been thinking about that doesn't quite solve the problem, but it should alleviate it: it should be possible to say: "this style is like that other one, but use this character here instead". Something like this:
With this feature, you could have a basic style with start and end tokens, and build other styles on top. You still need to change it every time you change languages, but only in one place:
Please let me know what you think, thanks! |
The alleviation of the language-awareness issue would be minor, as my primary workflow involves having specific Comment Box styles bound to hotkeys. I guess for the meantime I could just create duplicate sets of my styles & utilize them via I just optimized my configuration file based on the following considerations:
These features allowed me to reduce my configuration lines from @Gist
EditUpon further reflection, it might be a good idea to update
The proposed structure reduces the line length by |
Seems like this should now be possible, any chance the new functionality can be implemented now? |
Yes, I'll look into this now : ) |
Alright, I have this almost ready. Just need to test it a bit more, then release. In case someone wants to help, here's a preview: @etjones This now works with:
I tried to add default styles for multiple languages, but it doesn't work well, the language default overrides user (non language) configuration. |
looks like the latest version available through vscode is still 2.2.1 - would love to have this functionality without manually installing! |
Hey @iandotmartin , thanks for the reminder. The new version is up, enjoy : ) |
works great! thanks very much 🥳 |
One issue I ran into, but didn't manage to fix in time: the extension should set default values such that comment boxes appear correctly for each language, for example this should be the default for python:
But I found an issue, setting default values for a specific language has priority over general settings by the user. I didn't want to override anyone's settings, so I didn't add defaults. If anyone has thoughts / ideas about this, please let me know. |
👍 for a valid default style per language fwiw in my usage i found that i needed to set up a style for each new language anyways, as the global default was often invalid. it's also pretty easy to override for a given language and/or map a keybind to the one global comment box style you want if that's the desired behavior. |
Thanks for this project; it replaces some old functionality I missed from TextMate. However, I think I need to change my settings manually depending on the language I'm using. For example,
in C* or Javascript, I want:
and in Python or Shell, I want:
But the only desired difference is starting lines with
//
or#
. Right now I've been changing three settings, (commentStartToken
,leftEdgeToken
andbottomLeftToken
) every time I switch languages. Would it be possible to change this automatically based on the current language grammar?The text was updated successfully, but these errors were encountered: