@@ -100,13 +100,19 @@ impl RuffSettings {
100100}
101101
102102impl RuffSettingsIndex {
103- pub ( super ) fn new ( root : & Path , editor_settings : & ResolvedEditorSettings ) -> Self {
103+ pub ( super ) fn new (
104+ root : & Path ,
105+ editor_settings : & ResolvedEditorSettings ,
106+ is_default_workspace : bool ,
107+ ) -> Self {
104108 let mut has_error = false ;
105109 let mut index = BTreeMap :: default ( ) ;
106110 let mut respect_gitignore = None ;
111+ let should_skip_workspace = usize:: from ( !is_default_workspace) ;
107112
108- // Add any settings from above the workspace root, excluding the workspace root itself.
109- for directory in root. ancestors ( ) . skip ( 1 ) {
113+ // Add any settings from above the workspace root. The ones from the workspace root will be
114+ // added only if it's not the default workspace.
115+ for directory in root. ancestors ( ) . skip ( should_skip_workspace) {
110116 match settings_toml ( directory) {
111117 Ok ( Some ( pyproject) ) => {
112118 match ruff_workspace:: resolver:: resolve_root_settings (
@@ -156,6 +162,18 @@ impl RuffSettingsIndex {
156162
157163 let fallback = Arc :: new ( RuffSettings :: fallback ( editor_settings, root) ) ;
158164
165+ if is_default_workspace {
166+ if has_error {
167+ let root = root. display ( ) ;
168+ show_err_msg ! (
169+ "Error while resolving settings from workspace {root}. \
170+ Please refer to the logs for more details.",
171+ ) ;
172+ }
173+
174+ return RuffSettingsIndex { index, fallback } ;
175+ }
176+
159177 // Add any settings within the workspace itself
160178 let mut builder = WalkBuilder :: new ( root) ;
161179 builder. standard_filters (
@@ -266,7 +284,7 @@ impl RuffSettingsIndex {
266284 ) ;
267285 }
268286
269- Self {
287+ RuffSettingsIndex {
270288 index : index. into_inner ( ) . unwrap ( ) ,
271289 fallback,
272290 }
0 commit comments