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

Plugin does not respect user tab settings #81

Closed
xXACCEXx opened this issue Jun 10, 2020 · 6 comments
Closed

Plugin does not respect user tab settings #81

xXACCEXx opened this issue Jun 10, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@xXACCEXx
Copy link

Not to start a tabbing war, but I have explicitly set these settings, and they are ignored when formatting.

{
  "editor.insertSpaces": false,
  "editor.tabSize": 4
}
@jsejcksn
Copy link
Contributor

I haven't looked at the source for this, but I presume it's using deno fmt.

@xXACCEXx
Copy link
Author

It seems to be overriding "editor.formatOnSave": true, as well, even though according to the deno docs, the deno.autoFmtOnSave is false by default and has not been implemented...

@xXACCEXx
Copy link
Author

Also, for ticket completeness, I have uninstalled all vscode plugins, and its fine, install https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno or https://marketplace.visualstudio.com/items?itemName=justjavac.vscode-deno and problem occurs.

@jsejcksn
Copy link
Contributor

I decided to dig into this just now. You have control over which formatter is used for different filetypes in VS Code. There is information about how to customize this behavior and other language-specific behaviors at the VS Code docs > Get Started > Settings > Language specific editor settings.

When editing your settings.json file, intellisense will help you find the valid keys and values, but these are likely the settings that you want:

{
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
}

If you use those settings, VS Code will use the built-in formatter instead of the one provided by the Deno extension, when editing .js, .jsx, .ts, .tsx files.

If you are uncomfortable editing your settings.json file, you can use the command palette to change the default formatter while editing a document of that type. Here is an example while I was editing a TypeScript document:

vscode-default-formatter

@xXACCEXx
Copy link
Author

Marvellous, Thank you for these suggestions and the link to the docs. They are super informative.

I've fixed my issues using the default formatter value vscode.typescript-language-features like you suggested, but only for javascript and typescript.

@bartlomieju bartlomieju added the bug Something isn't working label Aug 4, 2020
@lucacasonato
Copy link
Member

The extension does not have auto format on save anymore now. The tab size is determined by deno fmt for the deno formatter, and is not configurable. As for not enabling the extension by default, I agree: see #193.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants