The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(java): apply unmanaged project source roots (#611)
l0ng-ai0be97c4323c0
diff --git a/crates/ide-host/src/ops/project.rs b/crates/ide-host/src/ops/project.rsindex 4eef23a60..ec1d44026 100644--- a/crates/ide-host/src/ops/project.rs+++ b/crates/ide-host/src/ops/project.rs@@ -172,7 +172,10 @@ pub fn set_settings(host.apply_proxy();}// A new interpreter / toolchain / server executable restarts the language servers it affects.- if ["languages", "tools", "languageServers"].iter().any(|k| key == *k || key.starts_with(&format!("{k}."))) {+ if ["languages", "tools", "languageServers", "projectStructure"]+ .iter()+ .any(|k| key == *k || key.starts_with(&format!("{k}.")))+ {for project in affected() {let lsp = project.lsp.clone();host.runtime.spawn(async move { lsp.reconfigure().await });diff --git a/crates/ide-host/src/project.rs b/crates/ide-host/src/project.rsindex 88a93c89b..63636f9e4 100644--- a/crates/ide-host/src/project.rs+++ b/crates/ide-host/src/project.rs@@ -139,6 +139,14 @@ impl Host {ide_sdk::apply::configure_server(cfg, root, server_root, &effective);ide_sdk::java::cap_java_home(cfg, &ide_sdk::java::installed_jdks());if cfg.name == "jdtls" {+ ide_lsp::jdtls::configure_source_paths(+ cfg,+ ide_workspace::roots::unmanaged_java_source_paths(+ root,+ server_root,+ &effective.project_structure,+ ),+ );let bundles: Vec<PathBuf> =ide_tools::managed_bundle(&data_dir, "java-debug").into_iter().collect();let min_java = ide_sdk::java::jdtls_min_java(cfg);diff --git a/crates/ide-lsp/src/handler.rs b/crates/ide-lsp/src/handler.rsindex 1efe3be34..55e6e0ff5 100644--- a/crates/ide-lsp/src/handler.rs+++ b/crates/ide-lsp/src/handler.rs@@ -291,6 +291,21 @@ impl Handler for ClientHandler {/// `initializationOptions` with its `settings` merged over them.pub(crate) fn all_settings(cfg: &ide_language::LanguageServerConfig) -> Value {let mut out = cfg.initialization_options.as_ref().and_then(|v| serde_json::to_value(v).ok()).unwrap_or(Value::Null);+ if cfg.name == "jdtls" {+ out = out.get("settings").cloned().unwrap_or_else(|| json!({}));+ if let Some(settings) = &cfg.settings {+ // Accept the initialization-options wrapper as well as LSP settings.+ if let Some(nested) = settings.get("settings") {+ merge(&mut out, nested.clone());+ }+ let mut direct = settings.clone();+ if let Some(direct) = direct.as_object_mut() {+ direct.remove("settings");+ }+ merge(&mut out, direct);+ }+ return out;+ }if let Some(settings) = &cfg.settings {merge(&mut out, settings.clone());}diff --git a/crates/ide-lsp/src/jdtls.rs b/crates/ide-lsp/src/jdtls.rsindex 3c8da6806..6b47e143c 100644--- a/crates/ide-lsp/src/jdtls.rs+++ b/crates/ide-lsp/src/jdtls.rs@@ -35,6 +35,48 @@ const ACCESS_OPTIONS: [&str; 2] = ["org.eclipse.jdt.core.compiler.problem.discouragedReference",];+/// Keep the source model in protocol settings so jdtls's invisible-project+/// initialization and configuration use the same roots as workspace builds.+pub fn configure_source_paths(cfg: &mut ide_language::LanguageServerConfig, paths: Option<Vec<String>>) {+ if cfg.name != SERVER {+ return;+ }+ if let Some(paths) = paths {+ let mut settings = cfg.settings.take().unwrap_or_else(|| json!({}));+ settings["java"]["project"]["sourcePaths"] = json!(paths);+ cfg.settings = Some(settings);+ }+}++pub(crate) fn source_paths_removed(+ current: &ide_language::LanguageServerConfig,+ next: &ide_language::LanguageServerConfig,+) -> bool {+ current.name == SERVER+ && crate::handler::all_settings(current).pointer("/java/project/sourcePaths").is_some()+ && crate::handler::all_settings(next).pointer("/java/project/sourcePaths").is_none()+}++pub(crate) fn source_trigger(root: &Path, paths: &[Value]) -> Option<PathBuf> {+ for path in paths.iter().filter_map(Value::as_str) {+ // Runs can start jdtls without an editor. Invisible-project import still+ // needs a Java trigger file; discovery is bounded and runs off async workers.+ let found = ignore::WalkBuilder::new(root.join(path))+ .standard_filters(false)+ .max_depth(Some(32))+ .build()+ .take(4000)+ .filter_map(Result::ok)+ .find(|e| {+ e.file_type().is_some_and(|t| t.is_file()) && e.path().extension().is_some_and(|ext| ext == "java")+ });+ if let Some(entry) = found {+ return Some(entry.into_path());+ }+ }+ None+}+fn compiler_defaults(cfg: &ide_language::LanguageServerConfig) -> Value {// updateSettings persists project options. Only use it when jdtls redirects// generated metadata into its workspace, and never touch an existing .settings.@@ -518,6 +560,64 @@ impl LspManager {mod tests {use super::*;+ fn java_config() -> ide_language::LanguageServerConfig {+ let language: ide_language::LanguageConfig =+ toml::from_str(include_str!("../../../languages/java.toml")).unwrap();+ language.language_servers.into_iter().next().unwrap()+ }++ #[test]+ fn source_settings_preserve_java_defaults_and_library_resolution() {+ let mut cfg = java_config();+ configure_source_paths(&mut cfg, Some(vec!["src/main/java".into(), "tests".into()]));+ let settings = crate::handler::all_settings(&cfg);+ assert_eq!(settings["java"]["project"]["sourcePaths"], json!(["src/main/java", "tests"]));+ assert_eq!(settings["java"]["project"]["referencedLibraries"], json!(["lib/**/*.jar"]));+ assert_eq!(settings["java"]["autobuild"]["enabled"], true);+ assert!(settings.get("bundles").is_none());+ assert!(settings.get("settings").is_none(), "didChangeConfiguration takes java settings directly");+ }++ #[test]+ fn unmarked_and_managed_source_models_are_not_overridden() {+ let mut cfg = java_config();+ let initial = cfg.clone();+ configure_source_paths(&mut cfg, None);+ assert_eq!(cfg, initial);+ assert!(crate::handler::all_settings(&cfg).pointer("/java/project/sourcePaths").is_none());+ configure_source_paths(&mut cfg, Some(vec!["custom".into()]));+ assert!(source_paths_removed(&cfg, &initial));+ assert!(!source_paths_removed(&initial, &cfg));+ let mut other = initial;+ other.name = "other".into();+ let initial = other.clone();+ configure_source_paths(&mut other, Some(vec!["custom".into()]));+ assert_eq!(other, initial);+ }++ #[test]+ fn explicit_java_protocol_settings_override_defaults_in_either_shape() {+ for wrapped in [false, true] {+ let mut cfg = java_config();+ let settings = json!({"java": {"project": {"referencedLibraries": ["vendor/*.jar"]}}});+ cfg.settings = Some(if wrapped { json!({"settings": settings}) } else { settings });+ configure_source_paths(&mut cfg, Some(vec!["custom".into()]));+ let settings = crate::handler::all_settings(&cfg);+ assert_eq!(settings["java"]["project"]["referencedLibraries"], json!(["vendor/*.jar"]));+ assert_eq!(settings["java"]["project"]["sourcePaths"], json!(["custom"]));+ }+ }++ #[test]+ fn run_without_an_editor_discovers_a_trigger_inside_its_source_roots() {+ let dir = tempfile::tempdir().unwrap();+ std::fs::create_dir_all(dir.path().join("src/demo/engine")).unwrap();+ let file = dir.path().join("src/demo/engine/Main.java");+ std::fs::write(&file, "package demo.engine; public class Main {}").unwrap();+ assert_eq!(source_trigger(dir.path(), &[json!("generated"), json!("src")]), Some(file));+ assert_eq!(source_trigger(dir.path(), &[json!("tests")]), None);+ }+#[tokio::test]async fn cancellation_ends_a_pending_wait() {let cancel = CancellationToken::new();diff --git a/crates/ide-lsp/src/lib.rs b/crates/ide-lsp/src/lib.rsindex b64fd0ac4..94d009846 100644--- a/crates/ide-lsp/src/lib.rs+++ b/crates/ide-lsp/src/lib.rs@@ -513,7 +513,19 @@ impl LspManager {}};- let init = self.initialize_params(&server);+ let mut init = self.initialize_params(&server);+ if server.name == "jdtls"+ && init["initializationOptions"].get("triggerFiles").is_none()+ && let Some(paths) = init+ .pointer("/initializationOptions/settings/java/project/sourcePaths")+ .and_then(Value::as_array)+ .cloned()+ {+ let root = server.root.clone();+ if let Ok(Some(path)) = tokio::task::spawn_blocking(move || jdtls::source_trigger(&root, &paths)).await {+ init["initializationOptions"]["triggerFiles"] = json!([uri::path_to_uri_string(&path)]);+ }+ }let result = tokio::time::timeout(INITIALIZE_TIMEOUT, peer.request::<_, Value>("initialize", init, None)).await.unwrap_or(Err(RpcError::Timeout));@@ -656,12 +668,26 @@ impl LspManager {fn initialize_params(&self, server: &Server) -> Value {let root_uri = uri::path_to_uri(&server.root);let name = server.root.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| "root".into());- let init_options = server- .effective_config()- .initialization_options- .as_ref()- .and_then(|v| serde_json::to_value(v).ok())- .unwrap_or(Value::Null);+ let cfg = server.effective_config();+ let mut init_options =+ cfg.initialization_options.as_ref().and_then(|v| serde_json::to_value(v).ok()).unwrap_or(Value::Null);+ if server.name == "jdtls" {+ if !init_options.is_object() {+ init_options = json!({});+ }+ init_options["settings"] = handler::all_settings(&cfg);+ let triggers: Vec<_> = self+ .docs+ .lock()+ .values()+ .filter(|d| d.language.as_str() == "java" && d.path.starts_with(&server.root))+ .map(|d| uri::path_to_uri_string(&d.path))+ .collect();+ if !triggers.is_empty() && init_options.get("triggerFiles").is_none() {+ // Re-import cached invisible projects with the current source model.+ init_options["triggerFiles"] = json!(triggers);+ }+ }let mut params = json!({"processId": std::process::id(),"clientInfo": { "name": "OpenIDEA", "version": env!("CARGO_PKG_VERSION") },@@ -2081,6 +2107,7 @@ impl LspManager {let without_settings = |c: &LanguageServerConfig| LanguageServerConfig { settings: None, ..c.clone() };if let Some(run) = s.running()&& without_settings(&next) == without_settings(¤t)+ && !jdtls::source_paths_removed(¤t, &next){s.set_effective_config(next);let params = json!({ "settings": handler::all_settings(&s.effective_config()) });diff --git a/crates/ide-lsp/tests/mock_server.rs b/crates/ide-lsp/tests/mock_server.rsindex 95aac5643..080d3ed84 100644--- a/crates/ide-lsp/tests/mock_server.rs+++ b/crates/ide-lsp/tests/mock_server.rs@@ -1012,6 +1012,76 @@ async fn settings_changes_reach_servers_without_restarts() {assert_eq!(s.launches.load(Ordering::SeqCst), 1);}+#[tokio::test(flavor = "multi_thread")]+async fn java_source_paths_reach_initialization_live_configuration_and_builds() {+ let h = harness_configured("java", "java", &[("jdtls", incremental_caps())], |cfg| {+ cfg.initialization_options = Some(+ toml::Value::try_from(json!({+ "bundles": [], "settings": {"java": {"project": {"referencedLibraries": ["lib/**/*.jar"]}}}+ }))+ .unwrap(),+ );+ });+ let paths = Arc::new(Mutex::new(Some(vec!["src/main/java".into()])));+ h.mgr.set_config_hook(Box::new({+ let paths = paths.clone();+ move |cfg, _| ide_lsp::jdtls::configure_source_paths(cfg, paths.lock().clone())+ }));+ let (_, file) = h.open("Main.java", "public class Main {}");+ h.wait_status("jdtls", ServerStatus::Ready).await;+ let state = h.launcher.state("jdtls");+ let init = state.requested("initialize")[0].clone();+ assert_eq!(init["initializationOptions"]["settings"]["java"]["project"]["sourcePaths"], json!(["src/main/java"]));+ assert_eq!(init["initializationOptions"]["triggerFiles"], json!([uri_of(&file)]));+ *paths.lock() = Some(vec!["generated".into(), "tests".into()]);+ h.mgr.reconfigure().await;+ eventually(|| {+ state+ .notified("workspace/didChangeConfiguration")+ .last()+ .is_some_and(|p| p["settings"]["java"]["project"]["sourcePaths"] == json!(["generated", "tests"]))+ })+ .await;+ let notification = state.notified("workspace/didChangeConfiguration").pop().unwrap();+ assert_eq!(notification["settings"]["java"]["project"]["referencedLibraries"], json!(["lib/**/*.jar"]));+ assert_eq!(state.launches.load(Ordering::SeqCst), 1);+ state.respond("java/buildWorkspace", json!(1));+ assert_eq!(+ h.mgr.java_build(&h.root, &Default::default()).await.unwrap(),+ ide_lsp::jdtls::JavaBuildStatus::Succeeded+ );+ assert_eq!(state.requested("java/buildWorkspace"), vec![json!(false)]);++ // Removing the last hint restores importer inference. Omitting a setting+ // in didChangeConfiguration would retain jdtls's previous preference.+ *paths.lock() = None;+ h.mgr.reconfigure().await;+ eventually(|| state.launches.load(Ordering::SeqCst) == 2).await;+ h.wait_status("jdtls", ServerStatus::Ready).await;+ let init = state.requested("initialize").pop().unwrap();+ assert!(init["initializationOptions"]["settings"]["java"]["project"].get("sourcePaths").is_none());+ assert_eq!(init["initializationOptions"]["triggerFiles"], json!([uri_of(&file)]));+}++#[tokio::test(flavor = "multi_thread")]+async fn unmanaged_java_run_imports_sources_without_an_open_editor() {+ let h = harness_for("java", "java", &[("jdtls", incremental_caps())], &[]);+ std::fs::create_dir_all(h.root.join("src/demo")).unwrap();+ let file = h.root.join("src/demo/Main.java");+ std::fs::write(&file, "package demo; public class Main {}").unwrap();+ h.mgr.set_config_hook(Box::new(|cfg, _| {+ ide_lsp::jdtls::configure_source_paths(cfg, Some(vec!["src".into()]));+ }));+ let state = h.launcher.state("jdtls");+ state.respond("java/buildWorkspace", json!(1));+ assert_eq!(+ h.mgr.java_build(&h.root, &Default::default()).await.unwrap(),+ ide_lsp::jdtls::JavaBuildStatus::Succeeded+ );+ assert_eq!(state.requested("initialize")[0]["initializationOptions"]["triggerFiles"], json!([uri_of(&file)]));+ assert!(state.notified("textDocument/didOpen").is_empty());+}+#[tokio::test(flavor = "multi_thread")]async fn fallback_servers_only_run_when_the_preferred_one_is_missing() {// Preferred installed: the alternative is never started.diff --git a/crates/ide-sdk/src/java.rs b/crates/ide-sdk/src/java.rsindex 525d916f2..3bb7d2329 100644--- a/crates/ide-sdk/src/java.rs+++ b/crates/ide-sdk/src/java.rs@@ -301,8 +301,12 @@ pub fn runtimes(jdks: &[Jdk]) -> Vec<serde_json::Value> {/// Stable FNV-1a hash of a path, for per-workspace directories.fn path_key(p: &Path) -> String {+ text_key(&p.to_string_lossy())+}++fn text_key(text: &str) -> String {let mut h: u64 = 0xcbf29ce484222325;- for b in p.to_string_lossy().as_bytes() {+ for b in text.as_bytes() {h ^= *b as u64;h = h.wrapping_mul(0x100000001b3);}@@ -340,10 +344,15 @@ pub fn configure_jdtls(if !cfg.args.iter().any(|a| a == "-data") {// ECJ builds incrementally: classes compiled without (or with another) Lombok// agent would be kept, so each agent gets its own workspace and a full build.- let key = match agent {+ let mut key = match agent {Some(jar) => format!("{}-{}", path_key(server_root), path_key(jar)),None => path_key(server_root),};+ if let Some(paths) = cfg.settings.as_ref().and_then(|s| s.pointer("/java/project/sourcePaths")) {+ // Invisible projects retain a cached resource tree across restarts.+ // A different source model needs a clean import, including new folders.+ key.push_str(&format!("-sources-{}", text_key(&paths.to_string())));+ }let dir = data_dir.join("lsp").join("jdtls").join(key);cfg.args.extend(["-data".to_owned(), dir.to_string_lossy().into_owned()]);}@@ -528,6 +537,26 @@ fn parse_java_version(v: &str) -> Option<u32> {mod tests {use super::*;+ #[test]+ fn unmanaged_source_models_have_separate_jdtls_workspaces() {+ let data = tempfile::tempdir().unwrap();+ let workspace = |paths: Option<serde_json::Value>| {+ let mut cfg: LanguageServerConfig = toml::from_str("name = 'jdtls'\ncommand = 'jdtls'").unwrap();+ if let Some(paths) = paths {+ cfg.settings = Some(json!({"java": {"project": {"sourcePaths": paths}}}));+ }+ configure_jdtls(&mut cfg, Path::new("/project"), data.path(), &[], None, None, 25, &[], None);+ cfg.args.windows(2).find(|a| a[0] == "-data").unwrap()[1].clone()+ };+ let inferred = workspace(None);+ let source = workspace(Some(json!(["src/main/java"])));+ let tests = workspace(Some(json!(["src/main/java", "src/test/java"])));+ assert_ne!(inferred, source);+ assert_ne!(source, tests);+ assert_eq!(source, workspace(Some(json!(["src/main/java"]))));+ assert_eq!(inferred, workspace(None), "build-tool projects retain their existing cache key");+ }+#[test]fn provisioning_runtime_preserves_implicit_project_jdk() {let data = tempfile::tempdir().unwrap();diff --git a/crates/ide-workspace/src/roots/java.rs b/crates/ide-workspace/src/roots/java.rsnew file mode 100644index 000000000..6e5a1cfab--- /dev/null+++ b/crates/ide-workspace/src/roots/java.rs@@ -0,0 +1,111 @@+use super::{ProjectRoots, RootKind};+use ide_core::settings::ProjectStructureSettings;+use std::path::{Component, Path};++/// Source paths for jdtls's unmanaged project, relative to its workspace folder.+/// Maven, Gradle and Eclipse own their source model; other layouts retain jdtls inference.+pub fn unmanaged_java_source_paths(+ project: &Path,+ server_root: &Path,+ settings: &ProjectStructureSettings,+) -> Option<Vec<String>> {+ if ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", ".project"]+ .iter()+ .any(|name| server_root.join(name).is_file())+ {+ return None;+ }+ let roots = ProjectRoots::compute(Vec::new(), settings);+ let mut paths: Vec<String> = roots+ .roots+ .iter()+ .filter(|r| matches!(r.kind, RootKind::Source | RootKind::Test))+ .filter(|r| Path::new(&r.path).components().all(|c| matches!(c, Component::Normal(_))))+ .filter_map(|r| {+ let absolute = project.join(&r.path);+ let relative = absolute.strip_prefix(server_root).ok()?;+ let path = relative.to_string_lossy().replace('\\', "/");+ Some(if path.is_empty() { ".".into() } else { path })+ })+ .collect();+ if paths.is_empty() {+ // jdtls can infer the package directory itself as a source root. Give+ // conventional layouts an unambiguous base without guessing other layouts.+ paths = ["src/main/java", "src/test/java"]+ .into_iter()+ .filter(|p| server_root.join(p).is_dir())+ .map(str::to_owned)+ .collect();+ if paths.is_empty() && server_root.join("src").is_dir() {+ paths.push("src".into());+ }+ }+ (!paths.is_empty()).then_some(paths)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn marked_sources_and_tests_are_relative_to_the_server() {+ let dir = tempfile::tempdir().unwrap();+ let settings = ProjectStructureSettings {+ source_roots: vec!["./app/generated/".into(), "other/src".into(), "../outside".into()],+ test_roots: vec!["app/tests".into()],+ resource_roots: vec!["app/resources".into()],+ excluded: vec!["app/out".into()],+ ..Default::default()+ };+ assert_eq!(+ unmanaged_java_source_paths(dir.path(), &dir.path().join("app"), &settings),+ Some(vec!["generated".into(), "tests".into()])+ );+ let settings = ProjectStructureSettings { source_roots: vec![".".into()], ..Default::default() };+ assert_eq!(unmanaged_java_source_paths(dir.path(), dir.path(), &settings), Some(vec![".".into()]));+ }++ #[test]+ fn conventional_layouts_and_other_unmarked_projects() {+ let dir = tempfile::tempdir().unwrap();+ let root = dir.path();+ let settings = ProjectStructureSettings::default();+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), None);+ std::fs::create_dir_all(root.join("src")).unwrap();+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), Some(vec!["src".into()]));+ std::fs::create_dir_all(root.join("src/main/java")).unwrap();+ std::fs::create_dir_all(root.join("src/test/java")).unwrap();+ assert_eq!(+ unmanaged_java_source_paths(root, root, &settings),+ Some(vec!["src/main/java".into(), "src/test/java".into()])+ );+ let settings = ProjectStructureSettings { source_roots: vec!["custom".into()], ..settings };+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), Some(vec!["custom".into()]));+ }++ #[test]+ fn ant_projects_use_unmanaged_source_roots() {+ let dir = tempfile::tempdir().unwrap();+ let root = dir.path();+ std::fs::write(root.join("build.xml"), "<project/>\n").unwrap();+ std::fs::create_dir_all(root.join("src/com/acme")).unwrap();+ let settings = ProjectStructureSettings::default();+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), Some(vec!["src".into()]));+ let settings = ProjectStructureSettings { source_roots: vec!["src".into(), "generated".into()], ..settings };+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), Some(vec!["generated".into(), "src".into()]));+ }++ #[test]+ fn managed_projects_keep_their_build_model() {+ let dir = tempfile::tempdir().unwrap();+ let root = dir.path();+ let settings = ProjectStructureSettings { source_roots: vec!["custom".into()], ..Default::default() };+ for marker in+ ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", ".project"]+ {+ std::fs::write(root.join(marker), "").unwrap();+ assert_eq!(unmanaged_java_source_paths(root, root, &settings), None, "{marker}");+ std::fs::remove_file(root.join(marker)).unwrap();+ }+ }+}diff --git a/crates/ide-workspace/src/roots/mod.rs b/crates/ide-workspace/src/roots/mod.rsindex 126c5a520..8fbd07c63 100644--- a/crates/ide-workspace/src/roots/mod.rs+++ b/crates/ide-workspace/src/roots/mod.rs@@ -7,9 +7,11 @@mod detect;mod gradle;+mod java;mod maven;pub use detect::{affects_roots, detect};+pub use java::unmanaged_java_source_paths;use ide_core::settings::ProjectStructureSettings;use serde::{Deserialize, Serialize};diff --git a/languages/java.toml b/languages/java.tomlindex e8ec0caa5..7e2e87c7f 100644--- a/languages/java.toml+++ b/languages/java.toml@@ -38,6 +38,7 @@ eclipse = { downloadSources = true }references = { includeDecompiledSources = true }signatureHelp = { enabled = true }configuration = { updateBuildConfiguration = "automatic" }+project = { referencedLibraries = ["lib/**/*.jar"] }# Generated code (implement methods, getters, toString…) indents like the editor (`indent` above).format = { insertSpaces = true, tabSize = 4 }# Calls complete as `name()` with the caret inside and parameter info, not guessed arguments;