Open failable opened 5 months ago
At glance this sounds reasonable, but what use case do you have for this?
Hello, I came up with this when I defining a task "post current file content to dpaste" and notice there is a param to set the syntax highlight, though some transformation like lowering case must be done to make the API. There are also some tools like rg
accept language / file type liked params.
I have a use case to slightly improve a hacky workaround for Rewrap-ish (https://marketplace.visualstudio.com/items?itemName=stkb.rewrap) behavior for comments/docs.
I have this keymap that select the entire lines of an already visually selected comment, uncomments, copies, comments again, and then runs a task...
"#": [
"workspace::SendKeystrokes",
": select line enter g c cmd-c g c : task:spawn enter Reflow Comments enter"
],
The task that's run is...
{
"label": "Reflow Comments",
"command": "pbpaste | fmt -w 78 | pbcopy",
"reveal": "never"
},
This task takes the copied comment, formats it to 78 characters, and copies to the clipboard. I can then press p
to replace the currently selected content with the reformatted content.
The main issue for this use case is that I'm hard-coding 78 characters in. My main language is elixir which has two character comments (#
) so it is formatting to 80 characters accounting for those two. Having access to the current language could at least allow for choosing the appropriate amount of characters based upon the language.
As an aside, the task:spawn Reflow Comments enter
dance seems to have broken in keymaps so the whole thing stopped working.
Check for existing issues
Describe the feature
Add a
current buffer language
variable in task.If applicable, add mockups / screenshots to help present your vision of the feature
No response