Open monarcode opened 2 weeks ago
Caused by: 0: prettier params calculation 1: Cannot format: prettier is not allowed for language Some(Language { name: LanguageName("TSX") })
We have this enabled by default: https://github.com/zed-industries/zed/blob/e62d60c84cf65804d803379b73eab153e2bdc08a/assets/settings/default.json#L998-L1003
So I wonder if you local settings overrode this somehow?
Well yea, i did
here's my config
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"assistant": {
"default_model": {
"provider": "anthropic",
"model": "claude-3-5-sonnet-20240620"
},
"version": "2"
},
"theme": "Gruvbox Dark",
"project_panel": {
"dock": "right"
},
"base_keymap": "VSCode",
"ui_font_size": 15,
"buffer_font_size": 15,
"vim_mode": false,
"tab_size": 2,
"buffer_font_family": "JetBrains Mono",
"buffer_font_weight": 200,
"buffer_font_features": {
"calt": true
},
"linter": "eslint",
"ui_font_family": "JetBrains Mono",
"ui_font_weight": 200,
"terminal": {
"font_family": "MesloLGS NF",
"font_size": 13,
"shell": "system"
},
"languages": {
"TypeScript": {
"formatter": "prettier",
"code_actions_on_format": {
"source.fixAll.eslint": true,
"source.organizeImports": true,
"source.removeUnusedImports": true
},
"format_on_save": "on"
},
"TSX": {
"formatter": "prettier",
"code_actions_on_format": {
"source.fixAll.eslint": true,
"source.organizeImports": true,
"source.removeUnusedImports": true
},
"format_on_save": "on",
"language_servers": [
"tailwindcss-language-server",
"vtsls",
"typescript-language-server",
"eslint"
]
},
"JavaScript": {
"formatter": "prettier",
"code_actions_on_format": {
"source.fixAll.eslint": true,
"source.organizeImports": true,
"source.removeUnusedImports": true
},
"format_on_save": "on"
}
},
"format_on_save": "on",
"formatter": [
{
"external": {
"command": "node_modules/.bin/prettier",
"arguments": ["--config", "--stdin-filepath", "{buffer_path}"]
}
},
{
"code_actions": {
"source.fixAll.eslint": true,
"source.organizeImports": true,
"source.removeUnusedImports": true
}
}
],
"features": {
"inline_completion_provider": "supermaven"
},
"code_actions_on_format": {
"source.fixAll.eslint": true,
"source.organizeImports": true,
"source.removeUnusedImports": true
},
"prettier": {
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "preserve",
"endOfLine": "lf",
"plugins": []
},
"bracket_pairing": "always",
"eslint": {
"enabled": true,
"autoFixOnSave": true,
"autoFixOnFormat": true,
"autoFixOnFormatDelay": 0
},
"inlay_hints": {
"enabled": false,
"typeHints": false,
"parameterHints": true,
"chainingHints": false
},
"lsp": {
"typescript-language-server": {
"initialization_options": {
"preferences": {
"importModuleSpecifierPreference": "non-relative"
}
}
},
"wakatime": {
"settings": {
"api-key": "API_KEY_HERE"
}
},
"tailwindcss-language-server": {
"settings": {
"includedLanguages": {
"javascript": "javascript",
"javascriptreact": "javascript",
"typescript": "javascript",
"typescriptreact": "javascript",
"*.tsx": "javascript"
}
},
"experimental": {
"classRegex": [
"className=\"([^\"]*)",
"className={\"([^\"]*)",
"className\\: '([^']*)'"
]
},
"classAttributes": ["class", "className", "classList", ".*className"]
}
},
"language_servers": ["vtsls", "typescript-language-server", "eslint"],
"preview_tabs": {
"enabled": true
}
}
Yeah, I do not have a good theory yet on why had it broken, but could you try adding that
"prettier": {
"allowed": true
}
section back and see if it fixes things?
I just encountered the same issue trying to format JavaScript code with Prettier, and setting "allowed": true indeed fixed this.
I scrapped my old config and reapplied some stuff one after the other, leaving most other stuff as default
Seems to fix the problem for me
Check for existing issues
Describe the bug / provide steps to reproduce it
After latest Zed update i started noticing the following error appear when i save a file
log.txt
Environment
Zed: v0.160.7 (Zed) OS: macOS 15.1.0 Memory: 32 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
``` ```