-
-
Notifications
You must be signed in to change notification settings - Fork 873
feat(LS): Annotate all top level definitions
code action
#5019
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
Open
ankddev
wants to merge
17
commits into
gleam-lang:main
Choose a base branch
from
ankddev:fix-4751
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
795328c
feat: add 'Annotate all top level type definitions' code action
ankddev 7ec8174
chore: write tests + snapshots
ankddev 1193488
chore: CHANGELOG entry
ankddev a11a58d
chore: format code sample in CHANGELOG
ankddev 8daffd4
chore: remove test and snapshot
ankddev 8486ff0
fix: typo in CHANGELOG
ankddev c6e00f5
refactor: don't visit expr_fn's in code action
ankddev e6d548f
refactor: rename code action
ankddev 78f447f
test: write more tests for code action
ankddev d622179
fix(test): forgot to change selection text
ankddev 785aff9
fix(LS): make visiters ignore type variables from other definitions
ankddev ef53083
refactor: don't visit entire AST of function
ankddev eed04b3
fix(test): syntax error
ankddev 0e1691b
test: add new test with partially annotated generic function
ankddev 9110dd5
style: reformat code
ankddev 50c6440
fix: code action showed up for annotated functions
ankddev b011094
fix(test): some errors while resolving conflicts
ankddev 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
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
29 changes: 29 additions & 0 deletions
29
...s/snapshots/gleam_core__language_server__tests__action__add_multiple_annotations.snap.new
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,29 @@ | ||
--- | ||
source: compiler-core/src/language_server/tests/action.rs | ||
assertion_line: 2928 | ||
expression: "\npub const my_constant = 20\n\npub fn add_my_constant(value) {\n let result = value + my_constant\n result\n}\n" | ||
snapshot_kind: text | ||
--- | ||
----- BEFORE ACTION | ||
|
||
pub const my_constant = 20 | ||
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ | ||
|
||
pub fn add_my_constant(value) { | ||
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ | ||
let result = value + my_constant | ||
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ | ||
result | ||
▔▔▔▔▔▔▔▔ | ||
} | ||
↑ | ||
|
||
|
||
----- AFTER ACTION | ||
|
||
pub const my_constant: Int = 20 | ||
|
||
pub fn add_my_constant(value: Int) -> Int { | ||
let result = value + my_constant | ||
result | ||
} |
29 changes: 29 additions & 0 deletions
29
...am_core__language_server__tests__action__annotate_all_top_level_definitions_constant.snap
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,29 @@ | ||
--- | ||
source: compiler-core/src/language_server/tests/action.rs | ||
expression: "\npub const answer = 42\n\npub fn add_two(thing) {\n thing + 2\n}\n\npub fn add_one(thing) {\n thing + 1\n}\n" | ||
--- | ||
----- BEFORE ACTION | ||
|
||
pub const answer = 42 | ||
▔▔▔▔▔▔▔▔▔▔▔▔▔↑ | ||
|
||
pub fn add_two(thing) { | ||
thing + 2 | ||
} | ||
|
||
pub fn add_one(thing) { | ||
thing + 1 | ||
} | ||
|
||
|
||
----- AFTER ACTION | ||
|
||
pub const answer: Int = 42 | ||
|
||
pub fn add_two(thing: Int) -> Int { | ||
thing + 2 | ||
} | ||
|
||
pub fn add_one(thing: Int) -> Int { | ||
thing + 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.