VSE-FormatDocumentOnSave icon indicating copy to clipboard operation
VSE-FormatDocumentOnSave copied to clipboard

Multiple command based on file extension

Open kkankala opened this issue 4 years ago • 3 comments

Hi, This is more of a question than an Issue.

Does the current configuration support running multiple commands based on extension.

I want to run command A and Command B when file is *.cs and Command B and Command C when file is *.js.

[.] command = Edit.FormatDocument EditorContextMenus.CodeWindow.RemoveAndSort EditorContextMenus.CodeWindow.MakePrettier allowed_extensions = .cs .js denied_extensions = .*

But this is making save in endless loop.

kkankala avatar Sep 16 '20 16:09 kkankala

@kkankala I see your point. There was a contribution about multiple commands #19

Do you want to split this into 2 different issues:

  1. Possible bug where multiple commands are not working
  2. A feature request for running specific commands based on extension.

mynkow avatar Sep 21 '20 06:09 mynkow

@kkankala I am not sure what the command EditorContextMenus.CodeWindow.MakePrettier actually is but I think the problem is there. To verify you could try this:

  • Open command window (View => Other Windows => Command Window)
  • Execute the commands in the same order you have them configured in the extension

Keep in mind that the extension is not doing magic. It invokes the commands in a sequence.

I tested your scenario and it is working for me. Let me know if you have questions

mynkow avatar Sep 23 '20 10:09 mynkow

looks like if "EditorContextMenus.CodeWindow.MakePrettier" is at the end, then it will be in loop of unsaved document. If I have prettier command first, then document is not formatted properly. it might be clashing with javascript Prettier extension.

@mynkow , can you still look into feature request of running commands based on extension?

Thanks for the response.

kkankala avatar Sep 23 '20 13:09 kkankala