-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add inlay hints for function parameters #6513
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4874645
rebase master
JoshuaBatty 760a9c6
add inlay_hints test
JoshuaBatty 4921500
wip
JoshuaBatty 2a04680
test infra
JoshuaBatty 0face94
handle VariableExpression as arg
JoshuaBatty 8071436
handle function params for inlay hints
JoshuaBatty a8b60b2
Handle nested function applications
JoshuaBatty ca16acb
Refactor inlay_hints function to generate inlay hints for function ap…
JoshuaBatty 71a9567
handle_function_parameters
JoshuaBatty fb97187
rebase master
JoshuaBatty b7bf2e7
clean up
JoshuaBatty 95e423a
rebase
JoshuaBatty edcfedf
finish inlay_hints test
JoshuaBatty c0a105b
Refactor inlay hint generation to use config parameters with label tr…
JoshuaBatty bc1f7f9
rebase
JoshuaBatty 9769c83
Merge branch 'master' into josh/inlay_hints_function_params
JoshuaBatty 7115367
Merge branch 'master' into josh/inlay_hints_function_params
JoshuaBatty a91181d
Merge branch 'master' into josh/inlay_hints_function_params
IGI-111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
out | ||
target |
This file contains hidden or 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,9 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "inlay_hints" | ||
implicit-std = false | ||
|
||
[dependencies] | ||
std = { git = "https://github.com/FuelLabs/sway", tag = "v0.63.5" } |
This file contains hidden or 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,51 @@ | ||
script; | ||
|
||
const CONSTANT: u64 = 42; | ||
|
||
enum MyEnum { | ||
A: u64, | ||
} | ||
struct MyStruct { | ||
a: u64, | ||
} | ||
fn my_function(foo: u64, bar: u64, long_argument_name: u64) -> u64 { | ||
foo + bar + long_argument_name | ||
} | ||
fn identity<T>(x: T) -> T { | ||
x | ||
} | ||
fn two_generics<A, B>(_a: A, b: B) -> B { | ||
b | ||
} | ||
fn three_generics<A, B, C>(a: A, b: B, _c: C) -> B { | ||
let _a: A = a; | ||
b | ||
} | ||
|
||
fn main() { | ||
let _x = my_function(1, 2, 3); | ||
let foo = 1; | ||
let _y = my_function(foo, 2, 3); | ||
let bar = 2; | ||
let _function_call = identity(my_function(1, bar, 3)); | ||
let _z = my_function(foo, bar, 3); | ||
let long_argument_name = 3; | ||
let _w = my_function(foo, bar, long_argument_name); | ||
let _a: bool = identity(true); | ||
let _b: u32 = identity(10u32); | ||
let _c: u64 = identity(42); | ||
let _e: str = identity("foo"); | ||
let _f: u64 = two_generics(true, 10); | ||
let _g: str = three_generics(true, "foo", 10); | ||
let _const = identity(CONSTANT); | ||
let _tuple = identity((1, 2, 3)); | ||
let _array = identity([1, 2, 3]); | ||
let _enum = identity(MyEnum::A(1)); | ||
let s = MyStruct { a: 1 }; | ||
let _struct_field_access = identity(s.a); | ||
let t = (0, 1, 9); | ||
let _tuple_elem_access = identity(t.2); | ||
let a = [1, 2, 3]; | ||
let _array_index = identity(a[1]); | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.