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

formatter runs when deno.enable = false #193

Closed
kyeotic opened this issue Sep 8, 2020 · 23 comments
Closed

formatter runs when deno.enable = false #193

kyeotic opened this issue Sep 8, 2020 · 23 comments

Comments

@kyeotic
Copy link

kyeotic commented Sep 8, 2020

Describe the bug

When deno.enable is set to false saving a javascript file still hangs trying to run the Deno formatter.

To Reproduce

  1. Install Deno extension
  2. Enable extension in VS Code
  3. Set "deno.enable": false in User Settings
  4. Make a change to a .js file
  5. Save the file

Expected behavior

The file should save without any attempt to run the deno formatter

Screenshots

image

Versions

Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.6.0

deno 1.3.3
v8 8.6.334
typescript 4.0.2
extension: 2.2.0

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 8, 2020

Duplicate of #187

@kyeotic
Copy link
Author

kyeotic commented Sep 8, 2020

@CGQAQ That issues seems to have a larger scope than this one. As far as I can tell this isn't actually an issue with the Language Server, and I would be worried about closing this issue and having the other issue drop the minor point regarding it.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 8, 2020

It's the issue that lsp currently will not enabling or disabling dynamically according to the config

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 8, 2020

@CGQAQ That issues seems to have a larger scope than this one. As far as I can tell this isn't actually an issue with the Language Server, and I would be worried about closing this issue and having the other issue drop the minor point regarding it.

You could keeping the issue open, I will try to fix this tomorrow

@David-Else
Copy link

@CGQAQ If you try and fix it, please make sure we can still use the formatter with:

"deno.enable": false,

and:

"editor.defaultFormatter": "denoland.vscode-deno"

@lucacasonato
Copy link
Member

"deno.enable" should be completely separate from code formatting via denoland.vscode-deno. Formatting should exclusively be controlled by "editor.defaultFormatter". The extension should not override this option ever.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

"deno.enable" should be completely separate from code formatting via denoland.vscode-deno. Formatting should exclusively be controlled by "editor.defaultFormatter". The extension should not override this option ever.

So if defaultFormatter is not vscode-deno, even vscode-deno is enabled, it should never take over and format the code, right?

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

@lucacasonato @David-Else @kyeotic
I didn't encounter any problems you have
issue

@kyeotic You are likely to have selected a default formatter as vscode-deno previously
issue 1

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

@CGQAQ You can see in the screenshot I posted that both the default and javascript formatter are set to prettier. I have never set the default formatter to deno. I just reimaged this machine last week, so I am quite confident that it has never had that setting. Even if I had set it in the past shouldn't the fact that its not set that way now still mean that the extension is behaving improperly?

The only way I can stop the deno formatter is to disable the extension.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

@CGQAQ You can see in the screenshot I posted that both the default and javascript formatter are set to prettier. I have never set the default formatter to deno. I just reimaged this machine last week, so I am quite confident that it has never had that setting. Even if I had set it in the past shouldn't the fact that its not set that way now still mean that the extension is behaving improperly?

The only way I can stop the deno formatter is to disable the extension.

If you did not set default formatter to deno, vscode will not even trigger vscode-deno extension to format your code.
You can see my second gif, the vscode-deno is not triggered at all

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

What evidence would you accept that this is not the case? I have already provided a screenshot.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

What evidence would you accept that this is not the case? I have already provided a screenshot.

I debugged the code, this function not run if I set the defaultFormatter to prettier

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

I'm not sure what to tell you then. I tried removing every other setting and it still runs deno

image

And it never stops. I have to cancel that operation or the file will not save.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

@kyeotic
image click that, and see what is the content of that

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

It opens settings with this filter

image

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

@kyeotic Please show me your settings.json in your workspace root .vscode folder

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

Its empty. I have no workspace settings.

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

This doesn't happen if I set "editor.formatOnSave": false or disable the extension. If I re-enable them both it starts happening again.

Perhaps it isn't in that function but it is definitely caused by this extension.

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

@kyeotic I'm sorry, but I can't reproduce this bug
issue 2

@kyeotic
I saw you have the squiggles in your config, if your value for example esbenp.prettier-vscode extension not exsist, vscode will try to trigger another formatter, maybe that's the case
image
image
issue 3

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

Ok, that was definitely part of the problem. I had disabled prettier while I was trying to figure out what was going on. Re-enabling it causes it to run instead of deno.

I'm still confused though, because if I comment those lines out entirely I still get deno trying to run as the formatter. What is causing it to be selected when no formatter is defined?

This may be a seperate issue, but I am also confused about why it hangs instead of actually formatting anything.

@kyeotic
Copy link
Author

kyeotic commented Sep 9, 2020

Unrelated, but what are you using for those gif recordings with key capture? That's pretty dope!

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

The key capture feature is vsode-built in feature
capture app is LICEcap

@CGQAQ
Copy link
Contributor

CGQAQ commented Sep 9, 2020

I'm still confused though, because if I comment those lines out entirely I still get deno trying to run as the formatter. What is causing it to be selected when no formatter is defined?

that's vscode's problem, you should definitely open an issue on vscode repo.
I don't have permission to close the issue, please close it, thank you

cc @lucacasonato close this issue

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

No branches or pull requests

4 participants