@@ -6,7 +6,7 @@ use anyhow::Result;
66use futures:: StreamExt ;
77use futures:: stream:: FuturesUnordered ;
88use pgt_analyse:: RuleCategoriesBuilder ;
9- use pgt_configuration:: ConfigurationPathHint ;
9+ use pgt_configuration:: { ConfigurationPathHint , PartialConfiguration } ;
1010use pgt_diagnostics:: { DiagnosticExt , Error } ;
1111use pgt_fs:: { FileSystem , PgTPath } ;
1212use pgt_workspace:: Workspace ;
@@ -386,11 +386,11 @@ impl Session {
386386 /// This function attempts to read the `postgrestools.jsonc` configuration file from
387387 /// the root URI and update the workspace settings accordingly
388388 #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
389- pub ( crate ) async fn load_workspace_settings ( & self ) {
389+ pub ( crate ) async fn load_workspace_settings ( & self , params : Option < PartialConfiguration > ) {
390390 // Providing a custom configuration path will not allow to support workspaces
391391 if let Some ( config_path) = & self . config_path {
392392 let base_path = ConfigurationPathHint :: FromUser ( config_path. clone ( ) ) ;
393- let status = self . load_pgt_configuration_file ( base_path) . await ;
393+ let status = self . load_pgt_configuration_file ( base_path, params ) . await ;
394394 self . set_configuration_status ( status) ;
395395 } else if let Some ( folders) = self . get_workspace_folders ( ) {
396396 info ! ( "Detected workspace folder." ) ;
@@ -401,9 +401,10 @@ impl Session {
401401 match base_path {
402402 Ok ( base_path) => {
403403 let status = self
404- . load_pgt_configuration_file ( ConfigurationPathHint :: FromWorkspace (
405- base_path,
406- ) )
404+ . load_pgt_configuration_file (
405+ ConfigurationPathHint :: FromWorkspace ( base_path) ,
406+ params. clone ( ) ,
407+ )
407408 . await ;
408409 self . set_configuration_status ( status) ;
409410 }
@@ -420,14 +421,15 @@ impl Session {
420421 None => ConfigurationPathHint :: default ( ) ,
421422 Some ( path) => ConfigurationPathHint :: FromLsp ( path) ,
422423 } ;
423- let status = self . load_pgt_configuration_file ( base_path) . await ;
424+ let status = self . load_pgt_configuration_file ( base_path, params ) . await ;
424425 self . set_configuration_status ( status) ;
425426 }
426427 }
427428
428429 async fn load_pgt_configuration_file (
429430 & self ,
430431 base_path : ConfigurationPathHint ,
432+ extra_config : Option < PartialConfiguration > ,
431433 ) -> ConfigurationStatus {
432434 match load_configuration ( & self . fs , base_path. clone ( ) ) {
433435 Ok ( loaded_configuration) => {
@@ -446,7 +448,10 @@ impl Session {
446448 Ok ( ( vcs_base_path, gitignore_matches) ) => {
447449 let result = self . workspace . update_settings ( UpdateSettingsParams {
448450 workspace_directory : self . fs . working_directory ( ) ,
449- configuration : fs_configuration,
451+ configuration : match extra_config {
452+ Some ( config) => fs_configuration. clone ( ) . merge ( config) ,
453+ None => fs_configuration,
454+ } ,
450455 vcs_base_path,
451456 gitignore_matches,
452457 } ) ;
0 commit comments