@@ -5,11 +5,11 @@ use biome_configuration::diagnostics::InvalidIgnorePattern;
5
5
use biome_configuration:: javascript:: JsxRuntime ;
6
6
use biome_configuration:: organize_imports:: OrganizeImports ;
7
7
use biome_configuration:: {
8
- push_to_analyzer_rules, BiomeDiagnostic , CssConfiguration , FilesConfiguration ,
9
- FormatterConfiguration , JavascriptConfiguration , LinterConfiguration ,
10
- OverrideFormatterConfiguration , OverrideLinterConfiguration ,
11
- OverrideOrganizeImportsConfiguration , Overrides , PartialConfiguration , PartialCssConfiguration ,
12
- PartialJavascriptConfiguration , PartialJsonConfiguration , PlainIndentStyle , Rules ,
8
+ push_to_analyzer_rules, BiomeDiagnostic , FilesConfiguration , FormatterConfiguration ,
9
+ JavascriptConfiguration , LinterConfiguration , OverrideFormatterConfiguration ,
10
+ OverrideLinterConfiguration , OverrideOrganizeImportsConfiguration , Overrides ,
11
+ PartialConfiguration , PartialCssConfiguration , PartialJavascriptConfiguration ,
12
+ PartialJsonConfiguration , PlainIndentStyle , Rules ,
13
13
} ;
14
14
use biome_css_formatter:: context:: CssFormatOptions ;
15
15
use biome_css_parser:: CssParserOptions ;
@@ -216,7 +216,7 @@ impl Settings {
216
216
}
217
217
// css settings
218
218
if let Some ( css) = configuration. css {
219
- self . languages . css = CssConfiguration :: from ( css) . into ( ) ;
219
+ self . languages . css = css. into ( ) ;
220
220
}
221
221
222
222
// NOTE: keep this last. Computing the overrides require reading the settings computed by the parent settings.
@@ -494,20 +494,25 @@ impl From<PartialJsonConfiguration> for LanguageSettings<JsonLanguage> {
494
494
}
495
495
}
496
496
497
- impl From < CssConfiguration > for LanguageSettings < CssLanguage > {
498
- fn from ( css : CssConfiguration ) -> Self {
497
+ impl From < PartialCssConfiguration > for LanguageSettings < CssLanguage > {
498
+ fn from ( css : PartialCssConfiguration ) -> Self {
499
499
let mut language_setting: LanguageSettings < CssLanguage > = LanguageSettings :: default ( ) ;
500
500
501
- language_setting. parser . allow_wrong_line_comments = css. parser . allow_wrong_line_comments ;
502
- language_setting. parser . css_modules = css. parser . css_modules ;
503
-
504
- language_setting. formatter . enabled = Some ( css. formatter . enabled ) ;
505
- language_setting. formatter . indent_width = css. formatter . indent_width ;
506
- language_setting. formatter . indent_style = css. formatter . indent_style . map ( Into :: into) ;
507
- language_setting. formatter . line_width = css. formatter . line_width ;
508
- language_setting. formatter . line_ending = css. formatter . line_ending ;
509
- language_setting. formatter . quote_style = Some ( css. formatter . quote_style ) ;
510
- language_setting. linter . enabled = Some ( css. linter . enabled ) ;
501
+ if let Some ( parser) = css. parser {
502
+ language_setting. parser . allow_wrong_line_comments = parser. allow_wrong_line_comments ;
503
+ language_setting. parser . css_modules = parser. css_modules ;
504
+ }
505
+ if let Some ( formatter) = css. formatter {
506
+ language_setting. formatter . enabled = formatter. enabled ;
507
+ language_setting. formatter . indent_width = formatter. indent_width ;
508
+ language_setting. formatter . indent_style = formatter. indent_style . map ( Into :: into) ;
509
+ language_setting. formatter . line_width = formatter. line_width ;
510
+ language_setting. formatter . line_ending = formatter. line_ending ;
511
+ language_setting. formatter . quote_style = formatter. quote_style ;
512
+ }
513
+ if let Some ( linter) = css. linter {
514
+ language_setting. linter . enabled = linter. enabled ;
515
+ }
511
516
512
517
language_setting
513
518
}
@@ -1130,8 +1135,12 @@ impl OverrideSettingPattern {
1130
1135
1131
1136
let css_parser = & self . languages . css . parser ;
1132
1137
1133
- options. allow_wrong_line_comments = css_parser. allow_wrong_line_comments ;
1134
- options. css_modules = css_parser. css_modules ;
1138
+ if let Some ( allow_wrong_line_comments) = css_parser. allow_wrong_line_comments {
1139
+ options. allow_wrong_line_comments = allow_wrong_line_comments;
1140
+ }
1141
+ if let Some ( css_modules) = css_parser. css_modules {
1142
+ options. css_modules = css_modules;
1143
+ }
1135
1144
1136
1145
if let Ok ( mut writeonly_cache) = self . cached_css_parser_options . write ( ) {
1137
1146
let options = * options;
@@ -1365,8 +1374,8 @@ fn to_css_language_settings(
1365
1374
let parent_parser = & parent_settings. parser ;
1366
1375
language_setting. parser . allow_wrong_line_comments = parser
1367
1376
. allow_wrong_line_comments
1368
- . unwrap_or ( parent_parser. allow_wrong_line_comments ) ;
1369
- language_setting. parser . css_modules = parser. css_modules . unwrap_or ( parent_parser. css_modules ) ;
1377
+ . or ( parent_parser. allow_wrong_line_comments ) ;
1378
+ language_setting. parser . css_modules = parser. css_modules . or ( parent_parser. css_modules ) ;
1370
1379
1371
1380
language_setting
1372
1381
}
0 commit comments