Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tab Completion #2

@z80dev

Description

@z80dev

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: |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions