дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-28 05:22:23 +02:00
Порівняти коміти
9
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
0ab052d48d | ||
|
|
ea8351d9f6 | ||
|
|
aab6d9ffdc | ||
|
|
72f286d619 | ||
|
|
ecb0631b89 | ||
|
|
f26d3e2612 | ||
|
|
e36cd37e56 | ||
|
|
0f652824b3 | ||
|
|
10aa367df3 |
No files matched your search
@@ -504,6 +504,9 @@ impl Session {
|
||||
|
||||
/// How long Stop waits for a launched program to exit before reporting the session ended.
|
||||
pub(crate) const DEBUGGEE_EXIT_WAIT: Duration = Duration::from_secs(10);
|
||||
/// How long a stop waits for a killed program to be gone (Windows ends processes asynchronously).
|
||||
#[cfg(windows)]
|
||||
const DEBUGGEE_KILL_WAIT: Duration = Duration::from_secs(5);
|
||||
|
||||
pub(crate) async fn remember_debuggee(s: &Arc<Session>) {
|
||||
#[cfg(windows)]
|
||||
@@ -643,14 +646,24 @@ pub(crate) async fn wait_for_debuggee(s: &Arc<Session>, terminate: bool) {
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::time::Instant;
|
||||
remember_debuggee(s).await;
|
||||
let deadline = std::time::Instant::now() + DEBUGGEE_EXIT_WAIT;
|
||||
let deadline = Instant::now() + DEBUGGEE_EXIT_WAIT;
|
||||
let mut killed: Option<Instant> = None;
|
||||
// The captured tree is the oracle when it was captured; otherwise the job (every
|
||||
// process the launch started) is, so a failed capture can no longer end the wait
|
||||
// while the program still holds its port.
|
||||
while launch_running(s) {
|
||||
if s.stop_force.swap(false, Ordering::AcqRel) || std::time::Instant::now() >= deadline {
|
||||
let now = Instant::now();
|
||||
if s.stop_force.swap(false, Ordering::AcqRel) || (killed.is_none() && now >= deadline) {
|
||||
signal_debuggee(s, true).await;
|
||||
killed.get_or_insert(now);
|
||||
}
|
||||
// Termination is asynchronous, and a process TerminateProcess can't end (stuck in
|
||||
// the kernel) would hold the stop forever: give up on it, as on Unix.
|
||||
if killed.is_some_and(|at| now.duration_since(at) >= DEBUGGEE_KILL_WAIT) {
|
||||
tracing::warn!(session = s.id.0, pid, "stop: the debugged program did not exit after it was killed");
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,17 @@ fn tools(host: &Host, window: &str) -> IdeResult<Tools> {
|
||||
Ok(project) => (project.settings.effective(), project.root.clone()),
|
||||
Err(_) => (host.global_settings.effective(), Default::default()),
|
||||
};
|
||||
let custom = settings
|
||||
let mut custom: std::collections::BTreeMap<_, _> = settings
|
||||
.tools
|
||||
.iter()
|
||||
.filter_map(|(command, t)| Some((command.clone(), ide_sdk::apply::setting_path(&root, &t.path)?)))
|
||||
.collect();
|
||||
let langs = host.languages.all();
|
||||
custom.extend(ide_sdk::apply::server_command_paths(
|
||||
langs.iter().flat_map(|l| &l.language_servers),
|
||||
&root,
|
||||
&settings,
|
||||
));
|
||||
// Godot is usually an app bundle / Flatpak outside the search path.
|
||||
let found = ide_sdk::godot::find(None).map(|p| (ide_sdk::godot::COMMAND.to_owned(), p));
|
||||
let runtime = ide_sdk::apply::tool_install_environment(&root, &settings);
|
||||
|
||||
@@ -690,7 +690,7 @@ mod tests {
|
||||
for (lang, servers) in [
|
||||
("python", vec!["basedpyright", "pyright", "ty", "pyrefly"]),
|
||||
("typescript", vec!["vtsls", "typescript-language-server"]),
|
||||
("java", vec!["jdtls", "kmp-lsp"]),
|
||||
("java", vec!["jdtls", "java-analyzer", "kmp-lsp"]),
|
||||
("kotlin", vec!["kotlin-lsp", "kotlin-language-server", "kmp-lsp"]),
|
||||
] {
|
||||
let cfg = reg.get(&LanguageId::new(lang)).unwrap();
|
||||
|
||||
@@ -1247,6 +1247,21 @@ pub fn configure_server(cfg: &mut LanguageServerConfig, root: &Path, server_root
|
||||
}
|
||||
}
|
||||
|
||||
if name == "java-analyzer" {
|
||||
// Unset, java-analyzer finds a JDK and the Maven local repository the way Maven does;
|
||||
// the server's own `initializationOptions` in settings are merged later and win.
|
||||
let mut layer = serde_json::Map::new();
|
||||
if let Some(jdk) = project_jdk(root, s) {
|
||||
layer.insert("jdkHome".into(), json!(jdk.home.to_string_lossy()));
|
||||
}
|
||||
if let Some(repo) = maven_local_repository(root, s) {
|
||||
layer.insert("maven".into(), json!({ "localRepository": repo.to_string_lossy() }));
|
||||
}
|
||||
if !layer.is_empty() {
|
||||
merge_init_options(cfg, Value::Object(layer));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(lib) = tsdk(server_root, s).or_else(|| tsdk(root, s)) {
|
||||
let lib_s = lib.to_string_lossy().into_owned();
|
||||
match name {
|
||||
@@ -1405,6 +1420,23 @@ pub fn language_servers(language: &str, defined: &[LanguageServerConfig], s: &Se
|
||||
out
|
||||
}
|
||||
|
||||
/// Built-in servers given an executable path in Settings › Language Servers, as
|
||||
/// (definition's command, path): they run that executable (see [`server_launch_overrides`]).
|
||||
pub fn server_command_paths<'a>(
|
||||
servers: impl IntoIterator<Item = &'a LanguageServerConfig>,
|
||||
root: &Path,
|
||||
s: &Settings,
|
||||
) -> Vec<(String, PathBuf)> {
|
||||
servers
|
||||
.into_iter()
|
||||
.filter_map(|server| {
|
||||
let command = s.language_servers.get(&server.name)?.command.trim();
|
||||
let path = command.contains(['/', '\\']).then(|| setting_path(root, command))??;
|
||||
Some((server.command.clone(), path))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Adds the servers defined in settings to the languages they serve (to list
|
||||
/// them with the tools); disabled ones stay so they can be turned back on.
|
||||
pub fn with_custom_servers(langs: &mut [LanguageConfig], s: &Settings) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::apply::{
|
||||
apply_to_run_configs, apply_to_run_configs_in, configure_python_extra_paths, configure_server,
|
||||
configure_vue_module_resolution, jdtls_jdk, maven_command, maven_options, project_jdk, python_interpreter,
|
||||
ruff_configuration, terminal_activation, tool_install_environment, tsdk, without_derived, without_derived_in,
|
||||
ruff_configuration, server_command_paths, server_protocol_overrides, terminal_activation, tool_install_environment,
|
||||
tsdk, without_derived, without_derived_in,
|
||||
};
|
||||
use crate::python::parse_pip_list;
|
||||
use crate::{bin_dir, exe, venv_of};
|
||||
@@ -340,6 +341,39 @@ fn jdtls_honors_the_configured_maven_local_repository() {
|
||||
assert!(cfg.args.iter().all(|a| !a.contains("maven.repo.local")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn java_analyzer_gets_the_project_jdk_and_maven_local_repository() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let configured = |s: &Settings| {
|
||||
let mut cfg = server("java-analyzer");
|
||||
configure_server(&mut cfg, tmp.path(), tmp.path(), s);
|
||||
server_protocol_overrides(&mut cfg, s);
|
||||
cfg.initialization_options.map(|v| serde_json::to_value(v).unwrap())
|
||||
};
|
||||
// Unset: the server discovers both itself.
|
||||
assert_eq!(configured(&Settings::default()), None);
|
||||
let jdk = tmp.path().join("jdk17");
|
||||
fake_jdk(&jdk);
|
||||
let repo = tmp.path().join("m2-repo");
|
||||
let mut s = Settings::default();
|
||||
s.languages.java.jdk = jdk.to_string_lossy().into_owned();
|
||||
s.languages.java.maven.local_repository = repo.to_string_lossy().into_owned();
|
||||
let options = configured(&s).unwrap();
|
||||
assert_eq!(options["jdkHome"], jdk.canonicalize().unwrap().to_string_lossy().as_ref());
|
||||
assert_eq!(options["maven"]["localRepository"], repo.to_string_lossy().as_ref());
|
||||
// A `jdkHome` in the server's own settings wins.
|
||||
s.language_servers.insert(
|
||||
"java-analyzer".into(),
|
||||
ide_core::settings::LanguageServerSettings {
|
||||
initialization_options: Some(serde_json::json!({ "jdkHome": "/opt/jdk21" })),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let options = configured(&s).unwrap();
|
||||
assert_eq!(options["jdkHome"], "/opt/jdk21");
|
||||
assert_eq!(options["maven"]["localRepository"], repo.to_string_lossy().as_ref());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn jdtls_m2e_gets_effective_settings_with_local_repository() {
|
||||
fn user_settings(cfg: &LanguageServerConfig) -> Option<std::path::PathBuf> {
|
||||
@@ -2962,3 +2996,26 @@ fn without_the_vue_plugin_the_module_resolution_plugin_stays_out() {
|
||||
assert!(!configure_vue_module_resolution(&mut cfg, tmp.path()));
|
||||
assert!(cfg.initialization_options.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn server_command_paths_report_executables_set_for_built_in_servers() {
|
||||
let servers = [server("java-analyzer"), server("jdtls"), server("kmp-lsp")];
|
||||
let mut s = Settings::default();
|
||||
let entry = |command: &str| ide_core::settings::LanguageServerSettings {
|
||||
command: command.into(),
|
||||
languages: vec!["java".into()],
|
||||
..Default::default()
|
||||
};
|
||||
s.language_servers.insert("java-analyzer".into(), entry("/opt/java-analyzer/bin/java-analyzer"));
|
||||
s.language_servers.insert("jdtls".into(), entry("bin/jdtls"));
|
||||
// A bare name is looked up like the definition's command.
|
||||
s.language_servers.insert("kmp-lsp".into(), entry("kmp-lsp-nightly"));
|
||||
let root = Path::new("/work");
|
||||
assert_eq!(
|
||||
server_command_paths(&servers, root, &s),
|
||||
[
|
||||
("java-analyzer".to_owned(), "/opt/java-analyzer/bin/java-analyzer".into()),
|
||||
("jdtls".to_owned(), root.join("bin/jdtls")),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -222,6 +222,31 @@ mod tests {
|
||||
assert_eq!(select_asset(&names[5..8], rules, WIN), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn java_analyzer_assets() {
|
||||
let names = [
|
||||
"java-analyzer-macos-aarch64.gz",
|
||||
"java-analyzer-macos-x86_64.gz",
|
||||
"java-analyzer-linux-aarch64.gz",
|
||||
"java-analyzer-linux-x86_64.gz",
|
||||
"java-analyzer-windows-aarch64.zip",
|
||||
"java-analyzer-windows-x86_64.zip",
|
||||
"java-analyzer-macos-aarch64.gz.sha256",
|
||||
"java-analyzer-windows-x86_64.zip.sha256",
|
||||
];
|
||||
let rules = crate::registry::find("java-analyzer").unwrap().asset_rules();
|
||||
for (os, arch, expected) in [
|
||||
(Os::Mac, Arch::Arm64, names[0]),
|
||||
(Os::Mac, Arch::X64, names[1]),
|
||||
(Os::Linux, Arch::Arm64, names[2]),
|
||||
(Os::Linux, Arch::X64, names[3]),
|
||||
(Os::Windows, Arch::Arm64, names[4]),
|
||||
(Os::Windows, Arch::X64, names[5]),
|
||||
] {
|
||||
assert_eq!(select_asset(&names, rules, Platform { os, arch }), Some(expected));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rosetta_fallback_and_missing() {
|
||||
let names = ["zls-x86_64-macos.tar.xz", "zls-x86_64-linux.tar.xz", "zls-x86_64-windows.zip"];
|
||||
|
||||
@@ -793,6 +793,28 @@ pub static TOOLS: &[ToolSpec] = &[
|
||||
homepage: "https://github.com/eclipse-jdtls/eclipse.jdt.ls",
|
||||
needs: &[],
|
||||
},
|
||||
ToolSpec {
|
||||
name: "java-analyzer",
|
||||
display: "java-analyzer",
|
||||
kind: LanguageServer,
|
||||
commands: &["java-analyzer"],
|
||||
method: Method::Release {
|
||||
source: ReleaseSource::GitHub { repo: "l0ng-ai/java-analyzer" },
|
||||
assets: &[
|
||||
rule(Mac, Arm64, "java-analyzer-macos-aarch64.gz"),
|
||||
rule(Mac, X64, "java-analyzer-macos-x86_64.gz"),
|
||||
rule(Linux, Arm64, "java-analyzer-linux-aarch64.gz"),
|
||||
rule(Linux, X64, "java-analyzer-linux-x86_64.gz"),
|
||||
rule(Windows, Arm64, "java-analyzer-windows-aarch64.zip"),
|
||||
rule(Windows, X64, "java-analyzer-windows-x86_64.zip"),
|
||||
],
|
||||
locate: &["java-analyzer"],
|
||||
},
|
||||
fallback: None,
|
||||
version: ver("java-analyzer"),
|
||||
homepage: "https://github.com/l0ng-ai/java-analyzer",
|
||||
needs: &[],
|
||||
},
|
||||
ToolSpec {
|
||||
name: "kmp-lsp",
|
||||
display: "kmp-lsp",
|
||||
|
||||
@@ -193,8 +193,8 @@ fn interchangeable_servers_list_their_alternatives() {
|
||||
assert_eq!(find(&list, name).alternatives, python);
|
||||
}
|
||||
assert_eq!(find(&list, "vtsls").alternatives, ["vtsls", "typescript-language-server"]);
|
||||
for name in ["jdtls", "kmp-lsp"] {
|
||||
assert_eq!(find(&list, name).alternatives, ["jdtls", "kmp-lsp"]);
|
||||
for name in ["jdtls", "java-analyzer", "kmp-lsp"] {
|
||||
assert_eq!(find(&list, name).alternatives, ["jdtls", "java-analyzer", "kmp-lsp"]);
|
||||
assert_eq!(find(&list, name).languages, if name == "kmp-lsp" { &["Java", "Kotlin"][..] } else { &["Java"] });
|
||||
}
|
||||
for name in ["kotlin-lsp", "kotlin-language-server"] {
|
||||
|
||||
@@ -128,7 +128,7 @@ The table lists every built-in language definition. Server and debugger names in
|
||||
| HTTP Request | `http` | `.http`, `.rest` | Yes | — | — | — |
|
||||
| Ignore File | `ignore` | `.gitignore`, `.dockerignore` | — | — | — | — |
|
||||
| INI | `ini` | `.ini`, `.cfg`, `.conf`, `.cnf`, `.inf`, … | Yes | — | — | — |
|
||||
| Java | `java` | `.java` | Yes | Yes | **jdtls** → **kmp-lsp** | **java-debug** |
|
||||
| Java | `java` | `.java` | Yes | Yes | **jdtls** → **java-analyzer** → **kmp-lsp** | **java-debug** |
|
||||
| JavaScript | `javascript` | `.js`, `.mjs`, `.cjs` | Yes | Yes | **vtsls** → **typescript-language-server** + **oxlint** | **js-debug** |
|
||||
| JavaScript JSX | `javascriptreact` | `.jsx` | Yes | Yes | **vtsls** → **typescript-language-server** + **oxlint** | **js-debug** |
|
||||
| JSON | `json` | `.json`, `.geojson`, `.topojson`, `.webmanifest`, `.har`, … | Yes | Yes | **vscode-json-language-server** | — |
|
||||
|
||||
@@ -7,15 +7,17 @@ Java code insight comes from the Eclipse JDT Language Server (jdtls), extended w
|
||||
|
||||
## Language servers
|
||||
|
||||
| Language | Server | Fallback | Debugger |
|
||||
| ---------------------- | ----------------------------------------- | ------------------------------------------------------------------ | --------------------------------------- |
|
||||
| Java | Eclipse JDT Language Server (`jdtls`) | `kmp-lsp` | Microsoft java-debug, loaded into jdtls |
|
||||
| Kotlin | Kotlin LSP (JetBrains, `kotlin-lsp`) | Kotlin Language Server (fwcd, `kotlin-language-server`), `kmp-lsp` | Kotlin Debug Adapter (fwcd) |
|
||||
| Groovy, Gradle scripts | `groovy-language-server` (you provide it) | | |
|
||||
| JSP | none (highlighting only) | | |
|
||||
| Language | Server | Fallback | Debugger |
|
||||
| ---------------------- | ----------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
|
||||
| Java | Eclipse JDT Language Server (`jdtls`) | `java-analyzer`, `kmp-lsp` | Microsoft java-debug, loaded into jdtls; `java-analyzer dap` with java-analyzer |
|
||||
| Kotlin | Kotlin LSP (JetBrains, `kotlin-lsp`) | Kotlin Language Server (fwcd, `kotlin-language-server`), `kmp-lsp` | Kotlin Debug Adapter (fwcd) |
|
||||
| Groovy, Gradle scripts | `groovy-language-server` (you provide it) | | |
|
||||
| JSP | none (highlighting only) | | |
|
||||
|
||||
A fallback starts only while the server listed before it is not installed. To pick one explicitly, open **Settings › Languages & Frameworks › Language Servers**, select either server and use **Language server for Java** (or Kotlin): **Automatic** uses the first one available, **None** turns code insight off. The choice can be global or for the current project.
|
||||
|
||||
`java-analyzer` is a native Java language server that needs no JVM to run. It imports Maven and Gradle projects itself (or a `java-analyzer.toml`), and also serves Run and Debug: Application configurations take their classpath from it, and debugging uses its own adapter (`java-analyzer dap`). OpenIDEA passes it the project JDK and the Maven local repository when they are set; otherwise it finds them itself.
|
||||
|
||||
`kmp-lsp` gives syntax-based Java code insight without running a JVM. It has no JDT compiler analysis, no Lombok support and none of the JDT refactorings. Building and running Java Application configurations, classpath discovery and the Java debugger need jdtls.
|
||||
|
||||
### What ships with the IDE
|
||||
@@ -43,6 +45,7 @@ When you open a Java or Kotlin file and its server is missing, a notification of
|
||||
| Kotlin LSP (JetBrains) | GitHub release of `Kotlin/kotlin-lsp` |
|
||||
| Kotlin Language Server (fwcd) | GitHub release of `fwcd/kotlin-language-server`; needs Java |
|
||||
| Kotlin Debug Adapter | GitHub release of `fwcd/kotlin-debug-adapter`; needs Java |
|
||||
| java-analyzer | GitHub release of `l0ng-ai/java-analyzer` |
|
||||
| kmp-lsp | GitHub release of `Hessesian/kmp-lsp` |
|
||||
|
||||
A `jdtls` already on your `PATH` (Homebrew, Scoop or a release archive) is used too. OpenIDEA starts it on the JVM directly instead of through its Python launcher script, so Python is not required. When you start a debug session without java-debug, the IDE offers to install it and restarts jdtls with the bundle.
|
||||
@@ -140,7 +143,7 @@ Navigation between MyBatis mapper interfaces and their XML statements is availab
|
||||
## Limitations
|
||||
|
||||
- One jdtls runs per project window. With several large projects open at once, memory adds up. Lower `-Xmx` in **JVM options** or close windows you are not using. **Share JDT LS across builds** helps only within one window.
|
||||
- Without jdtls (for example with `kmp-lsp` only), Application configurations, classpath-based features and Java debugging are not available.
|
||||
- With `kmp-lsp` only (no jdtls or java-analyzer), Application configurations, classpath-based features and Java debugging are not available.
|
||||
- Java tests run through Maven or Gradle. A project without either build tool has no test runner.
|
||||
- The jdtls compiler (ECJ) is stricter than javac in some places. Known case: a generic method call used directly as an `if`, `while`, `for` or `do` condition or a ternary condition — for example `if (getCacheObject(key))` with a `<T> T getCacheObject(String key)` method — compiles with javac but ECJ reports `Type mismatch: cannot convert from Object to boolean`. Assigning the call to a `boolean` variable first compiles on both (see [#2624](https://github.com/l0ng-ai/openidea/issues/2624)).
|
||||
- The Kotlin bridge is Maven only and exposes compiled Kotlin classes to Java. It does not give Java-to-Kotlin source navigation or refactoring.
|
||||
|
||||
@@ -123,7 +123,7 @@ IDE 安装工具从不需要 `sudo`。工具装在本地数据目录下 IDE 自
|
||||
| HTTP Request | `http` | `.http`, `.rest` | 是 | — | — | — |
|
||||
| Ignore File | `ignore` | `.gitignore`, `.dockerignore` | — | — | — | — |
|
||||
| INI | `ini` | `.ini`, `.cfg`, `.conf`, `.cnf`, `.inf`, … | 是 | — | — | — |
|
||||
| Java | `java` | `.java` | 是 | 是 | **jdtls** → **kmp-lsp** | **java-debug** |
|
||||
| Java | `java` | `.java` | 是 | 是 | **jdtls** → **java-analyzer** → **kmp-lsp** | **java-debug** |
|
||||
| JavaScript | `javascript` | `.js`, `.mjs`, `.cjs` | 是 | 是 | **vtsls** → **typescript-language-server** + **oxlint** | **js-debug** |
|
||||
| JavaScript JSX | `javascriptreact` | `.jsx` | 是 | 是 | **vtsls** → **typescript-language-server** + **oxlint** | **js-debug** |
|
||||
| JSON | `json` | `.json`, `.geojson`, `.topojson`, `.webmanifest`, `.har`, … | 是 | 是 | **vscode-json-language-server** | — |
|
||||
|
||||
@@ -7,15 +7,17 @@ Java 的代码智能由 Eclipse JDT Language Server(jdtls)提供,OpenIDEA
|
||||
|
||||
## 语言服务器
|
||||
|
||||
| 语言 | 服务器 | 备选 | 调试器 |
|
||||
| ------------------- | -------------------------------------- | ------------------------------------------------------------------- | ------------------------------------- |
|
||||
| Java | Eclipse JDT Language Server(`jdtls`) | `kmp-lsp` | Microsoft java-debug,加载在 jdtls 内 |
|
||||
| Kotlin | Kotlin LSP(JetBrains,`kotlin-lsp`) | Kotlin Language Server(fwcd,`kotlin-language-server`)、`kmp-lsp` | Kotlin Debug Adapter(fwcd) |
|
||||
| Groovy、Gradle 脚本 | `groovy-language-server`(需自行提供) | | |
|
||||
| JSP | 无(仅语法高亮) | | |
|
||||
| 语言 | 服务器 | 备选 | 调试器 |
|
||||
| ------------------- | -------------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| Java | Eclipse JDT Language Server(`jdtls`) | `java-analyzer`、`kmp-lsp` | Microsoft java-debug,加载在 jdtls 内;用 java-analyzer 时为 `java-analyzer dap` |
|
||||
| Kotlin | Kotlin LSP(JetBrains,`kotlin-lsp`) | Kotlin Language Server(fwcd,`kotlin-language-server`)、`kmp-lsp` | Kotlin Debug Adapter(fwcd) |
|
||||
| Groovy、Gradle 脚本 | `groovy-language-server`(需自行提供) | | |
|
||||
| JSP | 无(仅语法高亮) | | |
|
||||
|
||||
备选服务器只在排在它前面的服务器未安装时才会启动。想手动指定,打开 **设置 › 语言和框架 › 语言服务器**,选中其中一个服务器,在 **Java 语言服务器**(或 Kotlin 语言服务器)里选择:**自动** 使用第一个可用的,**无** 关闭代码智能。这个选择可以全局生效,也可以只对当前项目生效。
|
||||
|
||||
`java-analyzer` 是原生的 Java 语言服务器,运行时不需要 JVM。它自己导入 Maven 和 Gradle 项目(或 `java-analyzer.toml`),也支撑运行和调试:“应用程序”配置从它获取类路径,调试使用它自带的调试适配器(`java-analyzer dap`)。设置了项目 JDK 和 Maven 本地仓库时,OpenIDEA 会把它们传给 java-analyzer,否则它自己查找。
|
||||
|
||||
`kmp-lsp` 不运行 JVM,提供基于语法的 Java 代码智能,没有 JDT 的编译分析、Lombok 支持和 JDT 的重构。构建和运行 Java “应用程序”配置、类路径发现以及 Java 调试器都需要 jdtls。
|
||||
|
||||
### 随 IDE 提供的部分
|
||||
@@ -43,6 +45,7 @@ Java 的代码智能由 Eclipse JDT Language Server(jdtls)提供,OpenIDEA
|
||||
| Kotlin LSP(JetBrains) | `Kotlin/kotlin-lsp` 的 GitHub release |
|
||||
| Kotlin Language Server(fwcd) | `fwcd/kotlin-language-server` 的 GitHub release,需要 Java |
|
||||
| Kotlin Debug Adapter | `fwcd/kotlin-debug-adapter` 的 GitHub release,需要 Java |
|
||||
| java-analyzer | `l0ng-ai/java-analyzer` 的 GitHub release |
|
||||
| kmp-lsp | `Hessesian/kmp-lsp` 的 GitHub release |
|
||||
|
||||
`PATH` 上已有的 `jdtls`(Homebrew、Scoop 或 release 压缩包)也能直接用。OpenIDEA 直接在 JVM 上启动它,不经过它自带的 Python 启动脚本,所以不需要装 Python。没装 java-debug 就开始调试时,IDE 会提示安装,并带着这个 bundle 重启 jdtls。
|
||||
@@ -140,7 +143,7 @@ MyBatis mapper 接口与 XML 语句之间的跳转由 MyBatis Navigator 插件
|
||||
## 已知限制
|
||||
|
||||
- 每个项目窗口运行一个 jdtls,同时打开多个大项目时内存会叠加。可以在 **JVM 选项** 中调低 `-Xmx`,或关闭暂时不用的窗口。**在构建间共享 JDT LS** 只在单个窗口内有效。
|
||||
- 没有 jdtls 时(例如只用 `kmp-lsp`),“应用程序”配置、依赖类路径的功能和 Java 调试都不可用。
|
||||
- 只用 `kmp-lsp`(没有 jdtls 或 java-analyzer)时,“应用程序”配置、依赖类路径的功能和 Java 调试都不可用。
|
||||
- Java 测试通过 Maven 或 Gradle 运行,两者都没有的项目没有测试运行器。
|
||||
- jdtls 自带的 ECJ 编译器有些地方比 javac 严格。已知例子:把泛型方法调用直接用作 `if`、`while`、`for`、`do` 条件或三元运算符条件——例如 `<T> T getCacheObject(String key)` 方法配合 `if (getCacheObject(key))`——javac 可以编译,ECJ 则报 `Type mismatch: cannot convert from Object to boolean`。先把调用赋值给 `boolean` 变量即可两边都编译通过(见 [#2624](https://github.com/l0ng-ai/openidea/issues/2624))。
|
||||
- Kotlin 桥接只支持 Maven,只把编译后的 Kotlin 类暴露给 Java,不提供从 Java 到 Kotlin 源码的跳转或重构。
|
||||
|
||||
@@ -70,6 +70,15 @@ exclusions = ["**/node_modules/**", "**/.metadata/**", "**/archetype-resources/*
|
||||
maven = { enabled = true }
|
||||
gradle = { enabled = true, wrapper = { enabled = true } }
|
||||
|
||||
# java-analyzer: a native Java server that imports Maven / Gradle builds itself and
|
||||
# also serves debugging (`java-analyzer dap`) and the run classpath without jdtls.
|
||||
[[language-servers]]
|
||||
name = "java-analyzer"
|
||||
fallback = true
|
||||
command = "java-analyzer"
|
||||
root-markers = ["java-analyzer.toml", "pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", "build.xml", ".project"]
|
||||
install-hint = "Install java-analyzer in Settings › Languages & Frameworks › Language Servers (https://github.com/l0ng-ai/java-analyzer)"
|
||||
|
||||
[[language-servers]]
|
||||
name = "kmp-lsp"
|
||||
fallback = true
|
||||
|
||||
@@ -223,6 +223,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
|
||||
vec![
|
||||
act("file.newProject", "Project…"),
|
||||
act("workspace.create", "Workspace…"),
|
||||
act("vcs.cloneProject", "Project from Version Control…"),
|
||||
SEP,
|
||||
act("file.new", "File…"),
|
||||
act("file.newScratchFile", "Scratch File"),
|
||||
@@ -2014,7 +2015,14 @@ mod tests {
|
||||
};
|
||||
assert_eq!(
|
||||
action_ids(new),
|
||||
["file.newProject", "workspace.create", "file.new", "file.newScratchFile", "file.newUntitled"],
|
||||
[
|
||||
"file.newProject",
|
||||
"workspace.create",
|
||||
"vcs.cloneProject",
|
||||
"file.new",
|
||||
"file.newScratchFile",
|
||||
"file.newUntitled"
|
||||
],
|
||||
"{os:?}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -337,6 +337,20 @@ export function targetOf(id: string, database: string | null, current: string |
|
||||
/** Key of the Database tree node of database `name` of data source `id`. */
|
||||
export const databaseKey = (id: string, name: string) => `${id}/@${name}`;
|
||||
|
||||
/**
|
||||
* `expanded` without the Database tree nodes that show what target `id` loaded (a data source
|
||||
* id: the source and all its databases). Once that is forgotten, an expanded node would wait
|
||||
* for children nothing loads until it is expanded again.
|
||||
*/
|
||||
export function collapseTarget(expanded: ReadonlySet<string>, id: string): Set<string> {
|
||||
const { id: source, database } = splitTarget(id);
|
||||
const under = (key: string, node: string) => key === node || key.startsWith(`${node}/`);
|
||||
const shows = database
|
||||
? (key: string) => under(key, databaseKey(source, database)) || under(key, id)
|
||||
: (key: string) => under(key, source) || key.startsWith(`${source}:`);
|
||||
return new Set([...expanded].filter((key) => !shows(key)));
|
||||
}
|
||||
|
||||
const SSL_MODES: Record<string, DbSslMode> = {
|
||||
disable: "disable",
|
||||
disabled: "disable",
|
||||
|
||||
@@ -274,6 +274,31 @@ describe("database metadata request lifetimes", () => {
|
||||
expect(useDatabase.getState().connected.has("pg:app")).toBe(false);
|
||||
});
|
||||
|
||||
it("collapses the tree nodes of what a disconnect forgets", async () => {
|
||||
const tree = [
|
||||
"pg",
|
||||
"pg/@app",
|
||||
"pg/public",
|
||||
"pg/public/tables",
|
||||
"pg:other/public",
|
||||
"pg/@other",
|
||||
"pg2",
|
||||
"pg2/public",
|
||||
];
|
||||
useDatabase.setState({ treeExpanded: new Set(tree) });
|
||||
await disconnect("pg:other");
|
||||
expect([...useDatabase.getState().treeExpanded]).toEqual([
|
||||
"pg",
|
||||
"pg/@app",
|
||||
"pg/public",
|
||||
"pg/public/tables",
|
||||
"pg2",
|
||||
"pg2/public",
|
||||
]);
|
||||
await disconnect("pg");
|
||||
expect([...useDatabase.getState().treeExpanded]).toEqual(["pg2", "pg2/public"]);
|
||||
});
|
||||
|
||||
it("disconnects one database without invalidating its sibling", async () => {
|
||||
const response = deferred();
|
||||
backend.schemas.mockReturnValueOnce(response.promise);
|
||||
@@ -334,11 +359,14 @@ describe("database metadata request lifetimes", () => {
|
||||
});
|
||||
|
||||
describe("connection and metadata continuations", () => {
|
||||
it("reloads every level the tree had expanded after a data source is edited", async () => {
|
||||
it.each([
|
||||
["edited", () => saveSource({ ...pg, host: "new-host" }, undefined)],
|
||||
["renamed", () => renameSource("pg", "Renamed")],
|
||||
])("reloads every level the tree had expanded after a data source is %s", async (_, change) => {
|
||||
await loadSchemas("pg");
|
||||
await loadTables("pg", "public");
|
||||
await loadDetails("pg", "public", "users");
|
||||
await saveSource({ ...pg, host: "new-host" }, undefined);
|
||||
await change();
|
||||
const st = useDatabase.getState();
|
||||
expect(st.schemas.pg).toEqual({ status: "ok", value: ["public"] });
|
||||
expect(st.tables["pg\u0000public"]?.status).toBe("ok");
|
||||
|
||||
@@ -38,6 +38,7 @@ import { workflowSettings } from "@/platform/workflowSettings";
|
||||
import { ask, confirm } from "@/workbench/messages";
|
||||
import {
|
||||
activeSchema,
|
||||
collapseTarget,
|
||||
colorVar,
|
||||
connectRemedy,
|
||||
databaseKey,
|
||||
@@ -437,12 +438,8 @@ export async function duplicateSource(id: string): Promise<void> {
|
||||
export async function renameSource(id: string, name: string): Promise<void> {
|
||||
const src = sourceById(id);
|
||||
if (!src || !name.trim() || name.trim() === src.name) return;
|
||||
const sources = useDatabase.getState().sources.map((s) => (s.id === src.id ? { ...s, name: name.trim() } : s));
|
||||
forget(id);
|
||||
const current = sourceMutation(id);
|
||||
await call(commands.dbSaveSources(sources));
|
||||
if (!current()) return;
|
||||
await loadSources();
|
||||
// Saved like any edit, so what the tree had loaded under the source is loaded again.
|
||||
await saveSource({ ...src, name: name.trim() }, undefined);
|
||||
}
|
||||
|
||||
/** Removes the data source after asking (Database tree › Drop on a source). */
|
||||
@@ -572,6 +569,7 @@ export async function disconnect(id: string): Promise<void> {
|
||||
if (!targets.includes(id)) targets.push(id);
|
||||
const current = projectRequest();
|
||||
forget(id);
|
||||
useDatabase.setState((s) => ({ treeExpanded: collapseTarget(s.treeExpanded, id) }));
|
||||
const intent = {};
|
||||
for (const target of targets) connectionIntents.set(target, intent);
|
||||
if (!splitTarget(id).database) sourceConnectionIntents.set(id, {});
|
||||
|
||||
@@ -776,6 +776,36 @@ describe("project producers", () => {
|
||||
expect(produceContext({ path: `${ROOT}/a.tscn`, root: ROOT, configs: [] }, OPTIMISTIC)).toBeNull();
|
||||
});
|
||||
|
||||
it("Dart files of a Flutter app run as the app (flutter run -t) in the app's folder", () => {
|
||||
const flutter = [
|
||||
cfg({ id: "flutter:run", kind: "flutter", command: "flutter", args: ["run", "-t", "lib/main.dart"], cwd: "app" }),
|
||||
];
|
||||
const p = produceContext({ path: `${ROOT}/app/lib/demo.dart`, root: ROOT, configs: flutter }, ALL)!;
|
||||
expect(p).toMatchObject({ name: "demo.dart", scope: "file" });
|
||||
expect(p.config).toMatchObject({
|
||||
kind: "flutter",
|
||||
command: "flutter",
|
||||
args: ["run", "-t", "lib/demo.dart"],
|
||||
cwd: "app",
|
||||
debugAdapter: "dart",
|
||||
});
|
||||
// Its tests run with `flutter test`, a Dart package's with `dart test`.
|
||||
expect(run({ path: `${ROOT}/app/test/widget_test.dart`, root: ROOT, configs: flutter })).toMatchObject({
|
||||
command: "flutter",
|
||||
args: ["test", "test/widget_test.dart"],
|
||||
cwd: "app",
|
||||
});
|
||||
expect(run({ path: `${ROOT}/tool/test/gen_test.dart`, root: ROOT, configs: flutter })).toMatchObject({
|
||||
command: "/bin/dart",
|
||||
args: ["test", "tool/test/gen_test.dart"],
|
||||
});
|
||||
// Outside the app (a Dart package next to it): `dart run`.
|
||||
expect(run({ path: `${ROOT}/tool/gen.dart`, root: ROOT, configs: flutter })).toMatchObject({
|
||||
command: "/bin/dart",
|
||||
args: ["run", "tool/gen.dart"],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps package.json test files on the project's runner", () => {
|
||||
const p = produceContext(
|
||||
{ path: `${ROOT}/src/a.test.ts`, root: ROOT, configs, content: "test('x', () => {})" },
|
||||
|
||||
@@ -438,6 +438,7 @@ function site(input: ContextInput): FileSite {
|
||||
ruby: ["ruby", "rake", "rspec"],
|
||||
php: ["php", "phpunit", "composer"],
|
||||
zig: ["zig", "zig-application"],
|
||||
dart: ["flutter"],
|
||||
};
|
||||
const owner =
|
||||
inside && language
|
||||
@@ -992,8 +993,27 @@ export function produceFile(input: ContextInput, env: ToolEnv): Produced | null
|
||||
return simple(lang, s, env, lang, () => [s.arg]);
|
||||
case "r":
|
||||
return simple(lang, s, env, "r", () => [s.arg]);
|
||||
case "dart":
|
||||
case "dart": {
|
||||
// A file of a Flutter app runs as the app (`flutter run -t`), on the toolbar's device.
|
||||
const app = s.inProject
|
||||
? allClosest(
|
||||
input.configs.filter((c) => c.kind === "flutter"),
|
||||
s.idPath,
|
||||
)[0]
|
||||
: undefined;
|
||||
// A test file runs its tests (`flutter test` / `dart test`); `dart run` can't run Flutter code.
|
||||
const test = /_test\.dart$/.test(s.file);
|
||||
if (app && test)
|
||||
return { name: s.file, scope: "file", config: fileConfig(s, "dart", app.command, ["test", s.arg]) };
|
||||
if (app)
|
||||
return {
|
||||
name: s.file,
|
||||
scope: "file",
|
||||
config: fileConfig(s, "flutter", app.command, ["run", "-t", s.arg], "dart"),
|
||||
};
|
||||
if (test) return simple(lang, s, env, "dart", () => ["test", s.arg]);
|
||||
return simple(lang, s, env, "dart", () => ["run", s.arg], "dart");
|
||||
}
|
||||
case "scala":
|
||||
return simple(lang, s, env, "scala-cli", () => ["run", s.arg]);
|
||||
case "kotlin":
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const backend = vi.hoisted(() => ({ snapshot: vi.fn(), events: vi.fn(), cancel: vi.fn(), settings: vi.fn() }));
|
||||
vi.mock("@tauri-apps/api/core", () => ({ Channel: class {} }));
|
||||
vi.mock("@/platform/ipc", async (original) => ({
|
||||
...(await original<typeof import("@/platform/ipc")>()),
|
||||
isTauri: () => true,
|
||||
commands: {
|
||||
dockerSettings: backend.settings,
|
||||
dockerSnapshot: backend.snapshot,
|
||||
dockerEvents: backend.events,
|
||||
cancelRequest: backend.cancel,
|
||||
},
|
||||
}));
|
||||
import { connectConnection, connectionState, disconnectConnection, refresh, useServices, watch } from "./store";
|
||||
|
||||
const ready = { availability: { kind: "ready", context: null }, errors: [] };
|
||||
const ok = <T>(data: T) => ({ status: "ok" as const, data });
|
||||
|
||||
beforeEach(() => {
|
||||
for (const f of Object.values(backend)) f.mockReset();
|
||||
backend.snapshot.mockResolvedValue(ok(ready));
|
||||
backend.events.mockReturnValue(new Promise(() => {}));
|
||||
backend.settings.mockResolvedValue(
|
||||
ok({ connections: [{ id: "box", name: "Box", endpoint: { kind: "default" } }], registries: [] }),
|
||||
);
|
||||
useServices.setState({
|
||||
settings: { connections: [{ id: "box", name: "Box", endpoint: { kind: "default" } }], registries: [] } as never,
|
||||
conns: {},
|
||||
});
|
||||
});
|
||||
|
||||
describe("Docker connections", () => {
|
||||
it("stop talking to the daemon while disconnected, and connect again on Connect", async () => {
|
||||
const stop = watch();
|
||||
await vi.waitFor(() => expect(connectionState("box").snapshot).not.toBeNull());
|
||||
expect(backend.events).toHaveBeenCalledOnce();
|
||||
|
||||
disconnectConnection("box");
|
||||
expect(backend.cancel).toHaveBeenCalledOnce();
|
||||
expect(connectionState("box")).toMatchObject({ snapshot: null, disconnected: true });
|
||||
backend.snapshot.mockClear();
|
||||
await refresh("box");
|
||||
expect(backend.snapshot).not.toHaveBeenCalled();
|
||||
|
||||
await connectConnection("box");
|
||||
expect(backend.snapshot).toHaveBeenCalledOnce();
|
||||
expect(connectionState("box")).toMatchObject({ disconnected: false, snapshot: ready });
|
||||
stop();
|
||||
});
|
||||
});
|
||||
@@ -74,7 +74,9 @@ import {
|
||||
} from "./ops";
|
||||
import {
|
||||
cancelTask,
|
||||
connectConnection,
|
||||
connectionState,
|
||||
disconnectConnection,
|
||||
endpointOf,
|
||||
errorMessage,
|
||||
refresh,
|
||||
@@ -110,6 +112,7 @@ function endpointText(ep: DockerEndpoint): string {
|
||||
}
|
||||
|
||||
function connectionDetail(state: ConnectionState): string | undefined {
|
||||
if (state.disconnected) return "disconnected";
|
||||
const a = state.snapshot?.availability;
|
||||
if (!a) return state.error ?? (state.loading ? "connecting…" : undefined);
|
||||
if (a.kind === "notInstalled") return "docker not installed";
|
||||
@@ -250,6 +253,9 @@ function menu(item: ServiceTreeItem): MenuItem[] {
|
||||
if (c)
|
||||
items.push(
|
||||
{ kind: "separator" },
|
||||
connectionState(c.id).disconnected
|
||||
? { label: "Connect", run: () => void connectConnection(c.id) }
|
||||
: { label: "Disconnect", run: () => disconnectConnection(c.id) },
|
||||
{ label: "Edit Connection…", icon: "edit", run: () => openConnectionDialog(c) },
|
||||
{ label: "Remove Connection", icon: "trash", danger: true, run: () => void removeConnectionPrompt(c) },
|
||||
);
|
||||
@@ -439,6 +445,13 @@ function DockerDetail({ item }: { item: ServiceTreeItem }) {
|
||||
if (!target || !parsed || !state || !node) return <EmptyState title="Select service to view details" />;
|
||||
const conn = connectionOf(parsed.conn);
|
||||
const snapshot = state.snapshot;
|
||||
if (state.disconnected)
|
||||
return (
|
||||
<EmptyState
|
||||
title="Disconnected"
|
||||
actions={<Button onClick={() => void connectConnection(parsed.conn)}>Connect</Button>}
|
||||
/>
|
||||
);
|
||||
if (!snapshot)
|
||||
return (
|
||||
<div className={styles.loading}>
|
||||
|
||||
@@ -52,7 +52,15 @@ import {
|
||||
} from "./ops";
|
||||
import { SERVICES_VIEW_FOCUS, ServicesTreeView, showAddServiceMenu } from "./ServicesTree";
|
||||
import { ServicesHeaderActions, ServicesHost, ServicesTabs } from "./ServicesHost";
|
||||
import { connections, refresh, setDockerFilters, useServices } from "./store";
|
||||
import {
|
||||
connectConnection,
|
||||
connectionState,
|
||||
connections,
|
||||
disconnectConnection,
|
||||
refresh,
|
||||
setDockerFilters,
|
||||
useServices,
|
||||
} from "./store";
|
||||
import { SERVICES_TREE_VIEW } from "./tree";
|
||||
import { isRunning } from "./model";
|
||||
import type { PruneTarget } from "@/platform/ipc";
|
||||
@@ -143,6 +151,26 @@ export function activate(): () => void {
|
||||
when: PROJECT,
|
||||
run: () => refresh(),
|
||||
},
|
||||
{
|
||||
id: "docker.connect",
|
||||
title: "Connect to Docker",
|
||||
category: "Docker",
|
||||
when: PROJECT,
|
||||
run: () => {
|
||||
const id = currentConnection();
|
||||
if (id && connectionState(id).disconnected) void connectConnection(id);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "docker.disconnect",
|
||||
title: "Disconnect from Docker",
|
||||
category: "Docker",
|
||||
when: PROJECT,
|
||||
run: () => {
|
||||
const id = currentConnection();
|
||||
if (id && !connectionState(id).disconnected) disconnectConnection(id);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "docker.start",
|
||||
title: "Start Container",
|
||||
|
||||
@@ -58,6 +58,8 @@ export interface ConnectionState {
|
||||
snapshot: DockerSnapshot | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
/** Disconnected for this session: no snapshots, events or polling until Connect. */
|
||||
disconnected?: boolean;
|
||||
}
|
||||
|
||||
interface DockerState {
|
||||
@@ -231,6 +233,7 @@ const again = new Set<string>();
|
||||
export function refresh(id?: string): Promise<void> {
|
||||
if (!isTauri()) return Promise.resolve();
|
||||
if (id === undefined) return Promise.all(connections().map((c) => refresh(c.id))).then(() => undefined);
|
||||
if (connectionState(id).disconnected) return Promise.resolve();
|
||||
const running = inflight.get(id);
|
||||
if (running) {
|
||||
again.add(id);
|
||||
@@ -239,12 +242,14 @@ export function refresh(id?: string): Promise<void> {
|
||||
patchConn(id, { loading: true });
|
||||
const p = call(commands.dockerSnapshot(endpointOf(id)))
|
||||
.then((snapshot) => {
|
||||
if (!connections().some((c) => c.id === id)) return;
|
||||
if (!connections().some((c) => c.id === id) || connectionState(id).disconnected) return;
|
||||
const wasReady = connectionState(id).snapshot?.availability.kind === "ready";
|
||||
patchConn(id, { snapshot, error: null });
|
||||
if (snapshot.availability.kind === "ready" && !wasReady) startEvents(id);
|
||||
})
|
||||
.catch((e) => patchConn(id, { error: errorMessage(e) }))
|
||||
.catch((e) => {
|
||||
if (!connectionState(id).disconnected) patchConn(id, { error: errorMessage(e) });
|
||||
})
|
||||
.finally(() => {
|
||||
inflight.delete(id);
|
||||
if (connections().some((c) => c.id === id)) patchConn(id, { loading: false });
|
||||
@@ -268,7 +273,7 @@ let pollTimer: ReturnType<typeof setInterval> | undefined;
|
||||
let watchers = 0;
|
||||
|
||||
function startEvents(id: string) {
|
||||
if (events.has(id) || watchers === 0) return;
|
||||
if (events.has(id) || watchers === 0 || connectionState(id).disconnected) return;
|
||||
const request = nextRequestId();
|
||||
events.set(id, request);
|
||||
const channel = new Channel<DockerEvent>();
|
||||
@@ -315,6 +320,22 @@ export function watch(): () => void {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect: stops talking to the connection's daemon (its event stream and polling; for an
|
||||
* SSH connection, the SSH sessions they open) until Connect. Not saved: a new session connects.
|
||||
*/
|
||||
export function disconnectConnection(id: string): void {
|
||||
stopEvents(id);
|
||||
clearTimeout(debounces.get(id));
|
||||
again.delete(id);
|
||||
patchConn(id, { snapshot: null, error: null, loading: false, disconnected: true });
|
||||
}
|
||||
|
||||
export function connectConnection(id: string): Promise<void> {
|
||||
patchConn(id, { disconnected: false });
|
||||
return refresh(id);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Operations
|
||||
|
||||
|
||||
@@ -291,6 +291,15 @@ export function registerVcsActions(): () => void {
|
||||
keywords: ["clone", "checkout", "git"],
|
||||
run: (c) => showCloneDialog(typeof c.arg === "string" ? c.arg : ""),
|
||||
},
|
||||
{
|
||||
// File › New › Project from Version Control: the same dialog, under the name the File menu uses.
|
||||
id: "vcs.cloneProject",
|
||||
title: "Project from Version Control…",
|
||||
category: "File",
|
||||
icon: "git-pull",
|
||||
keywords: ["clone", "checkout", "git", "new project"],
|
||||
run: () => showCloneDialog(""),
|
||||
},
|
||||
{
|
||||
id: "vcs.push",
|
||||
title: "Push…",
|
||||
|
||||
@@ -201,6 +201,7 @@
|
||||
"menu.file.newScratchFile": "Scratch File",
|
||||
"menu.new": "New",
|
||||
"menu.workspace.create": "Workspace…",
|
||||
"menu.vcs.cloneProject": "Project from Version Control…",
|
||||
"menu.workspace.open": "Open Workspace…",
|
||||
"menu.workspace.manage": "Manage Workspace…",
|
||||
"menu.file.newUntitled": "Untitled File",
|
||||
|
||||
@@ -1089,6 +1089,11 @@
|
||||
"Conflicts": "冲突",
|
||||
"Conflicts:": "冲突:",
|
||||
"Connect": "连接",
|
||||
"Connect to Docker": "连接到 Docker",
|
||||
"Disconnect": "断开连接",
|
||||
"Disconnect from Docker": "断开与 Docker 的连接",
|
||||
"Disconnected": "已断开连接",
|
||||
"disconnected": "已断开连接",
|
||||
"Connected": "已连接",
|
||||
"Conda Environment": "Conda 环境",
|
||||
"Connecting to Docker…": "正在连接 Docker…",
|
||||
@@ -1514,6 +1519,7 @@
|
||||
"Generate Requests for Controller": "为控制器生成请求",
|
||||
"Generate…": "生成…",
|
||||
"Get from Version Control…": "从版本控制获取…",
|
||||
"Project from Version Control…": "来自版本控制的项目…",
|
||||
"Gevent compatible": "兼容 Gevent",
|
||||
"Git Branches": "Git 分支",
|
||||
"Git Log": "Git 日志",
|
||||
|
||||
@@ -201,6 +201,7 @@
|
||||
"menu.file.newScratchFile": "临时文件",
|
||||
"menu.new": "新建",
|
||||
"menu.workspace.create": "工作区…",
|
||||
"menu.vcs.cloneProject": "来自版本控制的项目…",
|
||||
"menu.workspace.open": "打开工作区…",
|
||||
"menu.workspace.manage": "管理工作区…",
|
||||
"menu.file.newUntitled": "无标题文件",
|
||||
|
||||
Reference in new issue
Заблокувати користувача