-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What changed - fix "is_cursor_within_node" function - remove "textEdit" for depends completion (not needed for now) - add tests for completions - add tests for "is_cursor_within_node" - add "get_commands" utility function - add "get_current_command" utility function - extract responses into its own module
- Loading branch information
Showing
4 changed files
with
269 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use lsp_server::Message; | ||
|
||
use crate::handler; | ||
|
||
pub fn definition_response(result: handler::DefinitionResult) -> anyhow::Result<Message> { | ||
Ok(Message::Response(lsp_server::Response { | ||
id: result.id, | ||
result: serde_json::to_value(result.value).ok(), | ||
error: None, | ||
})) | ||
} | ||
|
||
pub fn completion_response(result: handler::CompletionResult) -> Message { | ||
Message::Response(lsp_server::Response { | ||
id: result.id, | ||
result: serde_json::to_value(lsp_types::CompletionList { | ||
items: result | ||
.list | ||
.iter() | ||
.map(|c| { | ||
let mut item = lsp_types::CompletionItem { | ||
label: c.label.clone(), | ||
kind: Some(lsp_types::CompletionItemKind::KEYWORD), | ||
..Default::default() | ||
}; | ||
|
||
if let Some(documentation) = c.details.clone() { | ||
item.documentation = | ||
Some(lsp_types::Documentation::MarkupContent(lsp_types::MarkupContent { | ||
kind: lsp_types::MarkupKind::Markdown, | ||
value: documentation.clone(), | ||
})); | ||
} | ||
|
||
item | ||
}) | ||
.collect(), | ||
is_incomplete: false, | ||
}) | ||
.ok(), | ||
error: None, | ||
}) | ||
} |
Oops, something went wrong.