-
-
Notifications
You must be signed in to change notification settings - Fork 450
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
Fixes resolveConfigFile
usage for 3.1.1
#3335
Conversation
src/ModuleResolver.ts
Outdated
// Avoid https://github.com/prettier/prettier/pull/15363 | ||
const isGte3_1_1 = semver.gte(prettierInstance.version, "3.1.1"); | ||
if (isGte3_1_1) { | ||
return path.join(fileName, "tmp"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fisker fileName
is opened project directory path. And it has temporary file name. Do you have a better plan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a more random name, such as UUID, should be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use the real file path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier use noop.js
for import from directory https://github.com/prettier/prettier/blob/41baabd62734a4b8f4065294cad873af3b46dbb3/src/utils/import-from-directory.js#L6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use the real file path?
Maybe it can be done, but I'm not familiar with prettier-vscode and don't know what the expected behavior is...
So I thought it would be quicker if we could take an approach like this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated to use noop.js
instead of tmp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fisker ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this, you can merge if you think it will work, but better wait for @ntotten ?
Having the same issue with prettier 2.5.0. Trying to format svelte.ts files and getting "Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'Svelte'-files. This is my package.json: |
I'm also encountering this problem, with the same setup as @Synweigh |
Fixes #3235
CHANGELOG.md
with a summary of your changes