Skip to content
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

Tab Completion #2

Open
Tracked by #1
z80dev opened this issue Sep 18, 2023 · 0 comments
Open
Tracked by #1

Tab Completion #2

z80dev opened this issue Sep 18, 2023 · 0 comments

Comments

@z80dev
Copy link
Collaborator

z80dev commented Sep 18, 2023

Tab Completion is a bottomless rabbithole. At its simplest implementation, we could just return a list of built-in types when a new variable is declared. At its most complex, we'd be recreating Github Copilot.

The purpose of this ticket is to find the right spot along this spectrum to target, and then track completion of our progress towards this point.

NOTE: In examples of in-editor code, the | symbol will be used to indicate cursor position|.

LSP API Methods

  • textDocument/completion

Variable Declaration Type Completion

When a user is declaring a new variable, whether at contract or local scope, we can provide a list of types, ordered by some opinionated usage-likelihood metric. For example, the most common types used are likely address, uint256, and bool. After these, its probably "custom types" (i.e. structs) used the most.

So when a user is declaring a new variable, we can present this list of types, containing any number of types, whether built-in or user-defined.

Contract Scope

# Foo.vy

owner: |

Local Scope

owner: address

@external
def foo():
    x: |
@z80dev z80dev mentioned this issue Sep 18, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant