fix(editorconfig): highlight properties with dashes (#24407)

also add metadata comment and update Lua code in syntax file
This commit is contained in:
ObserverOfTime 2023-07-27 15:39:05 +03:00 committed by GitHub
parent 41cefe5130
commit df2f5e3912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -1,15 +1,18 @@
" Nvim syntax file
" Language: EditorConfig
" Last Change: 2023-07-20
"
" This file is intentionally _not_ copied from Vim.
runtime! syntax/dosini.vim
unlet! b:current_syntax
syntax match editorconfigUnknownProperty "^\s*\zs\w\+\ze\s*="
syntax match editorconfigUnknownProperty "^\s*\zs[a-zA-Z0-9_-]\+\ze\s*="
syntax keyword editorconfigProperty root
lua<<
local props = {}
for k in pairs(require('editorconfig').properties) do
props[#props + 1] = k
end
vim.cmd(string.format('syntax keyword editorconfigProperty %s', table.concat(props, ' ')))
local props = vim.tbl_keys(require('editorconfig').properties)
vim.cmd.syntax { 'keyword', 'editorconfigProperty', unpack(props) }
.
hi def link editorconfigProperty dosiniLabel