forked from VimPlug/emmet-vim
Add support for CSS in JS annotations like css` and styled.*`
This commit is contained in:
@@ -404,6 +404,8 @@ function! emmet#getFileType(...) abort
|
|||||||
let type = 'typescript'
|
let type = 'typescript'
|
||||||
elseif type =~? '^xml'
|
elseif type =~? '^xml'
|
||||||
let type = 'xml'
|
let type = 'xml'
|
||||||
|
elseif type == 'styledEmmetAbbreviation'
|
||||||
|
let type = 'styled'
|
||||||
else
|
else
|
||||||
let types = split(&filetype, '\.')
|
let types = split(&filetype, '\.')
|
||||||
for part in types
|
for part in types
|
||||||
@@ -1680,6 +1682,9 @@ let s:emmet_settings = {
|
|||||||
\ 'css.drupal': {
|
\ 'css.drupal': {
|
||||||
\ 'extends': 'css',
|
\ 'extends': 'css',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'styled': {
|
||||||
|
\ 'extends': 'css',
|
||||||
|
\ },
|
||||||
\ 'html': {
|
\ 'html': {
|
||||||
\ 'snippets': {
|
\ 'snippets': {
|
||||||
\ '!': "html:5",
|
\ '!': "html:5",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function! emmet#lang#css#parseIntoTree(abbr, type) abort
|
|||||||
" emmet
|
" emmet
|
||||||
let tokens = split(abbr, '+\ze[^+)!]')
|
let tokens = split(abbr, '+\ze[^+)!]')
|
||||||
let block = emmet#util#searchRegion('{', '}')
|
let block = emmet#util#searchRegion('{', '}')
|
||||||
if abbr !~# '^@' && emmet#getBaseType(type) ==# 'css' && type !=# 'sass' && block[0] ==# [0,0] && block[1] ==# [0,0]
|
if abbr !~# '^@' && emmet#getBaseType(type) ==# 'css' && type !=# 'sass' && type !=# 'styled' && block[0] ==# [0,0] && block[1] ==# [0,0]
|
||||||
let current = emmet#newNode()
|
let current = emmet#newNode()
|
||||||
let current.snippet = substitute(abbr, '\s\+$', '', '') . " {\n" . indent . "${cursor}\n}"
|
let current.snippet = substitute(abbr, '\s\+$', '', '') . " {\n" . indent . "${cursor}\n}"
|
||||||
let current.name = ''
|
let current.name = ''
|
||||||
|
|||||||
3
syntax/javascript.vim
Normal file
3
syntax/javascript.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
" Register `styledEmmetAbbreviation` syntax in `styledDefinition` region defined in
|
||||||
|
" https://github.com/styled-components/vim-styled-components.
|
||||||
|
syntax match styledEmmetAbbreviation "[a-z0-9#+!%]\+" containedin=styledDefinition contained
|
||||||
1
syntax/javascriptreact.vim
Normal file
1
syntax/javascriptreact.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
runtime syntax/javascript.vim
|
||||||
1
syntax/typescript.vim
Normal file
1
syntax/typescript.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
runtime syntax/javascript.vim
|
||||||
1
syntax/typescriptreact.vim
Normal file
1
syntax/typescriptreact.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
runtime syntax/javascript.vim
|
||||||
Reference in New Issue
Block a user