Skip to content

Commit

Permalink
[move-ide] On-hover improvements (#19437)
Browse files Browse the repository at this point in the history
## Description 

This PR improves on several instance of on-hover. 
1. Doc comments now preserves indentation

![image](https://github.com/user-attachments/assets/2380db0c-1619-4080-ba48-b438b1b7f0d5)
2. Clean up the way function signatures (in particular type params and
regular params) are displayed on-hover instead of always displaying them
on a single line:

![image](https://github.com/user-attachments/assets/17056202-4469-4ddb-a2be-a43564e7e0e2)
3. Use information about implicit modules/datatype when displaying type
information on-hover to abbreviate types by omitting package (for
implicit modules, e.g., `vector::singleton` instead of
`std::vector::singleton`) or both package and modules (for implicit
datatypes, e.g., `Option`, instead of `std::option::Option`)

![image](https://github.com/user-attachments/assets/ad639db4-a30a-4b70-852f-8614adca812f)

## Test plan 

All new and old tests must pass
  • Loading branch information
awelc authored Sep 25, 2024
1 parent 897aab2 commit fe17fe2
Show file tree
Hide file tree
Showing 26 changed files with 1,115 additions and 644 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions external-crates/move/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions external-crates/move/crates/move-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ lsp-types.workspace = true
move-command-line-common.workspace = true
move-compiler.workspace = true
move-ir-types.workspace = true
move-core-types.workspace = true
move-package.workspace = true
move-symbol-pool.workspace = true
once_cell.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publisher": "mysten",
"icon": "images/move.png",
"license": "Apache-2.0",
"version": "1.0.12",
"version": "1.0.13",
"preview": true,
"repository": {
"url": "https://github.com/MystenLabs/sui.git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ pub fn call_completion_item(
) -> CompletionItem {
let sig_string = format!(
"fun {}({}){}",
type_args_to_ide_string(type_args, /* verbose */ false),
type_list_to_ide_string(arg_types, /* verbose */ false),
type_args_to_ide_string(type_args, /* separate_lines */ false, /* verbose */ false),
type_list_to_ide_string(arg_types, /* separate_lines */ false, /* verbose */ false),
ret_type_to_ide_str(ret_type, /* verbose */ false)
);
// if it's a method call we omit the first argument which is guaranteed to be there as this is a
Expand All @@ -83,8 +83,8 @@ pub fn call_completion_item(
let macro_suffix = if is_macro { "!" } else { "" };
let label_details = Some(CompletionItemLabelDetails {
detail: Some(format!(
" ({}::{})",
mod_ident_to_ide_string(mod_ident),
" ({}{})",
mod_ident_to_ide_string(mod_ident, None, true),
function_name
)),
description: Some(sig_string),
Expand Down
Loading

0 comments on commit fe17fe2

Please sign in to comment.