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

Option -i seems not working anymore in VSCode V1.31.1 #28

Closed
Nounours31 opened this issue Feb 20, 2019 · 9 comments
Closed

Option -i seems not working anymore in VSCode V1.31.1 #28

Nounours31 opened this issue Feb 20, 2019 · 9 comments

Comments

@Nounours31
Copy link

Hello,
In VSCode I cannot set the increment anymore (my shfmt version is 2.5.1)
Whatever the -i number I used I have 5 whitespace in my script.
Please note

  • In VSCode, all others options are working well (I tested -p, -ci, -h, -w ...)
  • In VSCode "terminal windows" -i option is working well

I really think it is not linked to shfmt himself but it's integration in VSCode.
Perhaps something is running at 'Format document' after shfmt which change the indent to '5'

But I have no idea of how I can debug this.

Note than before this was integrated to the 'system' Format Document, I had no problem ... I am so sad ...

In order to help you, is there a way to debug this?

Thanks in advance for your help, regards,
Pierre

The code
#!/bin/sh
if [ "${a}" = "a" ]; then
echo "toto"
echo "toto" > tata
fi
the options:
"shellformat.flag": "-i 0 -p -ci -sr -kp",
"shellformat.path": "E:\programfiles\shfmt\shfmt.exe",
"shellformat.showError": true,

@foxundermoon
Copy link
Owner

on your setting

"editor.tabSize": 5

@Nounours31
Copy link
Author

Hello,
sorry but no, I have set it to 2.
Here my whole settings:
{
"editor.fontSize": 12,
"editor.tabSize": 2,
"editor.formatOnSave": false,
"editor.renderWhitespace": "all",
/* /
"window.zoomLevel": 0,
/
/
"php.validate.executablePath": "E:\wamp\bin\php-7.2.3\php.exe",
"php.executablePath": "E:\wamp\bin\php-7.2.3\php.exe",
/
/
"shellformat.flag": "-i 2 -p -ci -sr -kp",
"shellformat.path": "E:\programfiles\shfmt\shfmt.exe",
"shellformat.showError": true,
/
*/
"todo-tree.showCountsInTree": true,
"todo-tree.statusBar": "total",
"todo-tree.customHighlight": {
"TODO": {
"icon": "alert",
"type": "text",
"foreground": "black",
"background": "#ff0000",
"opacity": 90,
"iconColour": "blue"
},
"FIXME": {
"icon": "alert",
"type": "text",
"foreground": "black",
"background": "#70f21a",
"opacity": 90,
"iconColour": "blue"
},
},
"todo-tree.tags": [
"TODO",
"FIXME",
],
"python.linting.enabled": true,
}

@foxundermoon
Copy link
Owner

foxundermoon commented Mar 4, 2019

the value of "editor.tabSize" equal the command args -i value

@virgilwashere
Copy link

virgilwashere commented Jun 2, 2019

What about .editorconfig?

@kelbyers
Copy link

kelbyers commented Jun 4, 2019

I have editor.tabSize set to a value of 4, and I have the shell-format extension installed in my VS Code. Whenever I tell the editor to format an open shell script file, I get a pop-up telling me to configure editor.tabSize. It is configured, already.

@LaurentOngaro
Copy link

Same issue for me
in my settings.json
...
"shellformat.flag": "-i 2 -ci -sr -s"
...
"editor.tabSize": 2,

and error
"config by "editor.tabSize": your tabSize https://git.io/tabsize"

when I try to format a bash file.

the issue has been solved for me by changing the settings to
"shellformat.flag": "-ci -sr -s"

@foxundermoon
Copy link
Owner

Setting both places will cause inconsistency, so the -i option is disabled

@foxundermoon
Copy link
Owner

Edited and formatted indent also inconsistent

@foxundermoon
Copy link
Owner

#v5.0.1 support both -i and editor.tabSize setting

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

No branches or pull requests

5 participants