aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Helwer <ahelwer@users.noreply.github.com>2021-07-08 20:31:00 -0400
committerGitHub <noreply@github.com>2021-07-09 00:31:00 +0000
commit08c6a3fb555288250523faf652f2d225f4aceeba (patch)
tree320dc3123ce731c164659344e8cc0d769f1e39dd
parenthighlights(rust): Reorder macro queries (diff)
downloadnvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar.gz
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar.bz2
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar.lz
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar.xz
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.tar.zst
nvim-treesitter-08c6a3fb555288250523faf652f2d225f4aceeba.zip
Add info about queries and filetype detection to Adding Parsers section of README (#1533)
* Updated Adding Parsers section of README Added info about necessity of manually adding queries Added info about filetype detection * Updated troubleshooting section Added suggestion to check for missing queries or filetype detection
-rw-r--r--README.md17
1 files changed, 15 insertions, 2 deletions
diff --git a/README.md b/README.md
index c8c9fc8c0..a16926cea 100644
--- a/README.md
+++ b/README.md
@@ -305,6 +305,12 @@ EOF
You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install directly from a `grammar.js` in the top-level directory specified by `url`.
Once the parser is installed, you can update it (from the latest revision of the `main` branch if `url` is a Github repository) with `:TSUpdate zimbu`.
+Note that neither `:TSInstall` nor `:TSInstallFromGrammar` copy query files from the grammar repository.
+If you want your installed grammar to be useful, you must manually [add query files](#adding-queries) to your local nvim-treesitter installation.
+Note also that module functionality is only triggered if your language's filetype is correctly identified.
+If Neovim does not detect your language's filetype by default, you can add a short Vimscript file to nvim-treesitter's `ftdetect` runtime directory.
+See [Neovim's documentation](https://neovim.io/doc/user/filetype.html#new-filetype) on how to use Vimscript to detect a filetype.
+
## Update parsers used_by
Sometimes needs to use some parser for different filetype.
@@ -400,10 +406,17 @@ It can also help to update the parsers via `:TSUpdate`.
#### Feature `X` does not work for `{language}`...
-First, check the `## {language} parser healthcheck` section of `:checkhealth` for any warning.
+First, check the `health#nvim_treesitter#check` and the `health#treesitter#check` sections of `:checkhealth` for any warning.
If there is one, it's highly likely that this is the cause of the problem.
-If everything is okay, then it might be an actual error.
+Next check the `## Parser/Features` subsection of the `health#nvim_treesitter#check` section of `:checkhealth` to ensure the desired module is enabled for your language.
+If not, you might be missing query files; see [Adding queries](#adding-queries).
+
+Finally, ensure Neovim is correctly identifying your language's filetype using the `:echo &filetype` command while one of your language's files is open in Neovim.
+If not, add a short Vimscript file to nvim-treesitter's `ftdetect` runtime directory following [Neovim's documentation](https://neovim.io/doc/user/filetype.html#new-filetype) on filetype detection.
+You can also quickly & temporarily set the filetype for a single buffer with the `:set filetype=langname` command to test whether it fixes the problem.
+
+If everything is okay, then it might be an actual error.
In that case, feel free to [open an issue here](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose).
#### I get `module 'vim.treesitter.query' not found`