vscode-styled-components icon indicating copy to clipboard operation
vscode-styled-components copied to clipboard

Auto-completion affects non-styled syntax which resulting in semicolon suffix in Object.

Open iamyoki opened this issue 4 years ago • 8 comments

Description

When I typing inside original style, it triggers vscode-styled-components auto-completion with semicolon suffix.

Screenshot 2021-05-28 14 11 54

Expected behavior

Don't bother original style syntax.

Build environment (please complete the following information):

  • OS: 11.2.2 (20D80)
  • VSCode Version: 1.56.2
  • Extension Version 1.6.3

iamyoki avatar May 28 '21 06:05 iamyoki

I switched to v1.5.2, and it's fine.

iamyoki avatar May 28 '21 06:05 iamyoki

@iamyoki would you be interested in working on this bug?

jasonwilliams avatar May 28 '21 08:05 jasonwilliams

This issue also seems to happen when autocompleting React component props.

GIF styled-components-bug

anasyusef avatar Jun 06 '21 13:06 anasyusef

Does it have any config to disable this feature? (I haven't found it)
I don't want to disable this extension but this problem bother me. 🥺😰

gluons avatar Jun 09 '21 09:06 gluons

You can change the version back to 1.5.2 as suggested by @iamyoki

anasyusef avatar Jun 09 '21 17:06 anasyusef

I will put in an option to toggle this feature

jasonwilliams avatar Jun 09 '21 20:06 jasonwilliams

Is someone able to knock up a small test case? Im unable to reproduce this issue :/ When i try to use style i don't get the auto complete in those situations.

I think it may be fixable without having to disable it but for that i need a tiny test case

jasonwilliams avatar Jul 26 '21 18:07 jasonwilliams

QQ20210805-164840-HD

@jasonwilliams I tried to find a way to reproduce it, but I don't know how...

However, I found it was caused by 'extension.insertColonOrSemiColon' command. Source code at https://github.com/styled-components/vscode-styled-components/blob/4c059a3f203aea2cb62508608df03bcd12fd4a84/src/insertColonCommand.ts#L27

iamyoki avatar Aug 05 '21 08:08 iamyoki

I can reproduce this issue in any object.

@jasonwilliams the following typeScript code reproduces the issue:

interface exampleType {
  color?: string;
  randomOther?: string;
}

let example: exampleType = {
  // press CTRL+SPACE and select "color" to reproduce the issue
  // note the issue doesn't occur when autoCompleting randomOther

};

it seems like any object key that is also a css property causes a problem

RJWadley avatar Aug 16 '22 17:08 RJWadley

Hmm I think we should just get rid of this feature and hope the typescript css/sass service can provide it instead. @RJWadley id accept a PR which just removes this command. I don’t think there’s any good way to know when we’re in a good place to enable it on/off

jasonwilliams avatar Aug 16 '22 21:08 jasonwilliams