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

"Format Document" with deno, doesn't comply with deno.json, prettier or editorconfig. #616

Closed
Tracked by #968 ...
Abhinav1217 opened this issue Jan 31, 2022 · 4 comments
Labels
bug Something isn't working dx fmt high priority

Comments

@Abhinav1217
Copy link

Describe the bug
I have the following structure currently

Data-Structures/
--------------- Javascript/
---------------------------- Stacks.js
---------------------------- Sets.js
---------------------------- .editorconfig
---------------------------- .prettierrc
---------------------------- deno.json

In .editorconfig, .prettierrc and deno.json , I have configured tab width to be of size 4.
I have also made sure that deno is the default formatter for js files.
But still when I save file, or use "Format Document" from command pallet, My file is saved with tab width of 2.
When I use deno fmt Stacks.js from terminal, it does follow the configuration, also when I change formattor to vscode-inbuilt or prettier, using "Format Document with ..." option, they all follow my configuration, except deno extension.

P.S.
I initially had the config files at the root of workspace, but when It didn't work, I moved them to the same level as the working file, it still didn't work.

To Reproduce

  1. Install Deno Extension in vscode.
  2. Enable linting in "Deno: Initilize Workspace Configuration".
  3. Create relevent deno config file, set indentWidth: 4 in deno.json
  4. Choose Deno as default formattor for JS files.
  5. Create a js file and format it using "Format Document" option in command pallet

Expected behavior
The files should be indented with configured width value of 4, not with 2 which I assume is default value.

Screenshots
Indenting with only 2 spaces

Deno is set as default formattor

Versions

vscode:
Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-17T15:31:24+02:00
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.14.21-210.current

deno:
deno 1.18.1 (release, x86_64-unknown-linux-gnu)
v8 9.8.177.6
typescript 4.5.2

extension:

v3.10.1

@jsejcksn
Copy link
Contributor

See #660 (comment)

@rollercodester
Copy link

rollercodester commented Nov 23, 2022

This is still an issue as of evaluating latest Deno in 11/2022. My team is accustomed to format on save in VS Code and the deno.jsonc is not being honored on save (or when using Format document) whereas Format document with... does indeed honor the config as does cmd line fmt command.

settings.json:

{
  "deno.enable": true,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "denoland.vscode-deno",
  "deno.config": "./deno.jsonc"
}

deno.jsonc:

{
  "fmt": {
    "options": {
      "singleQuote": true
    }
  }
}

@bbqsrc
Copy link

bbqsrc commented Jun 25, 2023

Yes, the behaviour noted above continues. The default mechanism ignores the fmt config, but using format document with will work.

A workaround:

  "[typescript]": {
    "editor.defaultFormatter": "denoland.vscode-deno"
  }

@bartlomieju bartlomieju added bug Something isn't working fmt dx high priority labels Jul 11, 2023
@bartlomieju bartlomieju mentioned this issue Jul 11, 2023
17 tasks
@bartlomieju bartlomieju mentioned this issue Oct 9, 2023
7 tasks
@nayeemrmn
Copy link
Collaborator

See #933 (comment)

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

No branches or pull requests

6 participants