Open rendaoer opened 4 months ago
I'm 99% sure that this is fixed on main
after @SomeoneToIgnore's https://github.com/zed-industries/zed/commit/cb430fc3e40aaf48a56f4faf8b4353007981f7fb
I'm running Zed Preview 0.139.3
and the built-in prettier does not seem to respect the .prettierrc
file in my project. I can only get prettier to work by:
brew install prettier
"formatter": {
"external": {
"command": "prettier",
"arguments": [
"--stdin-filepath",
"{buffer_path}"
]
}
},
I could not use npx prettier
as npx could not be found (I use homebrew and nvm, and I have two copies of npx installed). I suspect the core issue is that the built-in prettier is not setting its working directory to that of the file being edited. If it were doing so, I would expect prettier to walk to the file tree up until it finds the .prettierrc
, then use the configuration from that file, and be able to resolve the plugins referenced in it by looking in the node_modules
directory in my project root.
.prettierrc
{
"plugins": ["prettier-plugin-go-template", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template",
"goTemplateBracketSpacing": true
}
}
]
}
@joefitzgerald can you reproduce this in a new project with prettier? Because on the latest preview, when using the built-in prettier, it works for me:
https://github.com/zed-industries/zed/assets/1185253/eaebbc4b-e484-49f3-8ace-1317e4d5ab7c
Is the problem that prettier doesn't work or that it doesn't pick up the plugins? Do the logs say anything?
zed: open logs
debug: open language server logs
and open prettier
in the dropdown
Check for existing issues
Describe the bug / provide steps to reproduce it
.prettierrc:
This configuration can be used in vs code, but it does not take effect in zed. I tried to find the place in the code where the configuration file is parsed, but unfortunately I couldn't find it.
Environment
Zed: v0.135.2 (Zed) OS: macOS 14.4.1 Memory: 8 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.No response