Do not use prettier for formatting node_modules/** files (#3286)
Fixes > the most annoying thing i'm running into right now is that when i'm patching something inside node_modules, Zed tries to pretty-format it according to my prettier config. this messes up the patch because it has formatting changes now. i need the pretty formatting on save to be off inside node_modules, that never makes sense feedback from #influencers Do note though, that language servers will still format any file inside node_modules, but at least it's not prettier now. VSCode seem to format the node_modules/** files via language servers too, so that seems ok for now, and the rest could be fixed during > "project diagnostics" (eslint) seem to be running inside node_modules, e.g. i'm seeing 3182 "errors" in my project. that doesn't make sense and probably wastes resources in addition to being annoying feedback later. Release Notes: - Fixed prettier formatting files inside node_modules
This commit is contained in:
parent
5ef021d200
commit
a67a283bdf
4 changed files with 244 additions and 97 deletions
|
@ -69,7 +69,7 @@ use std::{
|
|||
hash::Hash,
|
||||
mem,
|
||||
num::NonZeroU32,
|
||||
ops::Range,
|
||||
ops::{ControlFlow, Range},
|
||||
path::{self, Component, Path, PathBuf},
|
||||
process::Stdio,
|
||||
str,
|
||||
|
@ -8492,7 +8492,10 @@ impl Project {
|
|||
})
|
||||
.await
|
||||
{
|
||||
Ok(None) => {
|
||||
Ok(ControlFlow::Break(())) => {
|
||||
return None;
|
||||
}
|
||||
Ok(ControlFlow::Continue(None)) => {
|
||||
match project.update(&mut cx, |project, _| {
|
||||
project
|
||||
.prettiers_per_worktree
|
||||
|
@ -8524,7 +8527,7 @@ impl Project {
|
|||
.shared())),
|
||||
}
|
||||
}
|
||||
Ok(Some(prettier_dir)) => {
|
||||
Ok(ControlFlow::Continue(Some(prettier_dir))) => {
|
||||
match project.update(&mut cx, |project, _| {
|
||||
project
|
||||
.prettiers_per_worktree
|
||||
|
@ -8666,7 +8669,7 @@ impl Project {
|
|||
.await
|
||||
})
|
||||
}
|
||||
None => Task::ready(Ok(None)),
|
||||
None => Task::ready(Ok(ControlFlow::Break(()))),
|
||||
};
|
||||
let mut plugins_to_install = prettier_plugins;
|
||||
let previous_installation_process =
|
||||
|
@ -8696,8 +8699,9 @@ impl Project {
|
|||
.context("locate prettier installation")
|
||||
.map_err(Arc::new)?
|
||||
{
|
||||
Some(_non_default_prettier) => return Ok(()),
|
||||
None => {
|
||||
ControlFlow::Break(()) => return Ok(()),
|
||||
ControlFlow::Continue(Some(_non_default_prettier)) => return Ok(()),
|
||||
ControlFlow::Continue(None) => {
|
||||
let mut needs_install = match previous_installation_process {
|
||||
Some(previous_installation_process) => {
|
||||
previous_installation_process.await.is_err()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue