-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-ide] Dot completion enhancements and fixes (#18522)
## Description This PR fixes dot-completion for macros: - previously when inserting method name at the callsite we would not include the `!` at the end of macro function name which could be annoying - macro parameter names (starting with `$`) did not work well with LSP snippet syntax resulting in macro parameter names not being displayed as part of the inserted snippet The PR also enhances support for macro dot-completion by expanding lambda parameters into their own snippets with placeholders for all parameters and the return value. ![image](https://github.com/MystenLabs/sui/assets/1724397/c53f83d6-5d7e-46c4-8c3c-061208526791) ![image](https://github.com/MystenLabs/sui/assets/1724397/f7917988-e052-4271-a814-403e3ee7fc53) Finally, this PR extends IDE testing framework with dot-completion tests and unifies test specifications to use 1-based (instead of 0-based) line numbers in the input to simplify addition of new tests. ## Test plan All new and existing tests must pass.
- Loading branch information
Showing
40 changed files
with
797 additions
and
776 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
11 changes: 11 additions & 0 deletions
11
external-crates/move/crates/move-analyzer/tests/completion/sources/macro_dot.move
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,11 @@ | ||
module Completion::macro_dot { | ||
public struct SomeStruct has drop {} | ||
|
||
public macro fun foo($_s: SomeStruct, $_param1: u64, $_param2: |u64, u64| -> u64 , $_param3: u64) { | ||
} | ||
|
||
public fun test(s: SomeStruct) { | ||
s. | ||
} | ||
|
||
} |
Oops, something went wrong.