vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

Add placeholder text for protocol requirements

Open nguyenvanzk opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. When add missing protocol requirements, it will add plain text <#code#> instead of placeholder text (can do navigation by tab and delete easily ) to code.

Describe the solution you'd like Add placeholder text like this https://www.youtube.com/watch?v=0XMkg_i5Fqw

Additional context image

nguyenvanzk avatar Apr 22 '22 10:04 nguyenvanzk

Just had a chat with sourcekit-lsp guys and they are going to file a bug internally against sourcekit-lsp to return the correct text for LSP placeholder snippets.

adam-fowler avatar Apr 22 '22 10:04 adam-fowler

This PR in sourcekit-lsp should fix your issue https://github.com/apple/sourcekit-lsp/pull/481. Although I doubt we will see this until Swift 5.7

adam-fowler avatar Apr 27 '22 07:04 adam-fowler

We might be able to get it in a monthly Linux release

0xTim avatar Apr 27 '22 07:04 0xTim

We might, but I'd like to reserve my requests, to push to 5.6, for more serious issues, like https://github.com/apple/sourcekit-lsp/pull/476. If I ask for everything to be pushed to 5.6 they'll very quickly get tired of that and the release managers will start pushing back on what could be more serious issues.

adam-fowler avatar Apr 27 '22 07:04 adam-fowler

I had a further look into this, and snippets are not supported by textDocument/didChange messages. So unfortunately this does not work.

There is also the issue that tabbing between placeholders would be awkward because the placeholders will be replaced by code, which could contain tabs. I doubt users will want to move to the next placeholder if they are in the middle of writing a function.

For the immediate future sourcekit-lsp is going to get rid of the <#code#> text.

adam-fowler avatar Apr 27 '22 14:04 adam-fowler

This is done, most likely was in 5.7

adam-fowler avatar May 04 '23 10:05 adam-fowler