porcupine icon indicating copy to clipboard operation
porcupine copied to clipboard

default commands to replace black and isort plugins

Open Akuli opened this issue 3 years ago • 0 comments

Continuing from https://github.com/Akuli/porcupine/pull/957, @rdbende said:

IMO F5-s command should be specified in default_filetypes.toml (you can change it in your config file) and it should be set to run/compile the file. You can use the other 3 shortcuts to run custom (custom is not really the right word here) commands. And there should be a checkbox (except F5), whether to remember the command for all filetype or not.

But I think the other 3 shortcuts should also have a default command (like mypy, black, isort, ./run (since F5 is compile for that langs)), and then we can get rid of black and isort plugins.

I think I have a reasonable solution in #963: there is no checkbox, and the auto-completion suggests all commands you have ran, with some logic to suggest the most likely commands first. Pressing F5 (or any of the other F keys) to repeat the previous command uses the filetype, in the exact same way it uses the pressed key: if your previous command was in a C file but you are currently in a Python file, it won't run the C command, just like F5 won't repeat a command previously ran with F6.

This seems to satisfy everyone's needs:

  • rdbende sets each of the F keys to run a specific Python tool, or a web browser for html files. Still works, and html will work by default since #959.
  • Arrinao wants to press F5 to run Python files, without any configuring, and that's all he does. That works too, because "previous command" actually means the example command from (default_)filetypes.toml if you are running it for the first time.
  • I press Shift+F5 (and rarely also Shift+F6) to select various different commands all the time. That works too. When I run Porcupine, I often don't even remember what was my previous F5 command.

This is good enough for releasing 0.99.1. For the next release 0.100.0 we can associate an F key with each example command, so you could get F6=black F7=isort F8=mypy without any configuring. If I understood correctly, this would be enough for you to be fine with getting rid of black and isort plugins?

Akuli avatar Oct 19 '21 21:10 Akuli