denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.48k stars 144 forks source link

Conflict with Prettier extension #57

Closed rjkz808 closed 4 years ago

rjkz808 commented 4 years ago

I've find out that even if Deno extension is disabled, my JS/TS code is still being formatted according to Deno rules. So, if there's a Node.js project which uses Prettier (and has required configuration), VSCode uses Deno extension to format all the code instead of Prettier. It is unexpected behavior for cases when Deno extension is explicitly disabled.

rjkz808 commented 4 years ago

image

rjkz808 commented 4 years ago

I understand that it can be fixed by disabling the whole extension for specific workspaces, but current solution is to use prompt, which unfortunately still keeps Deno formatting enabled

image

rjkz808 commented 4 years ago

Hey! Will this issue be solved?

justjavac commented 4 years ago

@rjkz808 sorry, I am too busy this week. but it has not been fixed yet

hkong commented 4 years ago

Is it possible for the extension to respect a .prettierrc file in the project path? I'm working on multiple projects each of which have different .prettierrc settings, and while I applaud having an official deno format for public modules, private or custom projects that needs to live with existing Typescript/Javascript code bases should follow a .prettierrc specification. Maybe default to the deno format unless a .prettierrc file exists in the project path? That would satisfy all scenarios.

brandonkal commented 4 years ago

No, defaulting to format via deno unless a prettierrc does not satisfy all scenarios as there are many ways prettier can be configured.

Not touching the files at all would be a better default. axetroy already fixed this in that version.

lucacasonato commented 4 years ago

Duplicate of #193

brandonkal commented 4 years ago

@lucacasonato even with 193 solved, this issue remains, namely that there is a conflict with the Prettier extension when this extension is installed. By default, this extension overrides the user's formatting preferences for JavaScript and TypeScript files.

Therefore I disagree that this is a duplicate of the newer issue unless that behavior has been removed.

lucacasonato commented 4 years ago

By default, this extension overrides the user's formatting preferences for JavaScript and TypeScript files.

I can not reproduce this.

marcelocra commented 2 years ago

Google brought me here. I had some sort of conflict between formatters (prettier vs deno) and solved it with this (found in #193):

{
  "deno.enable": true,
  "deno.lint": true,
  "deno.unstable": true,
  "[typescript]": {     // <= ADDED THIS.
    "editor.defaultFormatter": "denoland.vscode-deno"
  }
}

This goes in the project's .vscode/settings.json.