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

useTabs: true not respected when formatting via vscode deno extension #1140

Open
scarf005 opened this issue Aug 8, 2024 · 3 comments · May be fixed by denoland/deno#26912
Open

useTabs: true not respected when formatting via vscode deno extension #1140

scarf005 opened this issue Aug 8, 2024 · 3 comments · May be fixed by denoland/deno#26912

Comments

@scarf005
Copy link

scarf005 commented Aug 8, 2024

Describe the bug

when using deno vscode extension, it converts tabs to spaces despite useTabs is true in deno.jsonc .

To Reproduce

  1. create following structure
.vscode/settings.json
main.ts
deno.jsonc
{
  "deno.enable": true,
  "deno.lint": true,
  "deno.unstable": true,
  "deno.config": "./deno.jsonc",
  "[json][jsonc][markdown][typescript][typescriptreact]": {
    "editor.defaultFormatter": "denoland.vscode-deno"
  }
}
const foo = () => {
    console.log("hello")
}
{
    "fmt": {
        "semiColons": false,
        "lineWidth": 100,
        "useTabs": true,
        "proseWrap": "never"
    }
}
  1. format files using Format Document With... > Deno
  2. useTabs: true is not respected in Deno VSCode extension
  3. format the file with deno fmt
  4. useTabs: true is respected in CLI

Expected behavior

  1. useTabs option works
  2. deno extension behavior matches with deno cli fmt behavior

Screenshots

image

Versions

vscode: 1.92.0 deno: deno 1.45.5+18b9b43 (canary, x86_64-unknown-linux-gnu) extension: 3.38.0

@scarf005 scarf005 changed the title saving files via deno extension ignores useTabs useTabs: true not respected when formatting via vscode deno extension Aug 8, 2024
@nayeemrmn
Copy link
Collaborator

The vscode extension prioritises the editor indent settings selected in the status bar as per another request denoland/deno#23257. You have to change it to tabs there.

@heygarrett
Copy link

heygarrett commented Nov 17, 2024

I ran into the same problem as @scarf005 in Neovim. The editor settings taking priority over the Deno settings feels backwards; this would be a source of conflict in any project where multiple devs have different default editor settings. Isn't the point of the Deno formatting settings to ensure consistency in the project?

@scarf005
Copy link
Author

scarf005 commented Nov 18, 2024

@nayeemrmn could you please reopen this issue?

The vscode extension prioritises the editor indent settings selected in the status bar as per another request denoland/deno#23257. You have to change it to tabs there.

like what @heygarrett said, this behavior is counterintuitive to majority of users (project configuration must have higher precedence over editor configuration) and make working on multiple deno project with different fmt configuration harder.

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

Successfully merging a pull request may close this issue.

3 participants