@@ -6,7 +6,7 @@ use anyhow::Result;
6
6
use futures:: StreamExt ;
7
7
use futures:: stream:: FuturesUnordered ;
8
8
use pgt_analyse:: RuleCategoriesBuilder ;
9
- use pgt_configuration:: ConfigurationPathHint ;
9
+ use pgt_configuration:: { ConfigurationPathHint , PartialConfiguration } ;
10
10
use pgt_diagnostics:: { DiagnosticExt , Error } ;
11
11
use pgt_fs:: { FileSystem , PgTPath } ;
12
12
use pgt_workspace:: Workspace ;
@@ -386,11 +386,11 @@ impl Session {
386
386
/// This function attempts to read the `postgrestools.jsonc` configuration file from
387
387
/// the root URI and update the workspace settings accordingly
388
388
#[ 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 > ) {
390
390
// Providing a custom configuration path will not allow to support workspaces
391
391
if let Some ( config_path) = & self . config_path {
392
392
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 ;
394
394
self . set_configuration_status ( status) ;
395
395
} else if let Some ( folders) = self . get_workspace_folders ( ) {
396
396
info ! ( "Detected workspace folder." ) ;
@@ -401,9 +401,10 @@ impl Session {
401
401
match base_path {
402
402
Ok ( base_path) => {
403
403
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
+ )
407
408
. await ;
408
409
self . set_configuration_status ( status) ;
409
410
}
@@ -420,14 +421,15 @@ impl Session {
420
421
None => ConfigurationPathHint :: default ( ) ,
421
422
Some ( path) => ConfigurationPathHint :: FromLsp ( path) ,
422
423
} ;
423
- let status = self . load_pgt_configuration_file ( base_path) . await ;
424
+ let status = self . load_pgt_configuration_file ( base_path, params ) . await ;
424
425
self . set_configuration_status ( status) ;
425
426
}
426
427
}
427
428
428
429
async fn load_pgt_configuration_file (
429
430
& self ,
430
431
base_path : ConfigurationPathHint ,
432
+ extra_config : Option < PartialConfiguration > ,
431
433
) -> ConfigurationStatus {
432
434
match load_configuration ( & self . fs , base_path. clone ( ) ) {
433
435
Ok ( loaded_configuration) => {
@@ -446,7 +448,10 @@ impl Session {
446
448
Ok ( ( vcs_base_path, gitignore_matches) ) => {
447
449
let result = self . workspace . update_settings ( UpdateSettingsParams {
448
450
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
+ } ,
450
455
vcs_base_path,
451
456
gitignore_matches,
452
457
skip_db : false ,
0 commit comments