diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2025-04-27 16:08:59 +0200 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 53d7118483e5c0d7bbe5548a2c158dc6fd35f699 (patch) | |
| tree | 0ba10d8ed4543f216ccc5bdf77f040edbd0ed2ba /scripts/format-queries.lua | |
| parent | feat(install)!: always generate from json if possible (diff) | |
| download | nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar.gz nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar.bz2 nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar.lz nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar.xz nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.tar.zst nvim-treesitter-53d7118483e5c0d7bbe5548a2c158dc6fd35f699.zip | |
refactor(lua): fix some luals warnings
Diffstat (limited to 'scripts/format-queries.lua')
| -rwxr-xr-x | scripts/format-queries.lua | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/format-queries.lua b/scripts/format-queries.lua index c7362687e..bc2cf70ce 100755 --- a/scripts/format-queries.lua +++ b/scripts/format-queries.lua @@ -351,7 +351,7 @@ end ---@param bufnr integer ---@param node TSNode ---@param lines string[] ----@param q table<string, vim.treesitter.query.TSMetadata> +---@param q table<string, table[]> ---@param level integer local function iter(bufnr, node, lines, q, level) --- Sometimes 2 queries apply append twice. This is to prevent the case from happening @@ -430,19 +430,19 @@ end ---@param queries string local function format(bufnr, queries) local lines = { '' } - -- stylua: ignore + ---@type table<string,table<string,table>> local map = { - ['format.ignore'] = {}, -- Ignore the node and its children - ['format.indent.begin'] = {}, -- +1 shiftwidth for all nodes after this - ['format.indent.dedent'] = {}, -- -1 shiftwidth for this line only - ['format.prepend-space'] = {}, -- Prepend a space before inserting the node - ['format.prepend-newline'] = {}, -- Prepend a \n before inserting the node - ['format.append-space'] = {}, -- Append a space after inserting the node - ['format.append-newline'] = {}, -- Append a newline after inserting the node - ['format.cancel-append'] = {}, -- Cancel any `@format.append-*` applied to the node - ['format.cancel-prepend'] = {}, -- Cancel any `@format.prepend-*` applied to the node - ['format.replace'] = {}, -- Dedicated capture used to store results of `(#gsub!)` - ['format.remove'] = {}, -- Do not add the syntax node to the result, i.e. brackets [], parens () + ['format.ignore'] = {}, -- Ignore the node and its children + ['format.indent.begin'] = {}, -- +1 shiftwidth for all nodes after this + ['format.indent.dedent'] = {}, -- -1 shiftwidth for this line only + ['format.prepend-space'] = {}, -- Prepend a space before inserting the node + ['format.prepend-newline'] = {}, -- Prepend a \n before inserting the node + ['format.append-space'] = {}, -- Append a space after inserting the node + ['format.append-newline'] = {}, -- Append a newline after inserting the node + ['format.cancel-append'] = {}, -- Cancel any `@format.append-*` applied to the node + ['format.cancel-prepend'] = {}, -- Cancel any `@format.prepend-*` applied to the node + ['format.replace'] = {}, -- Dedicated capture used to store results of `(#gsub!)` + ['format.remove'] = {}, -- Do not add the syntax node to the result, i.e. brackets [], parens () } local root = ts.get_parser(bufnr, 'query'):parse(true)[1]:root() local query = ts.query.parse('query', queries) |
