-
-
Couldn't load subscription status.
- Fork 880
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
22
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
22 commits
Select commit
Hold shift + click to select a range
e42fc33
feat: add 'Annotate all top level type definitions' code action
ankddev c965a3e
chore: write tests + snapshots
ankddev eb0e350
chore: CHANGELOG entry
ankddev 7bcbb8b
chore: format code sample in CHANGELOG
ankddev b1f03fb
chore: remove test and snapshot
ankddev 464a0df
fix: typo in CHANGELOG
ankddev db55d88
refactor: don't visit expr_fn's in code action
ankddev a2d65a6
refactor: rename code action
ankddev 8222962
test: write more tests for code action
ankddev 0748109
fix(test): forgot to change selection text
ankddev 17ddcad
fix(LS): make visiters ignore type variables from other definitions
ankddev 600f776
refactor: don't visit entire AST of function
ankddev d6df4c1
fix(test): syntax error
ankddev 9feaa08
test: add new test with partially annotated generic function
ankddev 5586521
style: reformat code
ankddev d538983
fix: code action showed up for annotated functions
ankddev db9c434
fix(test): some errors while resolving conflicts
ankddev a41a1b2
feat: offer action on constant only if one doesn't fully annotated
ankddev f34c78f
feat: trigger code action on function only if some annotation omitted
ankddev fa0684f
fix: arguments is field and not method :)
ankddev c856e86
fix: forgot to collect filter result
ankddev 9023167
refactor: use simpler method to get head location
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.