@@ -847,7 +847,7 @@ pub fn updateConfiguration2(
847847
848848pub fn updateConfiguration (
849849 server : * Server ,
850- new_config : configuration.Configuration ,
850+ param_new_config : configuration.Configuration ,
851851 options : UpdateConfigurationOptions ,
852852) error {OutOfMemory }! void {
853853 const tracy_zone = tracy .trace (@src ());
@@ -857,17 +857,20 @@ pub fn updateConfiguration(
857857 defer server .config_arena = config_arena_allocator .state ;
858858 const config_arena = config_arena_allocator .allocator ();
859859
860- var new_cfg : configuration.Configuration = .{};
860+ var new_config : configuration.Configuration = param_new_config ;
861+ server .validateConfiguration (& new_config );
862+
861863 inline for (std .meta .fields (Config )) | field | {
862- @field (new_cfg , field .name ) = if (@field (new_config , field .name )) | new_value | new_value else @field (server .config , field .name );
864+ @field (new_config , field .name ) = if (@field (new_config , field .name )) | new_value |
865+ new_value
866+ else
867+ @field (server .config , field .name );
863868 }
864869
865- server .validateConfiguration (& new_cfg );
866-
867870 const resolve_result : ResolveConfigurationResult = blk : {
868871 if (! options .resolve ) break :blk ResolveConfigurationResult .unresolved ;
869- const resolve_result = try resolveConfiguration (server .allocator , config_arena , & new_cfg );
870- server .validateConfiguration (& new_cfg );
872+ const resolve_result = try resolveConfiguration (server .allocator , config_arena , & new_config );
873+ server .validateConfiguration (& new_config );
871874 break :blk resolve_result ;
872875 };
873876 defer resolve_result .deinit ();
@@ -888,7 +891,7 @@ pub fn updateConfiguration(
888891 const new_force_autofix = new_config .force_autofix != null and server .config .force_autofix != new_config .force_autofix .? ;
889892
890893 inline for (std .meta .fields (Config )) | field | {
891- if (@field (new_cfg , field .name )) | new_value | {
894+ if (@field (new_config , field .name )) | new_value | {
892895 const old_value_maybe_optional = @field (server .config , field .name );
893896
894897 const override_value = blk : {
@@ -1070,7 +1073,12 @@ fn validateConfiguration(server: *Server, config: *configuration.Configuration)
10701073
10711074 for (checks ) | check | {
10721075 const is_ok = if (check .value .* ) | path | ok : {
1073- if (path .len == 0 ) break :ok false ;
1076+ // Convert `""` to `null`
1077+ if (path .len == 0 ) {
1078+ // Thank you Visual Studio Trash Code
1079+ check .value .* = null ;
1080+ break :ok true ;
1081+ }
10741082
10751083 if (! std .fs .path .isAbsolute (path )) {
10761084 server .showMessage (.Warning , "config option '{s}': expected absolute path but got '{s}'" , .{ check .field_name , path });
0 commit comments