Skip to content

Commit 166540e

Browse files
committed
Fix jdtls.settings not falling back to jdtls.initialization_options.settings like intended
1 parent 778b8f6 commit 166540e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/lib.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,26 @@ impl Extension for Java {
349349
language_server_id: &LanguageServerId,
350350
worktree: &Worktree,
351351
) -> zed::Result<Option<Value>> {
352-
LspSettings::for_worktree(language_server_id.as_ref(), worktree)
353-
.map(|lsp_settings| lsp_settings.settings)
354-
.or(self
352+
// FIXME(Valentine Briese): I don't really like that we have a variable
353+
// here, there're probably some `Result` and/or
354+
// `Option` methods that would eliminate the
355+
// need for this, but at least this is easy to
356+
// read.
357+
358+
let mut settings = LspSettings::for_worktree(language_server_id.as_ref(), worktree)
359+
.map(|lsp_settings| lsp_settings.settings);
360+
361+
if !matches!(settings, Ok(Some(_))) {
362+
settings = self
355363
.language_server_initialization_options(language_server_id, worktree)
356364
.map(|initialization_options| {
357365
initialization_options.and_then(|initialization_options| {
358366
initialization_options.get("settings").cloned()
359367
})
360-
}))
368+
})
369+
}
370+
371+
settings
361372
}
362373

363374
fn label_for_completion(

0 commit comments

Comments
 (0)