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
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
Local Scope
owner: address
@external
def foo():
x: |
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.
LSP API Methods
textDocument/completionVariable 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, andbool. 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
Local Scope