mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
feat: support suggested highlights
This commit is contained in:
parent
2b3d4d21a8
commit
5dc5695413
1 changed files with 41 additions and 0 deletions
|
|
@ -6,6 +6,47 @@ local M = {
|
||||||
highlighters = {}
|
highlighters = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local hlmap = vim.treesitter.TSHighlighter.hl_map
|
||||||
|
|
||||||
|
-- Misc
|
||||||
|
hlmap.error = "Error"
|
||||||
|
hlmap["punctuation.delimiter"] = "Delimiter"
|
||||||
|
hlmap["punctuation.bracket"] = "Delimiter"
|
||||||
|
|
||||||
|
-- Constants
|
||||||
|
hlmap["constant"] = "Constant"
|
||||||
|
hlmap["constant.builtin"] = "Special"
|
||||||
|
hlmap["constant.macro"] = "Define"
|
||||||
|
hlmap["string"] = "String"
|
||||||
|
hlmap["string.regex"] = "String"
|
||||||
|
hlmap["string.escape"] = "SpecialChar"
|
||||||
|
hlmap["character"] = "Character"
|
||||||
|
hlmap["number"] = "Number"
|
||||||
|
hlmap["boolean"] = "Boolean"
|
||||||
|
hlmap["float"] = "Float"
|
||||||
|
|
||||||
|
-- Functions
|
||||||
|
hlmap["function"] = "Function"
|
||||||
|
hlmap["function.builtin"] = "Special"
|
||||||
|
hlmap["function.macro"] = "Macro"
|
||||||
|
hlmap["parameter"] = "Identifier"
|
||||||
|
hlmap["method"] = "Function"
|
||||||
|
hlmap["field"] = "Identifier"
|
||||||
|
hlmap["property"] = "Identifier"
|
||||||
|
hlmap["constructor"] = "Special"
|
||||||
|
|
||||||
|
-- Keywords
|
||||||
|
hlmap["conditional"] = "Conditional"
|
||||||
|
hlmap["repeat"] = "Repeat"
|
||||||
|
hlmap["label"] = "Label"
|
||||||
|
hlmap["operator"] = "Operator"
|
||||||
|
hlmap["keyword"] = "Keyword"
|
||||||
|
hlmap["exception"] = "Exception"
|
||||||
|
|
||||||
|
hlmap["type"] = "Type"
|
||||||
|
hlmap["type.builtin"] = "Type"
|
||||||
|
hlmap["structure"] = "Structure"
|
||||||
|
|
||||||
function M.attach(bufnr, ft)
|
function M.attach(bufnr, ft)
|
||||||
local buf = bufnr or api.nvim_get_current_buf()
|
local buf = bufnr or api.nvim_get_current_buf()
|
||||||
local ft = ft or api.nvim_buf_get_option(buf, 'ft')
|
local ft = ft or api.nvim_buf_get_option(buf, 'ft')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue