Add support for CSS in JS annotations like css` and styled.*`

This commit is contained in:
gitusp
2020-10-18 06:55:14 +09:00
parent dc6cb4fd07
commit f8e6431776
6 changed files with 12 additions and 1 deletions

View File

@@ -404,6 +404,8 @@ function! emmet#getFileType(...) abort
let type = 'typescript'
elseif type =~? '^xml'
let type = 'xml'
elseif type == 'styledEmmetAbbreviation'
let type = 'styled'
else
let types = split(&filetype, '\.')
for part in types
@@ -1680,6 +1682,9 @@ let s:emmet_settings = {
\ 'css.drupal': {
\ 'extends': 'css',
\ },
\ 'styled': {
\ 'extends': 'css',
\ },
\ 'html': {
\ 'snippets': {
\ '!': "html:5",

View File

@@ -23,7 +23,7 @@ function! emmet#lang#css#parseIntoTree(abbr, type) abort
" emmet
let tokens = split(abbr, '+\ze[^+)!]')
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.snippet = substitute(abbr, '\s\+$', '', '') . " {\n" . indent . "${cursor}\n}"
let current.name = ''