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

Some people may not expect this extension formatting Markdown files outside of Deno projects #555

Closed
Tracked by #968 ...
FToovvr opened this issue Oct 5, 2021 · 6 comments
Labels

Comments

@FToovvr
Copy link

FToovvr commented Oct 5, 2021

Hello.

This extension formats my Markdown texts, even if I put { "deno.enable": false } in my workspace's .vscode/settings.json.

I think it would be better not to let it do that when the file is not in a Deno project, or at least provide an option to disable this behavior.

A little bit earlier, I noticed that my Markdown files started to be formatted automatically on saving. Although I found it a little annoying, I just left it as is. Until today, I found It corrupts Markdown tables inside lists when there are no leading empty lines1:

It took me some time to figure out that the Markdown formatter is from this extension, who would have thought?
So, I think it might make sense to make this extension, by default, format Markdown files only if it is inside a Deno project (i.e. "deno.enable": true in .vscode/settings.json).

To Reproduce

  1. Install this extension.
  2. create a markdown file and save it on the disk. (Don't need to be in a workspace)
  3. it formats that markdown file.

Expected behavior

It does not do anything.

Versions

vscode: 1.60.2 deno: 1.14.2 extension: v3.9.1

Footnotes

  1. According to this line of comment, It seems the bug is from dprint-plugin-markdown and furtherly from pulldown-cmark, so I opened an issue there.

@kitsonk kitsonk added enhancement New feature or request suggestion and removed enhancement New feature or request labels Oct 15, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Oct 15, 2021

We need to think about this as this would be a significant change in behaviour, as quite a few people use Deno as a formatter across the board, and if you have chosen Deno as your default formatter, I would expect people would want that, though I can see some people being surprised at the range of file types (like markdown) that Deno handles.

Potentially a compromise that I would see as viable is we would add deno.formatting.enableOnly setting, or something like that, where people would be able to choose if they want formatting only in explicitly enabled Deno projects. There is still a little bit of a usability challenge, in that if you have selected Deno as your default formatter, I am not sure what vscode would do if Deno just ignored files in a non-enabled project. I suspect that it would just not format the documents which I think might not be desired.

@ahuigo
Copy link

ahuigo commented Jun 21, 2022

@kitsonk Vote up deno.formatting.markdown setting.
The built-in markdown formatter Deno provides may not conform to UNIX Philosophy.
At present, there are some problems:

  1. We could not forbid markdown formatter even though I've closed Deno:enable option at present.
  2. The markdown formatter in Deno may do not perform as well as some people expected. e.g. sb. do not want auto lone line break.
  3. Some people may have other better customizable markdown formatter which conflicts with Deno.

@coreyti
Copy link

coreyti commented Jun 21, 2022

Hi all,

I've really enjoyed working with Deno, when I can. However, as a very-heavy user of Markdown, I need to be able to author Markdown documents using the (edit: Markdown) extensions of my choice. The following diff illustrates some formatting changes made on save that mean, sadly, that I cannot enable this (edit: Deno) extension.

 ## Tables
 
-| Syntax    | Description |
+|    Syntax | Description |
 | --------: | :---------: |
-| Header    | Title       |
-| Paragraph | Text        |
+|    Header |    Title    |
+| Paragraph |    Text     |
 
 # Heading B {#heading-b}
 
@@ -20,9 +20,7 @@ https://www.markdownguide.org/extended-syntax/.
 
 Here's a simple footnote,[^2] and here's a longer one.[^1]
 
-[^1]: This is the first footnote.
-[^2]:
-    The first paragraph of the definition.
+[^1]: This is the first footnote. [^2]: The first paragraph of the definition.
 
     Paragraph two of the definition.
 
@@ -45,12 +43,10 @@ Here's a simple footnote,[^2] and here's a longer one.[^1]
 
 ## Lists
 
-First Term
-: This is the definition of the first term.
+First Term : This is the definition of the first term.
 
-Second Term
-: This is one definition of the second term.
-: This is another definition of the second term.
+Second Term : This is one definition of the second term. : This is another
+definition of the second term.
 
 - [x] Write the press release
 - [ ] Update the website

Nonetheless, thanks for all of the hard work.

@domnantas
Copy link

I was also extremely surprised to find that Deno extension was formatting my markdown files in a non-Deno project

@fgarcia
Copy link

fgarcia commented Apr 20, 2023

I was very surprised that despite having explicitly in my config:

  "[markdown]": {
    "editor.defaultFormatter": null,

That Deno thought it was OK to reformat every single MD file.

I even find strange thinking that Deno defaults to be universal MD formatter of my computer

@bartlomieju bartlomieju added bug Something isn't working high priority dx 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

You have to specify the formatter per-language:

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

Or disable it for markdown:

  "editor.defaultFormatter": "denoland.vscode-deno"
  "[markdown]": { "editor.defaultFormatter": null },

This has to be done independently of "deno.enable": false because VSCode can't account for other settings when deciding what formatter to apply to what file.

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

No branches or pull requests

8 participants