Compare commits

..

No commits in common. "45170a1af9f14043dfbaffce3ad946f2672f7275" and "51be6b2b35f30c3875ef6d4a9d528d35efac2e8e" have entirely different histories.

11 changed files with 1067 additions and 45 deletions

202
catppuccin_latte.lua Normal file
View File

@ -0,0 +1,202 @@
-- this line for types, by hovering and autocompletion (lsp required)
-- will help you understanding properties, fields, and what highlightings the color used for
---@type Base46Table
local M = {}
-- UI
M.base_30 = {
white = "#4c4f69",
black = "#dce0e8", -- usually your theme bg
darker_black = "#E9ECF1", -- 6% darker than black
black2 = "#ccd0da", -- 6% lighter than black
one_bg = "#C2C6D1", -- 10% lighter than black
one_bg2 = "#B1B5C3", -- 6% lighter than one_bg2
one_bg3 = "#9ca0b0", -- 6% lighter than one_bg3
grey = "#888FA5", -- 40% lighter than black (the % here depends so choose the perfect grey!)
grey_fg = "#6C748E", -- 10% lighter than grey
grey_fg2 = "#61697F", -- 5% lighter than grey
light_grey = "#5c5f77",
red = "#d20f39",
baby_pink = "#dc8a78",
pink = "#ea76cb",
line = "#8386a0", -- 15% lighter than black
green = "#40a02b",
vibrant_green = "#00AD83",
nord_blue = "#4f6d7a",
blue = "#1e66f5",
seablue = "#04a5e5",
yellow = "#df8e1d", -- 8% lighter than yellow
sun = "#eb961e",
purple = "#AA71F4",
dark_purple = "#8839ef",
teal = "#179299",
orange = "#fe640b",
cyan = "#209fb5",
statusline_bg = "#DCE0E8",
lightbg = "#CCD0DA",
pmenu_bg = "#A5B0C5",
folder_bg = "#1e66f5",
lavender = "#7287fd",
flamingo = "#dd7878",
maroon = "#e64553",
}
-- check https://github.com/chriskempson/base17/blob/master/styling.md for more info
M.base_16 = {
base00 = "#eff1f5",
base01 = "#e6e9ef",
base02 = "#ccd0da",
base03 = "#bcc0cc",
base04 = "#acb0be",
base05 = "#4c4f69",
base06 = "#dc8a78",
base07 = "#7287fd",
base08 = "#d20f39",
base09 = "#fe640b",
base0A = "#df8e1d",
base0B = "#40a02b",
base0C = "#179299",
base0D = "#1e66f5",
base0E = "#8839ef",
base0F = "#dd7878"
}
-- OPTIONAL
-- overriding or adding highlights for this specific theme only
-- defaults/treesitter is the filename i.e integration there,
local Style = {
Lifetimes = {
fg = M.base_16.base0D,
italic = true
},
Macro = {
fg = M.base_30.sun,
},
Comments = {
Todo = {
fg = M.base_30.seablue,
bg = "none",
italic = true,
},
Warn = {
fg = M.base_30.sun,
bg = "none",
italic = true,
},
Err = {
fg = M.base_30.maroon,
bg = "none",
italic = true,
},
Note = {
fg = M.base_30.vibrant_green,
bg = "none",
italic = true,
}
},
Keywords = {
General = {
fg = M.base_16.base0E,
},
Import = {
fg = M.base_16.base0E,
bold = true,
},
Function = {
italic = true,
},
},
Function = {
fg = M.base_16.base0D,
},
Types = {
Interface = {
fg = M.base_30.vibrant_green,
},
Builtin = {
fg = M.base_16.base0E,
},
Defined = {
fg = M.base_30.sun,
italic = true,
},
EnumMember = {
fg = M.base_16.base0C,
italic = true,
}
},
GenericBracket = {
fg = M.base_30.seablue,
},
Operators = {
fg = M.base_16.base0C,
},
}
M.polish_hl = {
treesitter = {
["@attribute"] = Style.Lifetimes,
["@attribute.builtin"] = Style.Lifetimes,
["@comment.error"] = Style.Comments.Err,
["@comment.warning"] = Style.Comments.Warn,
["@comment.todo"] = Style.Comments.Todo,
["@comment.note"] = Style.Comments.Note,
["@constant"] = {
fg = M.base_16.base09
},
["@constant.builtin"] = Style.Types.EnumMember,
["@function.macro"] = Style.Macro,
["@function.abstract"] = {
italic = true,
},
-- ["@local.definition.import"] = Style.Keywords.Import,
["@local.definition.var"] = {
fg = M.base_30.maroon,
},
["@keyword.import"] = Style.Keywords.Import,
["@keyword"] = Style.Keywords.General,
["@keyword.modifier"] = Style.Keywords.General,
["@keyword.function"] = Style.Keywords.Function,
["@keyword.repeat"] = Style.Keywords.General,
["@local.definition.import"] = Style.Macro,
["@module"] = Style.Macro,
["@operator"] = Style.Operators,
["@punctuation.bracket"] = {
fg = M.base_16.base08,
},
["@punctuation.special"] = Style.Macro,
["@punctuation.generic.bracket"] = Style.GenericBracket,
["@punctuation.delimiter"] = Style.Operators,
["@property"] = Style.Types.EnumMember,
["@trait"] = Style.Types.Interface,
["@type"] = Style.Types.Defined,
["@type.builtin"] = Style.Types.Builtin,
["@variable.parameter"] = {
fg = M.base_30.maroon,
italic = true,
},
["@variable.builtin"] = Style.Keywords.General,
["@variable.member"] = {
fg = M.base_16.base05,
}
},
}
-- set the theme type whether is dark or light
M.type = "light" -- "or light"
-- this will be later used for users to override your theme table from chadrc
M = require("base46").override_theme(M, "Catppuccin latte")
return M

View File

@ -4,13 +4,13 @@
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
lvim.colorscheme = "monokai-pro"
lvim.builtin.breadcrumbs.active = false
lvim.colorscheme = "monokai-pro-machine"
require "plugins.init"
require "mappings"
require "configs.noice"
require "configs.nvimtree"
require "configs.bufferline"
require "configs.dropbar"
lvim.builtin.breadcrumbs.active = false

65
lvim/lazy-lock.json Normal file
View File

@ -0,0 +1,65 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "1def35377854535bb3b0f4cc7a33c083cdb12571" },
"alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" },
"bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" },
"bufferline.nvim": { "branch": "main", "commit": "73540cb95f8d95aa1af3ed57713c6720c78af915" },
"catppuccin": { "branch": "main", "commit": "ba5f4153a5dad99505baba936bd0373534400ac3" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dropbar.nvim": { "branch": "master", "commit": "aa4c0ab1ade45ff9a3c5d4c06365c9b119f32d36" },
"friendly-snippets": { "branch": "main", "commit": "3e9a3f5a0cfcef1741e352c37bda4e82e5eb846a" },
"fzf-lua": { "branch": "main", "commit": "580a20c58a714de566305756ad15384304ab9aae" },
"gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" },
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
"lir.nvim": { "branch": "master", "commit": "7a9d45de08fecd23a04aca1f96688d744830029e" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"monokai-pro.nvim": { "branch": "master", "commit": "2bad2a92fe0ff6c8581d33a853a1b17592b83239" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
"neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" },
"nlsp-settings.nvim": { "branch": "main", "commit": "707b43110daf27c1aec8c16c2a92c2cb9a06f8df" },
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
"none-ls.nvim": { "branch": "main", "commit": "3a4826687da4310af379515086d71faca4d21288" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
"nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" },
"nvim-cmp": { "branch": "main", "commit": "cd2cf0c124d3de577fb5449746568ee8e601afc8" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-treesitter": { "branch": "master", "commit": "d5a1c2b0c8ec5bb377a41c1c414b315d6b3e9432" },
"nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bdccb9c67a42a5e2d99384dc9bfa29b1451528f" },
"nvim-ufo": { "branch": "main", "commit": "4cc3ba9303c0708b81fd681786a4835fd31518ac" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"onedarker.nvim": { "branch": "freeze", "commit": "b00dd2189f264c5aeb4cf04c59439655ecd573ec" },
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"promise-async": { "branch": "main", "commit": "038d05664fedc920ba86720214c84a15ff7432b0" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
"schemastore.nvim": { "branch": "main", "commit": "8c46453bdf84ad91877effb95e0b6c7b51ea7dda" },
"structlog.nvim": { "branch": "main", "commit": "45b26a2b1036bb93c0e83f4225e85ab3cee8f476" },
"tailwind-tools.nvim": { "branch": "master", "commit": "f96222db8da16aa7c3a32455a4e7c20a57550ca6" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" },
"tokyonight.nvim": { "branch": "main", "commit": "67afeaf7fd6ebba000633e89f63c31694057edde" },
"ts-comments.nvim": { "branch": "main", "commit": "98d7d4dec0af1312d38e288f800bbf6ff562b6ab" },
"vim-illuminate": { "branch": "master", "commit": "e522e0dd742a83506db0a72e1ced68c9c130f185" },
"vim-react-snippets": { "branch": "main", "commit": "755e288bd0db1052be4195fcc82a25e28b609e0b" },
"vscode-js-debug": { "branch": "main", "commit": "ca1c6450490dab5d742eac16a08d593533a1a13d" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
}

View File

@ -1,5 +1,4 @@
vim.opt.termguicolors = true
lvim.builtin.bufferline = {
options = {
mode = "buffers",

View File

@ -1,37 +0,0 @@
local sources = require("dropbar.sources")
local function get_hl_color(group, attr)
return vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(group)), attr)
end
vim.cmd [[hi WinBar guisp=#665c54 guibg=#313131]]
vim.cmd [[hi WinBarNC guisp=#665c54 guibg=#313131]]
require("dropbar").setup(
{
bar = {
sources = {
{
get_symbols = function(buf, win, cursor)
local symbols = sources.path.get_symbols(buf, win, cursor)
for _, symbol in ipairs(symbols) do
-- get correct icon color
-- local icon_fg = get_hl_color(symbol.icon_hl, "fg#")
symbol.icon_hl = "DropbarSymbol" .. symbol.icon_hl
local icon_string = ""
-- if icon_fg == "" then
-- icon_string = "hi " .. symbol.icon_hl .. " guisp=#665c54 guibg=#313131"
-- else
-- icon_string = "hi " .. symbol.icon_hl .. " guisp=#665c54 guibg=#313131 guifg=" .. icon_fg
-- end
vim.cmd(icon_string)
end
return symbols
end
}
}
}
}
)

View File

@ -10,9 +10,6 @@ lvim.plugins = {
}
}
},
{
'fgheng/winbar.nvim'
},
{
'Bekaboo/dropbar.nvim',
dependencies = {
@ -112,7 +109,6 @@ lvim.plugins = {
"nvim-telescope/telescope.nvim", -- optional
"ibhagwan/fzf-lua", -- optional
},
config = true,
},
{
"catppuccin/nvim",

25
rust/folds.scm Normal file
View File

@ -0,0 +1,25 @@
[
(mod_item)
(foreign_mod_item)
(function_item)
(struct_item)
(trait_item)
(enum_item)
(impl_item)
(type_item)
(union_item)
(const_item)
(use_declaration)+
(let_declaration)
(loop_expression)
(for_expression)
(while_expression)
(if_expression)
(match_expression)
(call_expression)
(array_expression)
(macro_definition)
(macro_invocation)
(attribute_item)
(block)
] @fold

463
rust/highlights.scm Normal file
View File

@ -0,0 +1,463 @@
; Forked from https://github.com/tree-sitter/tree-sitter-rust
; Copyright (c) 2017 Maxim Sokolov
; Licensed under the MIT license.
; Identifier conventions
(shebang) @keyword.directive
(identifier) @variable
((identifier) @type
(#lua-match? @type "^[A-Z]"))
(const_item
name: (identifier) @constant)
; Assume all-caps names are constants
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
; Other identifiers
(type_identifier) @type
(primitive_type) @type.builtin
(field_identifier) @variable.member
(shorthand_field_initializer
(identifier) @variable.member)
(mod_item
name: (identifier) @module)
[
(self)
"_"
] @variable.builtin
(label
[
"'"
(identifier)
] @label)
; Function definitions
(function_item
(identifier) @function)
(function_signature_item
(identifier) @function)
(parameter
[
(identifier)
"_"
] @variable.parameter)
(closure_parameters
(_) @variable.parameter)
; Function calls
(call_expression
function: (identifier) @function.call)
(call_expression
function: (scoped_identifier
(identifier) @function.call .))
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
(generic_function
function: (identifier) @function.call)
(generic_function
function: (scoped_identifier
name: (identifier) @function.call))
(generic_function
function: (field_expression
field: (field_identifier) @function.call))
; Assume other uppercase names are enum constructors
((field_identifier) @constant
(#lua-match? @constant "^[A-Z]"))
(enum_variant
name: (identifier) @constant)
; Assume that uppercase names in paths are types
(scoped_identifier
path: (identifier) @module)
(scoped_identifier
(scoped_identifier
name: (identifier) @module))
(scoped_type_identifier
path: (identifier) @module)
(scoped_type_identifier
path: (identifier) @type
(#lua-match? @type "^[A-Z]"))
(scoped_type_identifier
(scoped_identifier
name: (identifier) @module))
((scoped_identifier
path: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
((scoped_identifier
name: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
((scoped_identifier
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
((scoped_identifier
path: (identifier) @type
name: (identifier) @constant)
(#lua-match? @type "^[A-Z]")
(#lua-match? @constant "^[A-Z]"))
((scoped_type_identifier
path: (identifier) @type
name: (type_identifier) @constant)
(#lua-match? @type "^[A-Z]")
(#lua-match? @constant "^[A-Z]"))
[
(crate)
(super)
] @module
(scoped_use_list
path: (identifier) @module)
(scoped_use_list
path: (scoped_identifier
(identifier) @module))
(use_list
(scoped_identifier
(identifier) @module
.
(_)))
(use_list
(identifier) @type
(#lua-match? @type "^[A-Z]"))
(use_as_clause
alias: (identifier) @type
(#lua-match? @type "^[A-Z]"))
; Correct enum constructors
(call_expression
function: (scoped_identifier
"::"
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z]"))
; Assume uppercase names in a match arm are constants.
((match_arm
pattern: (match_pattern
(identifier) @constant))
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(scoped_identifier
name: (identifier) @constant)))
(#lua-match? @constant "^[A-Z]"))
((identifier) @constant.builtin
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
; Macro definitions
"$" @function.macro
(metavariable) @function.macro
(macro_definition
"macro_rules!" @function.macro)
; Attribute macros
(attribute_item
(attribute
(identifier) @function.macro))
(inner_attribute_item
(attribute
(identifier) @function.macro))
(attribute
(scoped_identifier
(identifier) @function.macro .))
; Derive macros (assume all arguments are types)
; (attribute
; (identifier) @_name
; arguments: (attribute (attribute (identifier) @type))
; (#eq? @_name "derive"))
; Function-like macros
(macro_invocation
macro: (identifier) @function.macro)
(macro_invocation
macro: (scoped_identifier
(identifier) @function.macro .))
; Literals
[
(line_comment)
(block_comment)
] @comment @spell
(line_comment
(doc_comment)) @comment.documentation
(block_comment
(doc_comment)) @comment.documentation
(boolean_literal) @boolean
(integer_literal) @number
(float_literal) @number.float
[
(raw_string_literal)
(string_literal)
] @string
(escape_sequence) @string.escape
(char_literal) @character
; Keywords
[
"use"
"mod"
] @keyword.import
(use_as_clause
"as" @keyword.import)
[
"default"
"impl"
"let"
"move"
"unsafe"
"where"
] @keyword
[
"enum"
"struct"
"union"
"trait"
"type"
] @keyword.type
[
"async"
"await"
] @keyword.coroutine
"try" @keyword.exception
[
"ref"
"pub"
(mutable_specifier)
"const"
"static"
"dyn"
"extern"
] @keyword.modifier
(lifetime
"'" @keyword.modifier)
(lifetime
(identifier) @attribute)
(lifetime
(identifier) @attribute.builtin
(#any-of? @attribute.builtin "static" "_"))
"fn" @keyword.function
[
"return"
"yield"
] @keyword.return
(type_cast_expression
"as" @keyword.operator)
(qualified_type
"as" @keyword.operator)
(use_list
(self) @module)
(scoped_use_list
(self) @module)
(scoped_identifier
[
(crate)
(super)
(self)
] @module)
(visibility_modifier
[
(crate)
(super)
(self)
] @module)
[
"if"
"else"
"match"
] @keyword.conditional
[
"break"
"continue"
"in"
"loop"
"while"
] @keyword.repeat
"for" @keyword
(for_expression
"for" @keyword.repeat)
; Operators
[
"!"
"!="
"%"
"%="
"&"
"&&"
"&="
"*"
"*="
"+"
"+="
"-"
"-="
".."
"..="
"..."
"/"
"/="
"<"
"<<"
"<<="
"<="
"="
"=="
">"
">="
">>"
">>="
"?"
"@"
"^"
"^="
"|"
"|="
"||"
] @operator
(use_wildcard
"*" @character.special)
; Punctuation
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(closure_parameters
"|" @punctuation.bracket)
(type_arguments
[
"<"
">"
] @punctuation.bracket)
(type_parameters
[
"<"
">"
] @punctuation.bracket)
(bracketed_type
[
"<"
">"
] @punctuation.bracket)
(for_lifetimes
[
"<"
">"
] @punctuation.bracket)
[
","
"."
":"
"::"
";"
"->"
"=>"
] @punctuation.delimiter
(attribute_item
"#" @punctuation.special)
(inner_attribute_item
[
"!"
"#"
] @punctuation.special)
(macro_invocation
"!" @function.macro)
(never_type
"!" @type.builtin)
(macro_invocation
macro: (identifier) @keyword.exception
"!" @keyword.exception
(#eq? @keyword.exception "panic"))
(macro_invocation
macro: (identifier) @keyword.exception
"!" @keyword.exception
(#contains? @keyword.exception "assert"))
(macro_invocation
macro: (identifier) @keyword.debug
"!" @keyword.debug
(#eq? @keyword.debug "dbg"))

117
rust/indents.scm Normal file
View File

@ -0,0 +1,117 @@
[
(mod_item)
(struct_item)
(enum_item)
(impl_item)
(struct_expression)
(struct_pattern)
(tuple_struct_pattern)
(tuple_expression)
(tuple_type)
(tuple_pattern)
(match_block)
(call_expression)
(assignment_expression)
(arguments)
(block)
(where_clause)
(use_list)
(array_expression)
(ordered_field_declaration_list)
(field_declaration_list)
(enum_variant_list)
(parameters)
(token_tree)
(token_repetition)
(macro_definition)
] @indent.begin
; Typing in "(" inside macro definitions breaks the tree entirely
; Making macro_definition becoming errors
; Offset this by adding back one indent for start of macro rules
(ERROR
.
"macro_rules!"
[
"("
"{"
"["
] @indent.begin
(#set! indent.immediate)
(#set! indent.start_at_same_line))
(macro_definition
[
")"
"}"
"]"
] @indent.end)
(trait_item
body: (_) @indent.begin)
(string_literal
(escape_sequence)) @indent.begin
(block
"}" @indent.end)
(enum_item
body: (enum_variant_list
"}" @indent.end))
(impl_item
body: (declaration_list
"}" @indent.end))
(match_expression
body: (match_block
"}" @indent.end))
(mod_item
body: (declaration_list
"}" @indent.end))
(struct_item
body: (field_declaration_list
"}" @indent.end))
(struct_expression
body: (field_initializer_list
"}" @indent.end))
(struct_pattern
"}" @indent.end)
(tuple_struct_pattern
")" @indent.end)
(tuple_type
")" @indent.end)
(tuple_pattern
")" @indent.end)
(trait_item
body: (declaration_list
"}" @indent.end))
(impl_item
(where_clause) @indent.dedent)
[
"where"
")"
"]"
"}"
] @indent.branch
(impl_item
(declaration_list) @indent.branch)
[
(line_comment)
(string_literal)
] @indent.ignore
(raw_string_literal) @indent.auto

91
rust/injections.scm Normal file
View File

@ -0,0 +1,91 @@
(macro_invocation
macro: [
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree) @injection.content
(#not-eq? @_macro_name "slint")
(#set! injection.language "rust")
(#set! injection.include-children))
(macro_invocation
macro: [
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree) @injection.content
(#eq? @_macro_name "slint")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "slint")
(#set! injection.include-children))
(macro_definition
(macro_rule
left: (token_tree_pattern) @injection.content
(#set! injection.language "rust")))
(macro_definition
(macro_rule
right: (token_tree) @injection.content
(#set! injection.language "rust")))
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))
((macro_invocation
macro: (identifier) @injection.language
(token_tree) @injection.content)
(#any-of? @injection.language "html" "json"))
(call_expression
function: (scoped_identifier
path: (identifier) @_regex
(#any-of? @_regex "Regex" "ByteRegexBuilder")
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(raw_string_literal) @injection.content)
(#set! injection.language "regex"))
(call_expression
function: (scoped_identifier
path: (scoped_identifier
(identifier) @_regex
(#any-of? @_regex "Regex" "ByteRegexBuilder") .)
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(raw_string_literal) @injection.content)
(#set! injection.language "regex"))
(call_expression
function: (scoped_identifier
path: (identifier) @_regex
(#any-of? @_regex "RegexSet" "RegexSetBuilder")
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(array_expression
(raw_string_literal) @injection.content))
(#set! injection.language "regex"))
(call_expression
function: (scoped_identifier
path: (scoped_identifier
(identifier) @_regex
(#any-of? @_regex "RegexSet" "RegexSetBuilder") .)
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(array_expression
(raw_string_literal) @injection.content))
(#set! injection.language "regex"))
((block_comment) @injection.content
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
(#set! injection.language "re2c"))

101
rust/locals.scm Normal file
View File

@ -0,0 +1,101 @@
; Imports
(extern_crate_declaration
name: (identifier) @local.definition.import)
(use_declaration
argument: (scoped_identifier
name: (identifier) @local.definition.import))
(use_as_clause
alias: (identifier) @local.definition.import)
(use_list
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
; Functions
(function_item
name: (identifier) @local.definition.function)
(function_item
name: (identifier) @local.definition.method
parameters: (parameters
(self_parameter)))
; Variables
(parameter
pattern: (identifier) @local.definition.var)
(let_declaration
pattern: (identifier) @local.definition.var)
(const_item
name: (identifier) @local.definition.var)
(tuple_pattern
(identifier) @local.definition.var)
(let_condition
pattern: (_
(identifier) @local.definition.var))
(tuple_struct_pattern
(identifier) @local.definition.var)
(closure_parameters
(identifier) @local.definition.var)
(self_parameter
(self) @local.definition.var)
(for_expression
pattern: (identifier) @local.definition.var)
; Types
(struct_item
name: (type_identifier) @local.definition.type)
(constrained_type_parameter
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
(enum_item
name: (type_identifier) @local.definition.type)
; Fields
(field_declaration
name: (field_identifier) @local.definition.field)
(enum_variant
name: (identifier) @local.definition.field)
; References
(identifier) @local.reference
((type_identifier) @local.reference
(#set! reference.kind "type"))
((field_identifier) @local.reference
(#set! reference.kind "field"))
; Macros
(macro_definition
name: (identifier) @local.definition.macro)
; Module
(mod_item
name: (identifier) @local.definition.namespace)
; Scopes
[
(block)
(function_item)
(closure_expression)
(while_expression)
(for_expression)
(loop_expression)
(if_expression)
(match_expression)
(match_arm)
(struct_item)
(enum_item)
(impl_item)
] @local.scope