Description
Provide a generic, cross editor snippet type that can be used to express complex text insertion operations. At a minimum, these snippets should include placeholder values and indicate where the cursor should end up.
For example, snippets could fill in function call arguments with placeholders. If the user completes ad
to add
here:
function add(x, y) { return x + y; }
ad|
The inserted snippet would be:
function add(x, y) { return x + y; }
add(«x», «y»)
Where the user can tab from the placeholder values «x»
to «y».
Use Cases
- Method completions (currently implemented manually by VSCode under
useCodeSnippetsOnMethodSuggest
) - React completions — React support for useCodeSnippetsOnMethodSuggest vscode#48562
- Js doc template completions
- implement overridden method
Why is this needed
Snippets speed up coding and provide additional hints while writing code. VS Code already tries to convert TS's existing response types to snippets but fails to handle many edge cases. In order to improve reliability and support more advanced used cases such as microsoft/vscode#48562, I believe that TS needs to start generating these snippets directly