microsoft / typescript-styled-plugin

TypeScript server plugin that adds intellisense to styled component css strings
MIT License
839 stars 58 forks source link

Selecting Intellisense suggestion results in doubled content being typed #153

Closed jasonwilliams closed 2 years ago

jasonwilliams commented 3 years ago

Raised from: https://github.com/styled-components/vscode-styled-components/issues/325

@mjbvz do you have any idea where to look for debugging the below? I've been trawling through the typescript-styled-plugin code and don't see anything obvious. Do you have any tips on how to fix this?

It looks like it doesn't replace what's already there and only inserts instead. The issue though is we haven't changed anything in this plugin apart from maybe updated CSS lang server dependency.

Describe the bug (including copyable syntax) I see this as a one solid issue, symptoms of which are being solved in other issues. This is a continuation of this https://github.com/styled-components/vscode-styled-components/issues/219. Namely, the Intellisense in styled-components code won't account for previously typed text when making suggestions and completions. I will describe it in several examples below.

  1. Start creating some pseudo styling like after, selection, etc. image After hitting ENTER you will get this image

  2. If you start typing some css, Intellisense box would pop-up, close it and continue typing again. Say, it was flex- before. After applying the suggested option, say, flow, you will get flex-flex-flow (so the previously typed text is not accounted).

This is happening to me since early versions (below 1.0) of the extension.

Expected behavior The behavior should be identical with regular css files.

Build environment (please complete the following information):

jasonwilliams commented 3 years ago

I've tested this behaviour in an old version of typescript-styled-plugin https://github.com/microsoft/typescript-styled-plugin/commit/9769232f9799224f572d0171316530ef03fc9403 and it still happens. So i don't think its a regression