typescript-vscode-plugins icon indicating copy to clipboard operation
typescript-vscode-plugins copied to clipboard

Automatically resolves with arguments even though it wasn't accepted with Tab

Open svipas opened this issue 2 years ago • 9 comments

Even though I don't accept new URL| (| - cursor) it automatically resolves to new URL((url)).

So then I write new URL( it becomes this:

const url = new URL((url))'http://example.com'

The question is, why it adds additional () around url and why it resolves even though I didn't accept it with Tab?

BTW: I tested same happens with JSON.parse, etc. it is just enough to add ( and it automatically resolves.

image image

svipas avatar Jul 11 '23 21:07 svipas

Maybe it's related a little bit to: https://github.com/zardoy/typescript-vscode-plugins/issues/142?

svipas avatar Jul 11 '23 21:07 svipas

See https://github.com/microsoft/vscode/issues/42544

Its also painful to write ... without shortcut inside objects (https://github.com/microsoft/TypeScript/issues/27623)

zardoy avatar Jul 11 '23 21:07 zardoy

The question is, why it adds additional () around url and why it resolves even though I didn't accept it with Tab?

You can disable it with "editor.acceptSuggestionOnCommitCharacter": false

zardoy avatar Jul 11 '23 21:07 zardoy

const url = new URL((url))'http://example.com'

However I'm not sure how 'http://example.com' inserts after `((url))``

Also, if you still prefer to use commit characters I think we can add a workaround for this issue

zardoy avatar Jul 11 '23 21:07 zardoy

Yeah if I disable it with "editor.acceptSuggestionOnCommitCharacter": false it works, but if I disable methodSnippetsInsertText it works as expected even with acceptSuggestionOnCommitCharacter enabled and it completes function arguments and fixes the problem with for e.g. new URL( except that I don't see all arguments in suggest widget.

svipas avatar Jul 12 '23 08:07 svipas