rescript-vscode
rescript-vscode copied to clipboard
Type based autocompletion
Rough outline of what work to do in what order:
- [x] Type based completion for function arguments https://github.com/rescript-lang/rescript-vscode/pull/668
- [x] Complete booleans, options, variant constructors https://github.com/rescript-lang/rescript-vscode/pull/668
- [x] Type based completion for JSX props https://github.com/rescript-lang/rescript-vscode/pull/667
- [x] Support snippets in completion items https://github.com/rescript-lang/rescript-vscode/pull/668
- [x] Complete polyvariants https://github.com/rescript-lang/rescript-vscode/pull/669
- [x] Complete record construction https://github.com/rescript-lang/rescript-vscode/pull/682
- [x] Complete tuples https://github.com/rescript-lang/rescript-vscode/pull/668
- [x] Complete nested expressions when constructing values https://github.com/rescript-lang/rescript-vscode/pull/682
- [x] Complete patterns in switches https://github.com/rescript-lang/rescript-vscode/pull/670
- [x] Complete patterns when destructing https://github.com/rescript-lang/rescript-vscode/pull/670
- [x] Expand completion option items when appropriate.
Some(_)->Some(true)andSome(false)for example https://github.com/rescript-lang/rescript-vscode/pull/690 - [x] Piggy back on
Ppat_any(_) to trigger completion https://github.com/rescript-lang/rescript-vscode/pull/692 - [x] Support inline records in completion https://github.com/rescript-lang/rescript-vscode/pull/695
- [x] Handle optional record fields https://github.com/rescript-lang/rescript-vscode/pull/691
- [x] Complete functions (insert empty function) https://github.com/rescript-lang/rescript-vscode/pull/701
- [x] Complete lowercase jsx props too https://github.com/rescript-lang/rescript-vscode/pull/702
- [x] Complete using type annotations https://github.com/rescript-lang/rescript-vscode/pull/711
- [ ] "Seen idents" for more patterns
- [ ] Leverage "filterText" to ensure module names aren't included when filtering completion list (unless only searching for modules)
- [ ] Do not add "any" when inserting variant payloads in expressions
Things to figure out
- [ ] ~~Qualify JSX V3 constructors~~ Not doing this, let people upgrade to jsx v4 to fix it
- [ ] Fix
insertTextnot being used unless there's snippet support - [ ] Figure out more instances where we want to do typed expr or pattern completion
Future
- [ ] Figure out when to expand options in JSX props (read more in description of https://github.com/rescript-lang/rescript-vscode/pull/667). Will need to parse the React component
makefunction and look whether prop is optional or not.
Non-exhaustive (and living) list of things we'd like to explore:
- Complete variant/polyvariant members when assigning a labelled argument
- Complete variant/polyvariant members when passing an unnamed function parameter eg
someFunc(<complete>)(is this possible given currying etc?) - Complete variant/polyvariant members when assigning a JSX prop
- Complete missing record fields as a record is constructed
- Complete missing record fields as a record is destructured
- Complete variant/polyvariant members in switch branches
If you have ideas not listed here, please feel free to detail them!