use super::server_spec::{LspServerSpec, ServerClient};
const DEFAULT_SERVER_PATH: &str = "jdtls";
pub struct JdtlsSpec;
impl LspServerSpec for JdtlsSpec {
const DEFAULT_SERVER_PATH: &'static str = DEFAULT_SERVER_PATH;
}
pub type JdtlsClient = ServerClient<JdtlsSpec>;
#[cfg(test)]
mod tests {
use super::*;
use crate::lsp::LspProvider;
use std::path::PathBuf;
#[test]
fn new_uses_default_server_path() {
assert_eq!(
JdtlsClient::new().server_path,
PathBuf::from(DEFAULT_SERVER_PATH)
);
}
#[test]
#[ignore = "requires jdtls on PATH; run with --ignored"]
fn integration_start_shutdown() {
if std::process::Command::new("jdtls")
.arg("--version")
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.is_err()
{
return;
}
let ws = tempfile::TempDir::new().unwrap();
std::fs::write(
ws.path().join("Test.java"),
"public class Test { public static void main(String[] args) {} }\n",
)
.unwrap();
let c = JdtlsClient::new();
c.start(ws.path()).unwrap();
c.shutdown().unwrap();
}
}