Remove hover actions heavy tests.
This commit is contained in:
parent
78c9223b7b
commit
bd9d7b6ad8
1 changed files with 0 additions and 180 deletions
|
|
@ -715,183 +715,3 @@ pub fn foo(_input: TokenStream) -> TokenStream {
|
|||
let value = res.get("contents").unwrap().get("value").unwrap().to_string();
|
||||
assert_eq!(value, r#""```rust\nfoo::Bar\n```\n\n```rust\nfn bar()\n```""#)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_client_support_hover_actions() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = Project::with_fixture(
|
||||
r#"
|
||||
//- Cargo.toml
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.0"
|
||||
|
||||
//- src/lib.rs
|
||||
struct Foo(u32);
|
||||
|
||||
struct NoImpl(u32);
|
||||
|
||||
impl Foo {
|
||||
fn new() -> Self {
|
||||
Self(1)
|
||||
}
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.with_config(|config| {
|
||||
config.client_caps.hover_actions = true;
|
||||
})
|
||||
.server();
|
||||
|
||||
server.wait_until_workspace_is_loaded();
|
||||
|
||||
// has 1 implementation
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(0, 9),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!({
|
||||
"actions": [{
|
||||
"commands": [{
|
||||
"arguments": [
|
||||
"file:///[..]src/lib.rs",
|
||||
{
|
||||
"character": 7,
|
||||
"line": 0
|
||||
},
|
||||
[{
|
||||
"range": { "end": { "character": 1, "line": 8 }, "start": { "character": 0, "line": 4 } },
|
||||
"uri": "file:///[..]src/lib.rs"
|
||||
}]
|
||||
],
|
||||
"command": "rust-analyzer.showReferences",
|
||||
"title": "1 implementation",
|
||||
"tooltip": "Go to implementations"
|
||||
}]
|
||||
}],
|
||||
"contents": { "kind": "markdown", "value": "```rust\nfoo\n```\n\n```rust\nstruct Foo\n```" },
|
||||
"range": { "end": { "character": 10, "line": 0 }, "start": { "character": 7, "line": 0 } }
|
||||
})
|
||||
);
|
||||
|
||||
// no hover
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(1, 0),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!(null),
|
||||
);
|
||||
|
||||
// no implementations
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(2, 12),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!({
|
||||
"actions": [{
|
||||
"commands": [{
|
||||
"arguments": [
|
||||
"file:///[..]src/lib.rs",
|
||||
{ "character": 7, "line": 2 },
|
||||
[]
|
||||
],
|
||||
"command": "rust-analyzer.showReferences",
|
||||
"title": "0 implementations",
|
||||
"tooltip": "Go to implementations"
|
||||
}]
|
||||
}],
|
||||
"contents": { "kind": "markdown", "value": "```rust\nfoo\n```\n\n```rust\nstruct NoImpl\n```" },
|
||||
"range": { "end": { "character": 13, "line": 2 }, "start": { "character": 7, "line": 2 } }
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_client_does_not_support_hover_actions() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = Project::with_fixture(
|
||||
r#"
|
||||
//- Cargo.toml
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.0"
|
||||
|
||||
//- src/lib.rs
|
||||
struct Foo(u32);
|
||||
|
||||
struct NoImpl(u32);
|
||||
|
||||
impl Foo {
|
||||
fn new() -> Self {
|
||||
Self(1)
|
||||
}
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.with_config(|config| {
|
||||
config.client_caps.hover_actions = false;
|
||||
})
|
||||
.server();
|
||||
|
||||
server.wait_until_workspace_is_loaded();
|
||||
|
||||
// has 1 implementation
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(0, 9),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!({
|
||||
"contents": { "kind": "markdown", "value": "```rust\nfoo\n```\n\n```rust\nstruct Foo\n```" },
|
||||
"range": { "end": { "character": 10, "line": 0 }, "start": { "character": 7, "line": 0 } }
|
||||
})
|
||||
);
|
||||
|
||||
// no hover
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(1, 0),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!(null),
|
||||
);
|
||||
|
||||
// no implementations
|
||||
server.request::<HoverRequest>(
|
||||
HoverParams {
|
||||
text_document_position_params: TextDocumentPositionParams::new(
|
||||
server.doc_id("src/lib.rs"),
|
||||
Position::new(2, 12),
|
||||
),
|
||||
work_done_progress_params: Default::default(),
|
||||
},
|
||||
json!({
|
||||
"contents": { "kind": "markdown", "value": "```rust\nfoo\n```\n\n```rust\nstruct NoImpl\n```" },
|
||||
"range": { "end": { "character": 13, "line": 2 }, "start": { "character": 7, "line": 2 } }
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue