-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Revert deprecate code actions on format #40409
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
Conversation
This reverts commit 3ba4b84. Co-authored-by: Cole Miller <[email protected]>
Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: Cole <[email protected]>
a395198 to
e4285b2
Compare
Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
Co-authored-by: Cole <[email protected]> Co-authored-by: Mikayla Maki <[email protected]>
Closes #40334 This reverts the change made in #39983, and includes a replacement migration that will transform formatter settings values consisting of only `code_action` format steps into the previously deprecated `code_actions_on_format` in an attempt to restore the behavior to what it was before the migration that deprecated `code_actions_on_format`. This PR will result in a modified order in the `code_actions_on_format` setting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have the `code_actions_on_format` key Release Notes: - Fixed an issue with a settings migration that deprecated the `code_actions_on_format` setting. The `code_actions_on_format` setting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration --------- Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
Closes #40334 This reverts the change made in #39983, and includes a replacement migration that will transform formatter settings values consisting of only `code_action` format steps into the previously deprecated `code_actions_on_format` in an attempt to restore the behavior to what it was before the migration that deprecated `code_actions_on_format`. This PR will result in a modified order in the `code_actions_on_format` setting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have the `code_actions_on_format` key Release Notes: - Fixed an issue with a settings migration that deprecated the `code_actions_on_format` setting. The `code_actions_on_format` setting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration --------- Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
Closes #40334 This reverts the change made in #39983, and includes a replacement migration that will transform formatter settings values consisting of only `code_action` format steps into the previously deprecated `code_actions_on_format` in an attempt to restore the behavior to what it was before the migration that deprecated `code_actions_on_format`. This PR will result in a modified order in the `code_actions_on_format` setting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have the `code_actions_on_format` key Release Notes: - Fixed an issue with a settings migration that deprecated the `code_actions_on_format` setting. The `code_actions_on_format` setting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration --------- Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
Closes zed-industries#40334 This reverts the change made in zed-industries#39983, and includes a replacement migration that will transform formatter settings values consisting of only `code_action` format steps into the previously deprecated `code_actions_on_format` in an attempt to restore the behavior to what it was before the migration that deprecated `code_actions_on_format`. This PR will result in a modified order in the `code_actions_on_format` setting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have the `code_actions_on_format` key Release Notes: - Fixed an issue with a settings migration that deprecated the `code_actions_on_format` setting. The `code_actions_on_format` setting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration --------- Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
|
This unfortunately broke my setup. Using the config below with 208.5. I migrated to 208.4 and that worked as expected. "format_on_save": "on",
"languages": {
"TypeScript": {
"code_actions_on_format": {
"source.fixAll.eslint": true
}
},
"TSX": {
"code_actions_on_format": {
"source.fixAll.eslint": true
}
}
}when I save a file it flashes the correct the format
but its then immediately replaced with
from my .eslintrc.js rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: false,
trailingComma: 'es5',
},
], |
|
I'm seeing the same behavior as you with "format_on_save": "off",
"languages": {
"JavaScript": {
"format_on_save": "on",
"formatter": [{ "code_action": "source.fixAll.eslint" }]
}
},It looks like within a fraction of a second the editor first correctly applies the desired formatting (that works in 208.4) and then immediately applying another layer of formatting from an unknown source, shifting it back to incorrect. |
|
Seems like its tracked now in #40334 Heh, or maybe that was the source of the issue. Sorry. |
|
Interesting, if I change my settings to "languages": {
"TypeScript": {
"formatter": ["auto", { "code_action": "source.fixAll.eslint" }]
},
"TSX": {
"formatter": ["auto", { "code_action": "source.fixAll.eslint" }]
}
}then it first flashes the wrong formatting, and then corrects it with the proper one. "languages": {
"TypeScript": {
"formatter": [{ "code_action": "source.fixAll.eslint" }]
},
"TSX": {
"formatter": [{ "code_action": "source.fixAll.eslint" }]
}
}and this setting will only give me the wrong formatting. |
|
0.208.5 broke formating, it doesn't use my eslint rules any more |
|
I might have figured it out. I read on https://zed.dev/docs/languages/typescript#language-servers
Maybe this is a new default? So I guessed the "languages": {
"TypeScript": {
"prettier": { "allowed": false },
"formatter": [{ "code_action": "source.fixAll.eslint" }]
},
"TSX": {
"prettier": { "allowed": false },
"formatter": [{ "code_action": "source.fixAll.eslint" }]
}
}It now works as expected. No flashes of wrongly formatted content. Though it prompts for a migrations. The following also works: "languages": {
"TypeScript": {
"code_actions_on_format": {
"source.fixAll.eslint": true
},
"prettier": { "allowed": false }
},
"TSX": {
"code_actions_on_format": {
"source.fixAll.eslint": true
},
"prettier": { "allowed": false }
}
} |
Closes zed-industries#40334 This reverts the change made in zed-industries#39983, and includes a replacement migration that will transform formatter settings values consisting of only `code_action` format steps into the previously deprecated `code_actions_on_format` in an attempt to restore the behavior to what it was before the migration that deprecated `code_actions_on_format`. This PR will result in a modified order in the `code_actions_on_format` setting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have the `code_actions_on_format` key Release Notes: - Fixed an issue with a settings migration that deprecated the `code_actions_on_format` setting. The `code_actions_on_format` setting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration --------- Co-authored-by: Cole Miller <[email protected]> Co-authored-by: Mikayla Maki <[email protected]> Co-authored-by: HactarCE <[email protected]>
|
I'm shocked that even the most basic ESLint formatting is failing. I've recommended Zed to so many friends, and encountering such issues is downright embarrassing. |
|
@yizixu I spent 3 days but still couldn't get Eslint+ Prettier to work on ZED. While I'm working on Webstorm, that's the only thing that really upsets me. |
|
@ottob thanks for your investigation, but for some reason |
|
我发现了一个有趣的方法 {
"code_actions_on_format": {
"source.fixAll.eslint": true
},
"prettier": {
"allowed": false
},
"language_servers": ["eslint"],
}但是对于vue的temelate需要两次保存才能生效 |
|
I'm sharing my project settings files that currently works (95% of the time...) in case it helps someone in the meantime. It was not easy to figure out how to make it all work together and to be honest, it fails rarely but randomly at times; A restart of language servers or Zed is necessary. I am not a dev, mostly a designer who codes with a decent knowledge about Laravel + Vue project structures in a monorepo. So I'm not entirely sure my settings make any sense. Does eslint lint my JSON files? I don't know, but at the moment it works. I would appreciate to know if my settings are aligned with the current/desired settings structure or if it's legacy.
{
"format_on_save": "on",
"languages": {
"JavaScript": {
"language_servers": [
"...",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"JSON": {
"language_servers": [
"...",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"JSONC": {
"language_servers": [
"...",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"TSX": {
"language_servers": [
"...",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"TypeScript": {
"language_servers": [
"...",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"Vue.js": {
"language_servers": [
"...",
"vue-language-server",
"vtsls",
"eslint"
],
"prettier": { "allowed": false },
"formatter": [
{ "code_action": "source.fixAll.eslint" }
]
},
"PHP": {
"formatter": {
"external": {
"command": "bash",
"arguments": [
"-c",
"cat > {buffer_path} && ./apps/main/vendor/bin/pint --quiet {buffer_path} && cat {buffer_path}"
]
}
}
}
},
// [...]
}Remember to make sure no other conflicting settings are in your user settings. Even though, technically, the project settings are supposed to overwrite user settings. |
|
After futzing this is the simplest config I could get working for me on 0.208.6. I kind of assumed something like {
"format_on_save": "off",
"languages": {
"JavaScript": {
"format_on_save": "on",
"code_actions_on_format": { "source.fixAll.eslint": true },
// HACK: Disable default formatter
"formatter": { "language_server": { "name": "" } }
}
} |
|
Hello all, my deepest apologies for breaking your formatting, and for leaving it broken for so long. We are rolling out a fix in #40916, but unfortunately it will not fix the issue for those who have already updated and migrated. If you were already affected (as everyone who has commented thus far is) then placing If doing so does not fix your issue, please please open a new issue describing what you are experiencing, and we will try to help you fix it as soon as possible ExplanationThe settings migration in this PR (which will happen in memory when we load your settings, we only migrate your settings file on disk after you click the "backup and migrate" button), made it so that Would be migrated to This was done to fix issues we encountered after attempting to deprecate the This however, resulted in the removal of the We're planning to take a deeper look at how we can simplify, and improve these settings so that they are less confusing, and much harder to break like we did in this PR. |
…0916) Closes #40874 Release Notes: - Fixed an issue where migrating settings after v0.208.5+ would spuriously enable prettier. This fix only affects those who have not updated or migrated yet. For those who have already updated to version v0.208.5 or later, placing `"formatter": []` in your settings in the affected languages will fix the issue. --------- Co-authored-by: Mikayla <[email protected]>
Follow up for #40409 Fix for #40874 (comment) Release Notes: - Fixed an issue where having an empty formatter array in your settings `"formatter": []` would result in an erroneous prompt to migrate settings
Follow up for #40409 Fix for #40874 (comment) Release Notes: - Fixed an issue where having an empty formatter array in your settings `"formatter": []` would result in an erroneous prompt to migrate settings
Follow up for #40409 Fix for #40874 (comment) Release Notes: - Fixed an issue where having an empty formatter array in your settings `"formatter": []` would result in an erroneous prompt to migrate settings
…grated yet (zed-industries#40916) Closes zed-industries#40874 Release Notes: - Fixed an issue where migrating settings after v0.208.5+ would spuriously enable prettier. This fix only affects those who have not updated or migrated yet. For those who have already updated to version v0.208.5 or later, placing `"formatter": []` in your settings in the affected languages will fix the issue. --------- Co-authored-by: Mikayla <[email protected]>
Follow up for zed-industries#40409 Fix for zed-industries#40874 (comment) Release Notes: - Fixed an issue where having an empty formatter array in your settings `"formatter": []` would result in an erroneous prompt to migrate settings
Closes #40334
This reverts the change made in #39983, and includes a replacement migration that will transform formatter settings values consisting of only
code_actionformat steps into the previously deprecatedcode_actions_on_formatin an attempt to restore the behavior to what it was before the migration that deprecatedcode_actions_on_format.This PR will result in a modified order in the
code_actions_on_formatsetting if it existed, however the decision was made to explicitly ignore this for now, as this PR is primarily targeting users who have already had the deprecation migration run, and no longer have thecode_actions_on_formatkeyRelease Notes:
code_actions_on_formatsetting. Thecode_actions_on_formatsetting has been un-deprecated, and affected users will have the bad migration rolled back with an updated migration