Coder Social home page Coder Social logo

Comments (8)

undeadcat avatar undeadcat commented on May 27, 2024 7

@ulrichb, Try changing the indent settings for LESS language.
LESS language is used in this plugin in styled-components strings because of LESS-like features like '&' selector.

And LESS, SASS, etc. languages have the IDE defaults set to 2 spaces (unlike CSS) for what seems like historical reasons.

from webstorm-styled-components.

ulrichb avatar ulrichb commented on May 27, 2024 4

@undeadcat Yes! It was the Less-"INDENT_SIZE" (I'v set it now to 4).

Thanks!

from webstorm-styled-components.

undeadcat avatar undeadcat commented on May 27, 2024 2

If your question is "Why is the code inside css`div .myDiv {color :red}` not formatted?", the answer is:

It's not something that at the moment be fixed by this plugin. It's planned to be fixed in the IDE in 2018.2. These are the applicable issues: WEB-32480 and WEB-28540.

from webstorm-styled-components.

volos-st avatar volos-st commented on May 27, 2024 1

Thanks, changing INDENT_SIZE for LESS is help me

from webstorm-styled-components.

ulrichb avatar ulrichb commented on May 27, 2024

@undeadcat Is WEB-28540 also the reason, why TAB indents 2 spaces, although WebStorm is configured to 4 for the CSS language?

from webstorm-styled-components.

undeadcat avatar undeadcat commented on May 27, 2024

@ulrichb, Doesn't seem to be related to any of these issues.
I'm guessing you have 2 spaces configured in JS indent settings and 4 spaces in CSS? And wish to use 4 spaces within styled-components strings?

It works as expected for me using the latest WebStorm EAP.
Could you provide some more information - the IDE version you're using, a code sample than can be used to reproduce the issue?

from webstorm-styled-components.

ulrichb avatar ulrichb commented on May 27, 2024

Hi @undeadcat

Thanks for your reply!

I have a "Tab size" and "Indent" for JS, TS, and CSS set to 4 (I think the default of WebStorm).

.... still, when hitting the TAB key, the cursor moves 2 chars (instead of 4).

BUT: When selecting text, it correctly gets indented by 4 chars.

Also when hitting TAB in the surrounding TS code, the cursor moves by 4 chars.

Using WS 2018.2.3.

from webstorm-styled-components.

ulrichb avatar ulrichb commented on May 27, 2024

Also note that this plugin seems to cause it because in "normal" (non styled-comp) tagged strings, the cursor also 4 chars.

from webstorm-styled-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.