Skip to content

Commit

Permalink
feat!: added support for treesitter 0.9.2. Eearlier TS versions are n…
Browse files Browse the repository at this point in the history
…o longer supported.
  • Loading branch information
folke committed Jan 20, 2024
1 parent bddedb1 commit 18d46ae
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 59 deletions.
1 change: 1 addition & 0 deletions lua/tokyonight/colors.lua
Expand Up @@ -145,6 +145,7 @@ function M.setup(opts)
colors.fg_float = colors.fg

colors.error = colors.red1
colors.todo = colors.blue
colors.warning = colors.yellow
colors.info = colors.blue2
colors.hint = colors.teal
Expand Down
118 changes: 59 additions & 59 deletions lua/tokyonight/theme.lua
Expand Up @@ -214,48 +214,51 @@ function M.setup()
["@character"] = { link = "Character" },
["@character.special"] = { link = "SpecialChar" },
["@comment"] = { link = "Comment" },
["@conditional"] = { link = "Conditional" },
["@keyword.conditional"] = { link = "Conditional" },
["@constant"] = { link = "Constant" },
["@constant.builtin"] = { link = "Special" },
["@constant.macro"] = { link = "Define" },
["@debug"] = { link = "Debug" },
["@define"] = { link = "Define" },
["@exception"] = { link = "Exception" },
["@float"] = { link = "Float" },
["@keyword.debug"] = { link = "Debug" },
["@keyword.directive.define"] = { link = "Define" },
["@keyword.exception"] = { link = "Exception" },
["@number.float"] = { link = "Float" },
["@function"] = { link = "Function" },
["@function.builtin"] = { link = "Special" },
["@function.call"] = { link = "@function" },
["@function.macro"] = { link = "Macro" },
["@include"] = { link = "Include" },
["@keyword.import"] = { link = "Include" },
["@keyword.coroutine"] = { link = "@keyword" },
["@keyword.operator"] = { link = "@operator" },
["@keyword.return"] = { link = "@keyword" },
["@method"] = { link = "Function" },
["@method.call"] = { link = "@method" },
["@function.method"] = { link = "Function" },
["@function.method.call"] = { link = "@function.method" },
["@none"] = {},
["@number"] = { link = "Number" },
["@preproc"] = { link = "PreProc" },
["@repeat"] = { link = "Repeat" },
["@storageclass"] = { link = "StorageClass" },
["@keyword.directive"] = { link = "PreProc" },
["@keyword.repeat"] = { link = "Repeat" },
["@keyword.storage"] = { link = "StorageClass" },
["@string"] = { link = "String" },
["@string.special"] = { link = "SpecialChar" },
["@symbol"] = { link = "Identifier" },
["@markup.link.label"] = { link = "SpecialChar" },
["@markup.link.label.symbol"] = { link = "Identifier" },
["@tag"] = { link = "Label" },
["@tag.attribute"] = { link = "@property" },
["@tag.delimiter"] = { link = "Delimiter" },
["@text"] = { link = "@none" },
["@text.emphasis"] = { italic = true },
["@text.environment"] = { link = "Macro" },
["@text.environment.name"] = { link = "Type" },
["@text.literal"] = { link = "String" },
["@text.math"] = { link = "Special" },
["@text.note"] = { link = "SpecialComment" },
["@text.strike"] = { strikethrough = true },
["@text.strong"] = { bold = true },
["@text.title"] = { link = "Title" },
["@text.todo"] = { link = "Todo" },
["@text.underline"] = { underline = true },
["@text.uri"] = { link = "Underlined" },
["@markup"] = { link = "@none" },
["@markup.environment"] = { link = "Macro" },
["@markup.environment.name"] = { link = "Type" },
["@markup.raw"] = { link = "String" },
["@markup.math"] = { link = "Special" },
["@markup.strong"] = { bold = true },
["@markup.emphasis"] = { italic = true },
["@markup.strikethrough"] = { strikethrough = true },
["@markup.underline"] = { underline = true },
["@markup.heading"] = { link = "Title" },
["@comment.hint"] = { fg = c.hint },
["@comment.error"] = { fg = c.error },
["@comment.info"] = { fg = c.info },
["@comment.warning"] = { fg = c.warning },
["@comment.todo"] = { fg = c.todo },
["@markup.link.url"] = { link = "Underlined" },
["@type"] = { link = "Type" },
["@type.definition"] = { link = "Typedef" },
["@type.qualifier"] = { link = "@keyword" },
Expand All @@ -268,51 +271,48 @@ function M.setup()
--- Punctuation
["@punctuation.delimiter"] = { fg = c.blue5 }, -- For delimiters ie: `.`
["@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.
["@punctuation.special.markdown"] = { fg = c.orange, bold = true },
["@markup.list"] = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before.
["@markup.list.markdown"] = { fg = c.orange, bold = true },

--- Literals
["@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.

--- Functions
["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
["@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"] = { fg = c.yellow }, -- For parameters of a function.
["@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
["@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.

["@label"] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.

--- Types
["@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 },

--- Identifiers
["@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`.
["@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.literal.markdown"] = { fg = c.blue },
["@text.literal.markdown_inline"] = { bg = c.terminal_black, fg = c.blue },
["@text.reference"] = { fg = c.teal },
-- ["@markup.raw.markdown"] = { fg = c.blue },
["@markup.raw.markdown_inline"] = { bg = c.terminal_black, fg = c.blue },
["@markup.link"] = { fg = c.teal },

["@text.todo.unchecked"] = { fg = c.blue }, -- For brackets and parens.
["@text.todo.checked"] = { fg = c.green1 }, -- For brackets and parens.
["@text.warning"] = { fg = c.bg, bg = c.warning },
["@text.danger"] = { fg = c.bg, bg = c.error },
["@markup.list.unchecked"] = { fg = c.blue }, -- For brackets and parens.
["@markup.list.checked"] = { fg = c.green1 }, -- For brackets and parens.

["@text.diff.add"] = { link = "DiffAdd" },
["@text.diff.delete"] = { link = "DiffDelete" },
["@diff.plus"] = { link = "DiffAdd" },
["@diff.minus"] = { link = "DiffDelete" },
["@diff.delta"] = { link = "DiffChange" },

["@namespace"] = { link = "Include" },
["@module"] = { link = "Include" },

-- tsx
["@tag.tsx"] = { fg = c.red },
Expand All @@ -328,15 +328,15 @@ function M.setup()
["@lsp.type.enum"] = { link = "@type" },
["@lsp.type.enumMember"] = { link = "@constant" },
["@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.interface"] = { fg = util.lighten(c.blue1, 0.7) },
["@lsp.type.keyword"] = { link = "@keyword" },
["@lsp.type.lifetime"] = { link = "@storageclass" },
["@lsp.type.namespace"] = { link = "@namespace" },
["@lsp.type.lifetime"] = { link = "@keyword.storage" },
["@lsp.type.namespace"] = { link = "@module" },
["@lsp.type.number"] = { link = "@number" },
["@lsp.type.operator"] = { link = "@operator" },
["@lsp.type.parameter"] = { link = "@parameter" },
["@lsp.type.parameter"] = { link = "@variable.parameter" },
["@lsp.type.property"] = { link = "@property" },
["@lsp.type.selfKeyword"] = { link = "@variable.builtin" },
["@lsp.type.selfTypeKeyword"] = { link = "@variable.builtin" },
Expand Down Expand Up @@ -394,7 +394,7 @@ function M.setup()
-- LspTrouble
TroubleText = { fg = c.fg_dark },
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
illuminatedWord = { bg = c.fg_gutter },
Expand Down Expand Up @@ -788,28 +788,28 @@ function M.setup()
Enum = "@lsp.type.enum",
EnumMember = "@lsp.type.enumMember",
Event = "Special",
Field = "@field",
Field = "@variable.member",
File = "Normal",
Folder = "Directory",
Function = "@function",
Interface = "@lsp.type.interface",
Key = "@field",
Key = "@variable.member",
Keyword = "@lsp.type.keyword",
Method = "@method",
Module = "@namespace",
Namespace = "@namespace",
Method = "@function.method",
Module = "@module",
Namespace = "@module",
Null = "@constant.builtin",
Number = "@number",
Object = "@constant",
Operator = "@operator",
Package = "@namespace",
Package = "@module",
Property = "@property",
Reference = "@text.reference",
Reference = "@markup.link",
Snippet = "Conceal",
String = "@string",
Struct = "@lsp.type.struct",
Unit = "@lsp.type.struct",
Text = "@text",
Text = "@markup",
TypeParameter = "@lsp.type.typeParameter",
Variable = "@variable",
Value = "@string",
Expand All @@ -827,7 +827,7 @@ function M.setup()
local markdown_rainbow = { c.blue, c.yellow, c.green, c.teal, c.magenta, c.purple }

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) }
end
theme.highlights["Headline"] = { link = "Headline1" }
Expand Down

5 comments on commit 18d46ae

@clason
Copy link

@clason clason commented on 18d46ae Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that v0.9.2 is the tag before the rewrite (so still using the old capture groups).

@clason
Copy link

@clason clason commented on 18d46ae Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there will likely be a few minor naming adjustments in the next few days. When the Neovim PR is merged, those groups can then be considered canonical.

@folke
Copy link
Owner Author

@folke folke commented on 18d46ae Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I got that wrong indeed :)

I'll see if any other changes will be needed after that PR gets merged

@clason
Copy link

@clason clason commented on 18d46ae Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe consolidating the @comment groups; they seem... excessive.

(also, welcome back!)

@clason
Copy link

@clason clason commented on 18d46ae Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed @comment.info and @comment.hint in favor of @comment.note -- that should be the last change.

Please sign in to comment.