@@ -7,8 +7,8 @@ use crate::{
77} ;
88use bpaf:: Bpaf ;
99use pgt_configuration:: { PartialConfiguration , partial_configuration} ;
10- use pgt_console:: Console ;
11- use pgt_fs:: FileSystem ;
10+ use pgt_console:: { Console , ConsoleExt , markup } ;
11+ use pgt_fs:: { ConfigName , FileSystem } ;
1212use pgt_workspace:: PartialConfigurationExt ;
1313use pgt_workspace:: configuration:: { LoadedConfiguration , load_configuration} ;
1414use pgt_workspace:: workspace:: { RegisterProjectFolderParams , UpdateSettingsParams } ;
@@ -58,7 +58,7 @@ pub enum PgtCommand {
5858 changed : bool ,
5959
6060 /// Use this to specify the base branch to compare against when you're using the --changed
61- /// flag and the `defaultBranch` is not set in your `postgrestools .jsonc`
61+ /// flag and the `defaultBranch` is not set in your `postgres-language-server .jsonc`
6262 #[ bpaf( long( "since" ) , argument( "REF" ) ) ]
6363 since : Option < String > ,
6464
@@ -91,8 +91,13 @@ pub enum PgtCommand {
9191 ) ]
9292 log_path : PathBuf ,
9393 /// Allows to set a custom file path to the configuration file,
94- /// or a custom directory path to find `postgrestools.jsonc`
95- #[ bpaf( env( "PGT_LOG_PREFIX_NAME" ) , long( "config-path" ) , argument( "PATH" ) ) ]
94+ /// or a custom directory path to find `postgres-language-server.jsonc`
95+ #[ bpaf(
96+ env( "PGT_LOG_PREFIX_NAME" ) ,
97+ env( "PGLS_LOG_PREFIX_NAME" ) ,
98+ long( "config-path" ) ,
99+ argument( "PATH" )
100+ ) ]
96101 config_path : Option < PathBuf > ,
97102 } ,
98103
@@ -127,8 +132,13 @@ pub enum PgtCommand {
127132 ) ]
128133 log_path : PathBuf ,
129134 /// Allows to set a custom file path to the configuration file,
130- /// or a custom directory path to find `postgrestools.jsonc`
131- #[ bpaf( env( "PGT_CONFIG_PATH" ) , long( "config-path" ) , argument( "PATH" ) ) ]
135+ /// or a custom directory path to find `postgres-language-server.jsonc`
136+ #[ bpaf(
137+ env( "PGT_CONFIG_PATH" ) ,
138+ env( "PGLS_CONFIG_PATH" ) ,
139+ long( "config-path" ) ,
140+ argument( "PATH" )
141+ ) ]
132142 config_path : Option < PathBuf > ,
133143 /// Bogus argument to make the command work with vscode-languageclient
134144 #[ bpaf( long( "stdio" ) , hide, hide_usage, switch) ]
@@ -183,8 +193,13 @@ pub enum PgtCommand {
183193 #[ bpaf( long( "stop-on-disconnect" ) , hide_usage) ]
184194 stop_on_disconnect : bool ,
185195 /// Allows to set a custom file path to the configuration file,
186- /// or a custom directory path to find `postgrestools.jsonc`
187- #[ bpaf( env( "PGT_CONFIG_PATH" ) , long( "config-path" ) , argument( "PATH" ) ) ]
196+ /// or a custom directory path to find `postgres-language-server.jsonc`
197+ #[ bpaf(
198+ env( "PGT_CONFIG_PATH" ) ,
199+ env( "PGLS_CONFIG_PATH" ) ,
200+ long( "config-path" ) ,
201+ argument( "PATH" )
202+ ) ]
188203 config_path : Option < PathBuf > ,
189204 } ,
190205 #[ bpaf( command( "__print_socket" ) , hide) ]
@@ -295,6 +310,19 @@ pub(crate) trait CommandRunner: Sized {
295310 let loaded_configuration =
296311 load_configuration ( fs, cli_options. as_configuration_path_hint ( ) ) ?;
297312
313+ // Check for deprecated config filename
314+ if let Some ( config_path) = & loaded_configuration. file_path {
315+ if let Some ( file_name) = config_path. file_name ( ) . and_then ( |n| n. to_str ( ) ) {
316+ if ConfigName :: is_deprecated ( file_name) {
317+ console. log ( markup ! {
318+ <Warn >"Warning: " </Warn >"You are using the deprecated config filename '" <Emphasis >"postgrestools.jsonc" </Emphasis >"'. \
319+ Please rename it to '" <Emphasis >"postgres-language-server.jsonc" </Emphasis >"'. \
320+ Support for the old filename will be removed in a future version.\n "
321+ } ) ;
322+ }
323+ }
324+ }
325+
298326 let configuration_path = loaded_configuration. directory_path . clone ( ) ;
299327 let configuration = self . merge_configuration ( loaded_configuration, fs, console) ?;
300328 let vcs_base_path = configuration_path. or ( fs. working_directory ( ) ) ;
0 commit comments