@@ -113,11 +113,11 @@ end
113113 end
114114end
115115
116- function store_project_config ! (manager:: JETLS.ConfigManager , filepath:: AbstractString , new_config:: JETLS.JETLSConfig )
116+ function store_file_config ! (manager:: JETLS.ConfigManager , filepath:: AbstractString , new_config:: JETLS.JETLSConfig )
117117 JETLS. store! (manager) do old_data
118118 new_data = JETLS. ConfigManagerData (old_data;
119- project_config = new_config,
120- project_config_path = filepath
119+ file_config = new_config,
120+ file_config_path = filepath
121121 )
122122 return new_data, nothing
123123 end
139139 internal= JETLS. InternalConfig (5 , nothing )
140140 )
141141
142- store_project_config ! (manager, " /foo/bar/.JETLSConfig.toml" , test_config)
142+ store_file_config ! (manager, " /foo/bar/.JETLSConfig.toml" , test_config)
143143 JETLS. fix_static_settings! (manager)
144144
145145 @test JETLS. get_config (manager, :full_analysis , :debounce ) === 2.0
@@ -154,33 +154,34 @@ end
154154 JETLS. get_config (manager, :internal , :static_setting )
155155 end == Union{Nothing, Int}
156156
157- # Test priority: LSP config has lower priority than project config
157+ # Test priority: file config has higher priority than LSP config
158158 lsp_config = JETLS. JETLSConfig (;
159159 full_analysis= JETLS. FullAnalysisConfig (999.0 ),
160160 testrunner= JETLS. TestRunnerConfig (" lsp_runner" )
161161 )
162162 store_lsp_config! (manager, lsp_config)
163- # High priority project config should still win
163+ # High priority file config should win
164164 @test JETLS. get_config (manager, :full_analysis , :debounce ) === 2.0
165165 @test JETLS. get_config (manager, :testrunner , :executable ) === " test_runner"
166166
167167 # Test updating config
168+ store_lsp_config! (manager, JETLS. EMPTY_CONFIG)
168169 changed_static_keys = Set {String} ()
169170 updated_config = JETLS. JETLSConfig (;
170171 full_analysis= JETLS. FullAnalysisConfig (3.0 ),
171172 testrunner= JETLS. TestRunnerConfig (" new_runner" ),
172173 internal= JETLS. InternalConfig (10 , nothing )
173174 )
174175 let data = JETLS. load (manager)
175- current_config = data. project_config
176+ current_config = data. file_config
176177 JETLS. on_difference (current_config, updated_config) do _, new_val, path
177178 if JETLS. is_static_setting (JETLS. JETLSConfig, path... )
178179 push! (changed_static_keys, join (path, " ." ))
179180 end
180181 return new_val
181182 end
182183 end
183- store_project_config ! (manager, " /foo/bar/.JETLSConfig.toml" , updated_config)
184+ store_file_config ! (manager, " /foo/bar/.JETLSConfig.toml" , updated_config)
184185
185186 # `on_static_setting` should be called for static keys
186187 @test changed_static_keys == Set ([" internal.static_setting" ])
@@ -193,19 +194,19 @@ end
193194
194195@testset " `fix_static_settings!`" begin
195196 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
196- high_priority_config = JETLS. JETLSConfig (;
197+ file_config = JETLS. JETLSConfig (;
197198 internal= JETLS. InternalConfig (2 , nothing )
198199 )
199- low_priority_config = JETLS. JETLSConfig (;
200+ lsp_config = JETLS. JETLSConfig (;
200201 internal= JETLS. InternalConfig (999 , nothing ),
201202 testrunner= JETLS. TestRunnerConfig (" custom" )
202203 )
203204
204- store_lsp_config ! (manager, low_priority_config )
205- store_project_config ! (manager, " /path/.JETLSConfig.toml " , high_priority_config )
205+ store_file_config ! (manager, " /path/.JETLSConfig.toml " , file_config )
206+ store_lsp_config ! (manager, lsp_config )
206207 JETLS. fix_static_settings! (manager)
207208
208- # high priority should win for the static keys
209+ # File config (higher priority) should win for the static keys
209210 data = JETLS. load (manager)
210211 @test JETLS. getobjpath (data. static_settings, :internal , :static_setting ) == 2
211212end
@@ -217,19 +218,21 @@ end
217218 full_analysis= JETLS. FullAnalysisConfig (2.0 ),
218219 testrunner= nothing
219220 )
220- project_config = JETLS. JETLSConfig (;
221- testrunner= JETLS. TestRunnerConfig (" project_runner " ),
221+ file_config = JETLS. JETLSConfig (;
222+ testrunner= JETLS. TestRunnerConfig (" file_runner " ),
222223 full_analysis= nothing
223224 )
224225
225226 store_lsp_config! (manager, lsp_config)
226- store_project_config ! (manager, " /project/.JETLSConfig.toml" , project_config )
227+ store_file_config ! (manager, " /project/.JETLSConfig.toml" , file_config )
227228
228- @test JETLS. get_config (manager, :testrunner , :executable ) == " project_runner"
229+ # File config has higher priority, so it wins when both are set
230+ @test JETLS. get_config (manager, :testrunner , :executable ) == " file_runner"
231+ # When file config doesn't set a value, LSP config is used
229232 @test JETLS. get_config (manager, :full_analysis , :debounce ) == 2.0
230233end
231234
232- @testset " LSP configuration merging without project config" begin
235+ @testset " LSP configuration merging without file config" begin
233236 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
234237
235238 lsp_config = JETLS. JETLSConfig (;
@@ -247,22 +250,22 @@ end
247250 @testset " preset formatter: Runic" begin
248251 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
249252 config = JETLS. JETLSConfig (; formatter= " Runic" )
250- store_project_config ! (manager, " /path/.JETLSConfig.toml" , config)
253+ store_file_config ! (manager, " /path/.JETLSConfig.toml" , config)
251254 @test JETLS. get_config (manager, :formatter ) == " Runic"
252255 end
253256
254257 @testset " preset formatter: JuliaFormatter" begin
255258 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
256259 config = JETLS. JETLSConfig (; formatter= " JuliaFormatter" )
257- store_project_config ! (manager, " /path/.JETLSConfig.toml" , config)
260+ store_file_config ! (manager, " /path/.JETLSConfig.toml" , config)
258261 @test JETLS. get_config (manager, :formatter ) == " JuliaFormatter"
259262 end
260263
261264 @testset " custom formatter" begin
262265 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
263266 custom = JETLS. CustomFormatterConfig (" my-formatter" , " my-range-formatter" )
264267 config = JETLS. JETLSConfig (; formatter= custom)
265- store_project_config ! (manager, " /path/.JETLSConfig.toml" , config)
268+ store_file_config ! (manager, " /path/.JETLSConfig.toml" , config)
266269 formatter = JETLS. get_config (manager, :formatter )
267270 @test formatter isa JETLS. CustomFormatterConfig
268271 @test formatter. executable == " my-formatter"
273276 manager = JETLS. ConfigManager (JETLS. ConfigManagerData ())
274277 custom = JETLS. CustomFormatterConfig (" my-formatter" , nothing )
275278 config = JETLS. JETLSConfig (; formatter= custom)
276- store_project_config ! (manager, " /path/.JETLSConfig.toml" , config)
279+ store_file_config ! (manager, " /path/.JETLSConfig.toml" , config)
277280 formatter = JETLS. get_config (manager, :formatter )
278281 @test formatter isa JETLS. CustomFormatterConfig
279282 @test formatter. executable == " my-formatter"
0 commit comments