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

Prettier resolution broken? #471

Closed
lehni opened this issue May 29, 2018 · 9 comments
Closed

Prettier resolution broken? #471

lehni opened this issue May 29, 2018 · 9 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@lehni
Copy link

lehni commented May 29, 2018

I am aware that as of #39, prettier-vscode should resolve to the locally installed version of prettier, but in my configuration that does not seem to be the case. I have prettier 1.13.2 installed in my project, with the new rules for parentheses in math expressions, but when I use the editor.formatOnSave feature of VSCode, these get replaced with the way prettier was handling them in 1.12.1 and below. It looks like prettier-vscode is using the internal prettier module, despite #39? And due to #470, prettier-vscode's prettier is still at 1.12.1.

I was trying to find some debugging information to provide better information for this issue, but wasn't able to find any. What can I do to understand / log what's going on with my configuration?

@CiGit
Copy link
Member

CiGit commented Jun 1, 2018

Did you restart VSCode after you update prettier in your project?
You can debug it here: https://github.com/prettier/prettier-vscode/blob/master/src/PrettierEditProvider.ts#L93

@lehni
Copy link
Author

lehni commented Jun 1, 2018

Yes I restarted multiple times... I tried to get that code to log things but I'm not familiar with VSCode and couldn't find a way to those to actually how up anywhere. I'd need a bit of guidance here...

@CiGit
Copy link
Member

CiGit commented Jun 1, 2018

Is that enought to start ? https://github.com/prettier/prettier-vscode#contribute

@lehni
Copy link
Author

lehni commented Jun 2, 2018

Ok, I think I managed to run this locally and debug the extension. But when I set a break point at the line you've referenced, I never seem to hit that breakpoint. Just to be sure I've added a debugger statement, and also a console.log(), and none of them seem to have any effect. I doubt that this code gets ever executed, yet my file gets formatted with the wrong version of prettier.

@lehni
Copy link
Author

lehni commented Jun 2, 2018

I've managed to get the code execution to break in the constructor of PrettierEditProvider and also log from there, so that's not it... I've added some logging statements to requireLocalPkg() but that never gets executed. Super strange.

@kaisermann
Copy link

kaisermann commented Jun 5, 2018

In my case, for the first opened file, vscode uses prettier with the correct config, although, after opening any other file, the "format document" starts to format WITHOUT prettier

edit:

Found the problem. The beautify extension was overriding it...

@CiGit
Copy link
Member

CiGit commented Jun 6, 2018

If the formatter is not called, try disabling other extensions :-)

@lehni
Copy link
Author

lehni commented Jun 7, 2018

I did :) And then I ran out of time, also to report back here. What I found was that it was Vetur that was applying the formatting in Vue.js files, also through Prettier in my set-up, but obviously not through the prettier-vscode plugin. I mean to look into this further but haven't found the time yet. This can probably be closed now.

@lehni lehni closed this as completed Jun 7, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

3 participants