Open Ocraftyone opened 1 year ago
Currently it seems like the parameter information is received upon completion resolution and not in the completion list. So there's not enough upfront information to commit to making the menu item a snippet, but you also can't change it later.
I wonder if actually pulling up information (or even just the bare minimum to determine whether it is a type that we will be able to query for a snippet later) about all the variables in the completion list will be a performance hit.
So there's not enough upfront information to commit to making the menu item a snippet, but you also can't change it later.
@llllvvuu , if we talk about the language service plugins, there is enough information when you request a completions list. This became possible since TS 5.0, where you can get a type of any completion, so you can resolve all method signature snippets in the list, you can look at the real implementation: https://github.com/zardoy/typescript-vscode-plugins#method-snippets . However, the main issue here is that TypeScript doesn't fully support partial completion resolving eg getCompletionEntryDetails
doesn't support a way of resolving insertText
of the requesting completion, so you can't compute this method snippet at a later stage, which is a big performance hit. On the other hand, this enables method signature preview in every completion, which is just super handy!
Auto complete the parameters of anonymous functions. JavaScript and most other languages already name the parameters when the function is defined and you can see these names while you are writing the function, but why not complete the whole statement, or at least complete the names when in the parentheses.
JavaScript already knows the param names![image](https://user-images.githubusercontent.com/24759591/200318348-912c6b23-2348-423e-9076-f291cb1227f1.png)
How IntelliJ handles it
![image](https://user-images.githubusercontent.com/24759591/200319101-f6d36933-f748-43f9-9aec-4352a7ff9113.png)