Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot make it work #76

Open
xahon opened this issue Oct 11, 2017 · 5 comments
Open

Cannot make it work #76

xahon opened this issue Oct 11, 2017 · 5 comments

Comments

@xahon
Copy link

xahon commented Oct 11, 2017

I've tried to make styled-components syntax inside .js[x]? file

Here is my function for that

(use-package mmm-mode
  :config
  (require 'mmm-auto)
  (require 'mmm-vars)
  (require 'css-mode)

  (setq mmm-global-mode 'maybe)

  (mmm-add-classes
   '((js-styled-components
      :submode css-mode
      :front "styled[.\\|(]\\{1\\}[^`]+`"
      :back "[\t]*`")))

  (mmm-add-mode-ext-class 'rjsx-mode nil 'js-styled-components)
  (mmm-add-mode-ext-class 'js2-jsx-mode nil 'js-styled-components))

It should look like that (css syntax inside js file between "styled.[^\`]`" and "\s`")
image

Tried to set less-css-mode and sass-mode instead of css-mode
Tried to use not only css props, but css classes .someclass { ... }
Regex is working well according to regex-builder
Tried to swap front and back according to #72 issue
I'm sure that js2-jsx-mode is enabled in buffer and tried to change to rjsx-mode

@dgutov
Copy link
Owner

dgutov commented Oct 11, 2017

js2-mode doesn't work well with mmm-mode. In particular, it fontifies the strings contents outside of the font-lock framework.

You can try this with js-mode as the primary mode, for comparison.

@xahon
Copy link
Author

xahon commented Oct 11, 2017

@dgutov js-mode not working

@xahon
Copy link
Author

xahon commented Oct 11, 2017

rjsx-mode too

@dgutov
Copy link
Owner

dgutov commented Oct 11, 2017

jsx-mode is based on js2-mode. js-mode works here.

@xahon
Copy link
Author

xahon commented Oct 11, 2017

@dgutov can you share your config i could test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants