styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

Plugin does not work with ft=javascript.jsx #11

Closed on3iro closed 7 years ago

on3iro commented 7 years ago

Hey,

thanks for the cool plugin. Unfortunately I can't seem to get it to work with the filetype javascript.jsx. Is there anything I could do?

fleischie commented 7 years ago

Hey @on3iro.

Let's start from the beginning:

  1. How did you install the plugin? Package manager yes/no/which one or manually?
  2. Why do you say it's not working? Missing indentation/syntax?
  3. How does the file look, that you are trying to modify?

I think these questions should get us moving for now. :smile:

on3iro commented 7 years ago

Hey @fleischie,

Thanks for the quick response. Regarding your questions:

  1. I installed the plugin via Vundle
  2. Syntax-Highlighting is missing (it is present with ft=javascript)
  3. It is a pretty simple styled-component

The odd thing is, that right now it seems to be working and I can't really reproduce the issue. I will keep you updated if it happens again :)

Edit: Updated for formatting

fleischie commented 7 years ago

Yes, sure. No problem. :smile:

I may think to know, what the problem is: The plugin only sets up the highlighting/indenting, if the file you are editing is a styled-component (as in, contains a line containing either import ... from ... styled-components or require ... styled-components ...) to not hightlight/indent template strings in a test/snapshot for example.

Thus, if you open a new *.js file and start typing, the plugin does not recognize your file to contain a styled-component. You can always re-validate the filetype by typing :filetype detect in ex mode. This will re-evaluate the file's contents and enable syntax highlighting/indenting. (Or alternatively exit/re-enter the file.) :wink:

As you don't seem to have the problem anymore, I will close this issue for now. Feel free to contact me again, if it happens again. :smiley: