bmalehorn / vscode-fish

Fish syntax highlighting and formatting
MIT License
62 stars 6 forks source link

indent behavior of extension is overriding manually specified indent within vscode #3

Closed syd3n closed 4 years ago

syd3n commented 4 years ago

When I have the vscode-fish extension disabled, and specify Indent Using Tabs with a specific Tab Size set, the indentation I have specified while editing a *.fish file will stick and there are no issues.

But if I have the vscode_fish extension enabled, and open a *.fish file for editing and then specific Indent Using Tabs and specific a Tab Size, the auto format will go back to spaces. I am not able to figure out how to change this behavior. Any suggestions?

Attaching a vid of what I am describing. Please let me know if what I am describing is not clear.

fish-ext-indent-issue.mp4.zip

bmalehorn commented 4 years ago

@syd3n Thanks for the bug report! Sorry I didn't see this earlier.

vscode-fish uses the fish shell's builtin fish_indent command. This command is hard-coded to indent to 4 spaces here, so unfortunately there's no way for the extension to pass Ident Using Tabs preference to fish_indent.

As a workaround, you can disable format on save for fish files:

  1. Ctrl+Shift+P / Cmd+Shift+P
  2. Type Preference: Open Keyboard Shortcuts (JSON)
  3. Add this code:
    "[fish]": {
    "editor.formatOnSave": false,
    },
MariuzM commented 4 years ago

Just double checking, there is no way to indent this to 2 spaces / tabs? :( eh bummer i use 2 tabs for all my projects

weisi commented 4 years ago

According to the maintainer of fish-shell, the number of spaces per indent isn't supposed to be configurable (think gofmt which defines a "standard" formatting for a language). Previous discussion at https://github.com/fish-shell/fish-shell/pull/6790

bmalehorn commented 4 years ago

Yup, 4 spaces is just the way it is. Closing this issue out.