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

is only formatting *.sh file? #18

Closed
agrozyme opened this issue Jul 28, 2018 · 4 comments
Closed

is only formatting *.sh file? #18

agrozyme opened this issue Jul 28, 2018 · 4 comments
Labels

Comments

@agrozyme
Copy link

I use those setting:

  "shellformat.flag": "-i 2 -sr -bn",
  "shellformat.runOnSave": true,

Sometimes, when I save REAME.md, it will do format and repace ` with $() .

@GreenRaccoon23
Copy link
Contributor

I have noticed a similar issue. When I save a file that is in a language other than "Shell Script", an error notification pops up in the lower right which says:

shell format error:<standard input>:5:21: a command can only contain words and redirects

Source: shell-format (Extension)

If I do not have any shell scripts open, the notification does not pop up. But once I do open a shell script (or set the language to "Shell Script"), the notification always pops up. After I close the shell script (or set the language to anything other than "Shell Script"), the notification always pops up.

So it looks like setting the language to "Shell Script" triggers the extension to start running, but setting the language to anything other than "Shell Script" does not trigger the extension to stop running.

@Kurt-Shiwz
Copy link

same problem, how to fix it

@ahuber21
Copy link

Same issue. I also get regular errors when saving python files from shfmt on which it should've never run in the first place.

I'm running with the "shellformat.runOnSave": true option and I can confirm that it depends on whether or not a .sh file was opened before in the workspace.

After reloading the window (shift-cmd-p 'Reload Window) I can save the .md file with no problems.

Once I open a .sh file my .md file gets altered when I save it again.

This behaviour persists even after closing the .sh file.

The addon is now trying to shfmt every file regardless of its extension on save.

Quick fix to keep on working is of course: Disable the shell format extention and reloading the window.

I hope that #19 will be merged soon!

@foxundermoon
Copy link
Owner

foxundermoon commented Nov 28, 2018

on version 2.0.0 resolve the bug and replace shellformat.runOnSave with default editor.formatOnSave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants