feat!: added support for treesitter 0.9.2. Eearlier TS versions are no longer supported.

This commit is contained in:
Folke Lemaitre
2024-01-20 12:08:36 +01:00
parent bddedb17bd
commit 18d46aeca7
2 changed files with 60 additions and 59 deletions

View File

@@ -145,6 +145,7 @@ function M.setup(opts)
colors.fg_float = colors.fg colors.fg_float = colors.fg
colors.error = colors.red1 colors.error = colors.red1
colors.todo = colors.blue
colors.warning = colors.yellow colors.warning = colors.yellow
colors.info = colors.blue2 colors.info = colors.blue2
colors.hint = colors.teal colors.hint = colors.teal

View File

@@ -214,48 +214,51 @@ function M.setup()
["@character"] = { link = "Character" }, ["@character"] = { link = "Character" },
["@character.special"] = { link = "SpecialChar" }, ["@character.special"] = { link = "SpecialChar" },
["@comment"] = { link = "Comment" }, ["@comment"] = { link = "Comment" },
["@conditional"] = { link = "Conditional" }, ["@keyword.conditional"] = { link = "Conditional" },
["@constant"] = { link = "Constant" }, ["@constant"] = { link = "Constant" },
["@constant.builtin"] = { link = "Special" }, ["@constant.builtin"] = { link = "Special" },
["@constant.macro"] = { link = "Define" }, ["@constant.macro"] = { link = "Define" },
["@debug"] = { link = "Debug" }, ["@keyword.debug"] = { link = "Debug" },
["@define"] = { link = "Define" }, ["@keyword.directive.define"] = { link = "Define" },
["@exception"] = { link = "Exception" }, ["@keyword.exception"] = { link = "Exception" },
["@float"] = { link = "Float" }, ["@number.float"] = { link = "Float" },
["@function"] = { link = "Function" }, ["@function"] = { link = "Function" },
["@function.builtin"] = { link = "Special" }, ["@function.builtin"] = { link = "Special" },
["@function.call"] = { link = "@function" }, ["@function.call"] = { link = "@function" },
["@function.macro"] = { link = "Macro" }, ["@function.macro"] = { link = "Macro" },
["@include"] = { link = "Include" }, ["@keyword.import"] = { link = "Include" },
["@keyword.coroutine"] = { link = "@keyword" }, ["@keyword.coroutine"] = { link = "@keyword" },
["@keyword.operator"] = { link = "@operator" }, ["@keyword.operator"] = { link = "@operator" },
["@keyword.return"] = { link = "@keyword" }, ["@keyword.return"] = { link = "@keyword" },
["@method"] = { link = "Function" }, ["@function.method"] = { link = "Function" },
["@method.call"] = { link = "@method" }, ["@function.method.call"] = { link = "@function.method" },
["@none"] = {}, ["@none"] = {},
["@number"] = { link = "Number" }, ["@number"] = { link = "Number" },
["@preproc"] = { link = "PreProc" }, ["@keyword.directive"] = { link = "PreProc" },
["@repeat"] = { link = "Repeat" }, ["@keyword.repeat"] = { link = "Repeat" },
["@storageclass"] = { link = "StorageClass" }, ["@keyword.storage"] = { link = "StorageClass" },
["@string"] = { link = "String" }, ["@string"] = { link = "String" },
["@string.special"] = { link = "SpecialChar" }, ["@markup.link.label"] = { link = "SpecialChar" },
["@symbol"] = { link = "Identifier" }, ["@markup.link.label.symbol"] = { link = "Identifier" },
["@tag"] = { link = "Label" }, ["@tag"] = { link = "Label" },
["@tag.attribute"] = { link = "@property" }, ["@tag.attribute"] = { link = "@property" },
["@tag.delimiter"] = { link = "Delimiter" }, ["@tag.delimiter"] = { link = "Delimiter" },
["@text"] = { link = "@none" }, ["@markup"] = { link = "@none" },
["@text.emphasis"] = { italic = true }, ["@markup.environment"] = { link = "Macro" },
["@text.environment"] = { link = "Macro" }, ["@markup.environment.name"] = { link = "Type" },
["@text.environment.name"] = { link = "Type" }, ["@markup.raw"] = { link = "String" },
["@text.literal"] = { link = "String" }, ["@markup.math"] = { link = "Special" },
["@text.math"] = { link = "Special" }, ["@markup.strong"] = { bold = true },
["@text.note"] = { link = "SpecialComment" }, ["@markup.emphasis"] = { italic = true },
["@text.strike"] = { strikethrough = true }, ["@markup.strikethrough"] = { strikethrough = true },
["@text.strong"] = { bold = true }, ["@markup.underline"] = { underline = true },
["@text.title"] = { link = "Title" }, ["@markup.heading"] = { link = "Title" },
["@text.todo"] = { link = "Todo" }, ["@comment.hint"] = { fg = c.hint },
["@text.underline"] = { underline = true }, ["@comment.error"] = { fg = c.error },
["@text.uri"] = { link = "Underlined" }, ["@comment.info"] = { fg = c.info },
["@comment.warning"] = { fg = c.warning },
["@comment.todo"] = { fg = c.todo },
["@markup.link.url"] = { link = "Underlined" },
["@type"] = { link = "Type" }, ["@type"] = { link = "Type" },
["@type.definition"] = { link = "Typedef" }, ["@type.definition"] = { link = "Typedef" },
["@type.qualifier"] = { link = "@keyword" }, ["@type.qualifier"] = { link = "@keyword" },
@@ -268,51 +271,48 @@ function M.setup()
--- Punctuation --- Punctuation
["@punctuation.delimiter"] = { fg = c.blue5 }, -- For delimiters ie: `.` ["@punctuation.delimiter"] = { fg = c.blue5 }, -- For delimiters ie: `.`
["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens. ["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens.
["@punctuation.special"] = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before. ["@markup.list"] = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before.
["@punctuation.special.markdown"] = { fg = c.orange, bold = true }, ["@markup.list.markdown"] = { fg = c.orange, bold = true },
--- Literals --- Literals
["@string.documentation"] = { fg = c.yellow }, ["@string.documentation"] = { fg = c.yellow },
["@string.regex"] = { fg = c.blue6 }, -- For regexes. ["@string.regexp"] = { fg = c.blue6 }, -- For regexes.
["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string. ["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string.
--- Functions --- Functions
["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. ["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
["@parameter"] = { fg = c.yellow }, -- For parameters of a function. ["@variable.parameter"] = { fg = c.yellow }, -- For parameters of a function.
["@parameter.builtin"] = { fg = util.lighten(c.yellow, 0.8) }, -- For builtin parameters of a function, e.g. "..." or Smali's p[1-99] ["@variable.parameter.builtin"] = { fg = util.lighten(c.yellow, 0.8) }, -- For builtin parameters of a function, e.g. "..." or Smali's p[1-99]
--- Keywords --- Keywords
["@keyword"] = { fg = c.purple, style = options.styles.keywords }, -- For keywords that don't fall in previous categories. ["@keyword"] = { fg = c.purple, style = options.styles.keywords }, -- For keywords that don't fall in previous categories.
-- TODO:
-- ["@keyword.coroutine"] = { }, -- For keywords related to coroutines.
["@keyword.function"] = { fg = c.magenta, style = options.styles.functions }, -- For keywords used to define a fuction. ["@keyword.function"] = { fg = c.magenta, style = options.styles.functions }, -- For keywords used to define a fuction.
["@label"] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua. ["@label"] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.
--- Types --- Types
["@type.builtin"] = { fg = util.darken(c.blue1, 0.8) }, ["@type.builtin"] = { fg = util.darken(c.blue1, 0.8) },
["@field"] = { fg = c.green1 }, -- For fields. ["@variable.member"] = { fg = c.green1 }, -- For fields.
["@property"] = { fg = c.green1 }, ["@property"] = { fg = c.green1 },
--- Identifiers --- Identifiers
["@variable"] = { fg = c.fg, style = options.styles.variables }, -- Any variable name that does not have another highlight. ["@variable"] = { fg = c.fg, style = options.styles.variables }, -- Any variable name that does not have another highlight.
["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. ["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`.
["@namespace.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. ["@module.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`.
--- Text --- Text
-- ["@text.literal.markdown"] = { fg = c.blue }, -- ["@markup.raw.markdown"] = { fg = c.blue },
["@text.literal.markdown_inline"] = { bg = c.terminal_black, fg = c.blue }, ["@markup.raw.markdown_inline"] = { bg = c.terminal_black, fg = c.blue },
["@text.reference"] = { fg = c.teal }, ["@markup.link"] = { fg = c.teal },
["@text.todo.unchecked"] = { fg = c.blue }, -- For brackets and parens. ["@markup.list.unchecked"] = { fg = c.blue }, -- For brackets and parens.
["@text.todo.checked"] = { fg = c.green1 }, -- For brackets and parens. ["@markup.list.checked"] = { fg = c.green1 }, -- For brackets and parens.
["@text.warning"] = { fg = c.bg, bg = c.warning },
["@text.danger"] = { fg = c.bg, bg = c.error },
["@text.diff.add"] = { link = "DiffAdd" }, ["@diff.plus"] = { link = "DiffAdd" },
["@text.diff.delete"] = { link = "DiffDelete" }, ["@diff.minus"] = { link = "DiffDelete" },
["@diff.delta"] = { link = "DiffChange" },
["@namespace"] = { link = "Include" }, ["@module"] = { link = "Include" },
-- tsx -- tsx
["@tag.tsx"] = { fg = c.red }, ["@tag.tsx"] = { fg = c.red },
@@ -328,15 +328,15 @@ function M.setup()
["@lsp.type.enum"] = { link = "@type" }, ["@lsp.type.enum"] = { link = "@type" },
["@lsp.type.enumMember"] = { link = "@constant" }, ["@lsp.type.enumMember"] = { link = "@constant" },
["@lsp.type.escapeSequence"] = { link = "@string.escape" }, ["@lsp.type.escapeSequence"] = { link = "@string.escape" },
["@lsp.type.formatSpecifier"] = { link = "@punctuation.special" }, ["@lsp.type.formatSpecifier"] = { link = "@markup.list" },
["@lsp.type.generic"] = { link = "@variable" }, ["@lsp.type.generic"] = { link = "@variable" },
["@lsp.type.interface"] = { fg = util.lighten(c.blue1, 0.7) }, ["@lsp.type.interface"] = { fg = util.lighten(c.blue1, 0.7) },
["@lsp.type.keyword"] = { link = "@keyword" }, ["@lsp.type.keyword"] = { link = "@keyword" },
["@lsp.type.lifetime"] = { link = "@storageclass" }, ["@lsp.type.lifetime"] = { link = "@keyword.storage" },
["@lsp.type.namespace"] = { link = "@namespace" }, ["@lsp.type.namespace"] = { link = "@module" },
["@lsp.type.number"] = { link = "@number" }, ["@lsp.type.number"] = { link = "@number" },
["@lsp.type.operator"] = { link = "@operator" }, ["@lsp.type.operator"] = { link = "@operator" },
["@lsp.type.parameter"] = { link = "@parameter" }, ["@lsp.type.parameter"] = { link = "@variable.parameter" },
["@lsp.type.property"] = { link = "@property" }, ["@lsp.type.property"] = { link = "@property" },
["@lsp.type.selfKeyword"] = { link = "@variable.builtin" }, ["@lsp.type.selfKeyword"] = { link = "@variable.builtin" },
["@lsp.type.selfTypeKeyword"] = { link = "@variable.builtin" }, ["@lsp.type.selfTypeKeyword"] = { link = "@variable.builtin" },
@@ -394,7 +394,7 @@ function M.setup()
-- LspTrouble -- LspTrouble
TroubleText = { fg = c.fg_dark }, TroubleText = { fg = c.fg_dark },
TroubleCount = { fg = c.magenta, bg = c.fg_gutter }, TroubleCount = { fg = c.magenta, bg = c.fg_gutter },
TroubleNormal = { fg = c.fg_sidebar, bg = c.bg_sidebar }, TroubleNormal = { fg = c.fg, bg = c.bg_sidebar },
-- Illuminate -- Illuminate
illuminatedWord = { bg = c.fg_gutter }, illuminatedWord = { bg = c.fg_gutter },
@@ -788,28 +788,28 @@ function M.setup()
Enum = "@lsp.type.enum", Enum = "@lsp.type.enum",
EnumMember = "@lsp.type.enumMember", EnumMember = "@lsp.type.enumMember",
Event = "Special", Event = "Special",
Field = "@field", Field = "@variable.member",
File = "Normal", File = "Normal",
Folder = "Directory", Folder = "Directory",
Function = "@function", Function = "@function",
Interface = "@lsp.type.interface", Interface = "@lsp.type.interface",
Key = "@field", Key = "@variable.member",
Keyword = "@lsp.type.keyword", Keyword = "@lsp.type.keyword",
Method = "@method", Method = "@function.method",
Module = "@namespace", Module = "@module",
Namespace = "@namespace", Namespace = "@module",
Null = "@constant.builtin", Null = "@constant.builtin",
Number = "@number", Number = "@number",
Object = "@constant", Object = "@constant",
Operator = "@operator", Operator = "@operator",
Package = "@namespace", Package = "@module",
Property = "@property", Property = "@property",
Reference = "@text.reference", Reference = "@markup.link",
Snippet = "Conceal", Snippet = "Conceal",
String = "@string", String = "@string",
Struct = "@lsp.type.struct", Struct = "@lsp.type.struct",
Unit = "@lsp.type.struct", Unit = "@lsp.type.struct",
Text = "@text", Text = "@markup",
TypeParameter = "@lsp.type.typeParameter", TypeParameter = "@lsp.type.typeParameter",
Variable = "@variable", Variable = "@variable",
Value = "@string", Value = "@string",
@@ -827,7 +827,7 @@ function M.setup()
local markdown_rainbow = { c.blue, c.yellow, c.green, c.teal, c.magenta, c.purple } local markdown_rainbow = { c.blue, c.yellow, c.green, c.teal, c.magenta, c.purple }
for i, color in ipairs(markdown_rainbow) do for i, color in ipairs(markdown_rainbow) do
theme.highlights["@text.title." .. i .. ".markdown"] = { fg = color, bold = true } theme.highlights["@markup.heading." .. i .. ".markdown"] = { fg = color, bold = true }
theme.highlights["Headline" .. i] = { bg = util.darken(color, 0.05) } theme.highlights["Headline" .. i] = { bg = util.darken(color, 0.05) }
end end
theme.highlights["Headline"] = { link = "Headline1" } theme.highlights["Headline"] = { link = "Headline1" }