Select applicable positions for lsp_ext methods more leniently (#32272)
Closes https://github.com/zed-industries/zed/issues/27238 Release Notes: - Fixed `editor::SwitchSourceHeader` and `editor::ExpandMacroRecursively` not working with text selections
This commit is contained in:
parent
6d95fd9167
commit
fa02bd71c3
4 changed files with 12 additions and 9 deletions
|
@ -7,7 +7,7 @@ use editor::{
|
|||
Editor, RowInfo,
|
||||
actions::{
|
||||
ConfirmCodeAction, ConfirmCompletion, ConfirmRename, ContextMenuFirst,
|
||||
ExpandMacroRecursively, Redo, Rename, ToggleCodeActions, Undo,
|
||||
ExpandMacroRecursively, Redo, Rename, SelectAll, ToggleCodeActions, Undo,
|
||||
},
|
||||
test::{
|
||||
editor_test_context::{AssertionContextManager, EditorTestContext},
|
||||
|
@ -2712,7 +2712,7 @@ async fn test_client_can_query_lsp_ext(cx_a: &mut TestAppContext, cx_b: &mut Tes
|
|||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(params.position, lsp::Position::new(0, 0),);
|
||||
assert_eq!(params.position, lsp::Position::new(0, 0));
|
||||
Ok(Some(ExpandedMacro {
|
||||
name: "test_macro_name".to_string(),
|
||||
expansion: "test_macro_expansion on the host".to_string(),
|
||||
|
@ -2747,7 +2747,11 @@ async fn test_client_can_query_lsp_ext(cx_a: &mut TestAppContext, cx_b: &mut Tes
|
|||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(params.position, lsp::Position::new(0, 0),);
|
||||
assert_eq!(
|
||||
params.position,
|
||||
lsp::Position::new(0, 12),
|
||||
"editor_b has selected the entire text and should query for a different position"
|
||||
);
|
||||
Ok(Some(ExpandedMacro {
|
||||
name: "test_macro_name".to_string(),
|
||||
expansion: "test_macro_expansion on the client".to_string(),
|
||||
|
@ -2756,6 +2760,7 @@ async fn test_client_can_query_lsp_ext(cx_a: &mut TestAppContext, cx_b: &mut Tes
|
|||
);
|
||||
|
||||
editor_b.update_in(cx_b, |editor, window, cx| {
|
||||
editor.select_all(&SelectAll, window, cx);
|
||||
expand_macro_recursively(editor, &ExpandMacroRecursively, window, cx)
|
||||
});
|
||||
expand_request_b.next().await.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue