bmalehorn / vscode-fish

Fish syntax highlighting and formatting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

indent behavior of extension is overriding manually specified indent within vscode

syd3n opened this issue · comments

commented

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

@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,
  },

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

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 fish-shell/fish-shell#6790

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