0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

wip test case for lsp

This commit is contained in:
Ryan Dahl 2022-01-15 12:06:37 -05:00
parent a91fbcc4e7
commit 7619d583c4
2 changed files with 63 additions and 1 deletions

View file

@ -1542,6 +1542,68 @@ fn lsp_format_exclude_with_config() {
shutdown(&mut client);
}
#[test]
fn lsp_format_exclude_default_config() {
let temp_dir = TempDir::new().unwrap();
let workspace_root = temp_dir.path();
fs::write(
workspace_root.join("deno.json"),
br#"
{
"fmt": {
"files": {
"exclude": [ "ignored.ts" ]
}
}
}
"#,
)
.unwrap();
let mut params: lsp::InitializeParams =
serde_json::from_value(load_fixture("initialize_params.json")).unwrap();
params.root_uri = Some(Url::from_file_path(workspace_root).unwrap());
let mut client = LspClient::new(&deno_exe_path()).unwrap();
client
.write_request::<_, _, Value>("initialize", params)
.unwrap();
let file_uri =
ModuleSpecifier::from_file_path(workspace_root.join("ignored.ts")).unwrap();
fs::write(workspace_root.join("ignored.ts"), "foo").unwrap();
did_open(
&mut client,
json!({
"textDocument": {
"uri": file_uri,
"languageId": "typescript",
"version": 1,
"text": "function myFunc(){}"
}
}),
);
let (maybe_res, maybe_err) = client
.write_request(
"textDocument/formatting",
json!({
"textDocument": {
"uri": file_uri
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}),
)
.unwrap();
assert!(maybe_err.is_none());
assert_eq!(maybe_res, Some(json!(null)));
shutdown(&mut client);
}
#[test]
fn lsp_large_doc_changes() {
let mut client = init("initialize_params.json");

View file

@ -165,7 +165,7 @@ impl LspClient {
.arg("lsp")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::null())
//.stderr(Stdio::null())
.spawn()?;
let stdout = child.stdout.take().unwrap();