aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md7
-rw-r--r--README.md2
-rw-r--r--lua/nvim-treesitter/locals.lua457
3 files changed, 5 insertions, 461 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 81cd45dbb..ed87f8284 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -51,10 +51,10 @@ Each of these `scheme` files contains a _tree-sitter query_ for a given purpose.
Before going any further, we highly suggest that you [read more about tree-sitter queries](https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries).
Each query has an appropriate name, which is then used by modules to extract data from the syntax tree.
-For now these are the types of queries used by `nvim-treesitter`:
+For now these are the types of queries provided by `nvim-treesitter`:
- `highlights.scm`: used for syntax highlighting, using the `highlight` module.
-- `locals.scm`: used to extract keyword definitions, scopes, references, etc, using the `locals` module.
+- `locals.scm`: used to extract keyword definitions, scopes, references, etc. (not used in this plugin).
- `textobjects.scm`: used to define text objects.
- `folds.scm`: used to define folds.
- `injections.scm`: used to define injections.
@@ -296,7 +296,8 @@ Locals are used to keep track of definitions and references in local or global
scopes, see [upstream
documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
Note that nvim-treesitter uses more specific subcaptures for definitions and
-**does not use locals for highlighting**.
+**does not use locals** (for highlighting or any other purpose). These queries
+are only provided for (limited) backwards compatibility.
```query
@local.definition ; various definitions
diff --git a/README.md b/README.md
index d3de57759..5b04cf86c 100644
--- a/README.md
+++ b/README.md
@@ -118,7 +118,7 @@ Injections are used for multi-language documents, see `:h treesitter-language-in
## Locals
-These queries can be used to look up definitions and references to identifiers in a given scope. They are used, e.g., by the `nvim-treesitter-refactor` plugin.
+These queries can be used to look up definitions and references to identifiers in a given scope. They are not used in this plugin and are provided for (limited) backward compatibility.
# Advanced setup
diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua
deleted file mode 100644
index 6bddb752f..000000000
--- a/lua/nvim-treesitter/locals.lua
+++ /dev/null
@@ -1,457 +0,0 @@
--- Functions to handle locals
--- Locals are a generalization of definition and scopes
--- it's the way nvim-treesitter uses to "understand" the code
-
-local api = vim.api
-local ts = vim.treesitter
-
-local M = {}
-
-local function get_named_children(node)
- local nodes = {} ---@type TSNode[]
- for i = 0, node:named_child_count() - 1, 1 do
- nodes[i + 1] = node:named_child(i)
- end
- return nodes
-end
-
--- Creates unique id for a node based on text and range
----@param scope TSNode: the scope node of the definition
----@param node_text string: the node text to use
----@return string: a string id
-function M.get_definition_id(scope, node_text)
- -- Add a valid starting character in case node text doesn't start with a valid one.
- return table.concat({ 'k', node_text or '', scope:range() }, '_')
-end
-
--- Gets a table with all the scopes containing a node
--- The order is from most specific to least (bottom up)
----@param node TSNode