-
Notifications
You must be signed in to change notification settings - Fork 1
feature: goto definition for custom functions #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
built-in `Span` of the `simplicityhl::parse::Call` calculated as full call, with parameters and generics, so we use custom calculation of call using length of the representing string
|
Add gifs and list of features supported by the LSP to README pls |
|
Fix: Cmd + hover on the function shows funcs sig twice |
src/backend.rs
Outdated
| let document = documents.get(uri)?; | ||
|
|
||
| let token_position = params.text_document_position_params.position; | ||
| let token_span = positions_to_span((token_position, token_position)).ok()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let token_span = positions_to_span((token_position, token_position)).ok()?; | |
| let token_span = positions_to_span((token_position, token_position))?; |
Add support for:
Conversion of tower_lsp_server::lsp_types::Position to simplicityhl::error::Span
src/backend.rs
Outdated
| .iter() | ||
| .find(|function| function.name() == func)?; | ||
|
|
||
| let (start, end) = span_to_positions(function.as_ref()).ok()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/backend.rs
Outdated
| .last() | ||
| } | ||
|
|
||
| fn get_call_span(call: &simplicityhl::parse::Call) -> Option<simplicityhl::error::Span> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Result instead of Option pls
|
Is it possible to use HashMap instead of |
change to match behaviour of `hover` command, which is reduces boilerplate with `Result`, because we don't throw errors on this functions
- moved unrelated function to utils.rs - add several small unittests
it combines function and docs into one HashMap with clear interface for getting functions or docs for them
methods in `utils.rs` was returning different kind of error: `TryFromIntError` and `jsonrpc::Error` which was difficult work with. `LspError` support converting from `TryFromIntError` and to `jsonrpc::Error`
|
Use thiserror pls |
README.md
Outdated
| - Basic diagnostic for SimplicityHL code | ||
| - Completions of functions and jets | ||
|
|
||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use user attachments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add gifs directly into the repo
src/completion/mod.rs
Outdated
|
|
||
| /// Get generic functions completions. | ||
| pub fn get_function_completions(functions: &[(Function, String)]) -> Vec<CompletionItem> { | ||
| pub fn get_function_completions(functions: &Vec<(&Function, &String)>) -> Vec<CompletionItem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
src/utils.rs
Outdated
| } | ||
| }) | ||
| .filter(|(_, span)| span_contains(span, &token_span)) | ||
| .map(|(call, _)| call.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to avoid cloning?
change user attachments and moved them inside repo
KyrylR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.