Describe the bug
The treesitter highlighting is fast and awesome.But when syntax error occurs , the highlight groups will take effect, which is a hassle.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Output of :checkhealth nvim_treesitter *
health#nvim_treesitter#check
========================================================================
## Installation
- OK: `git` executable found.
- OK: `cc` executable found.
## html parser healthcheck
- OK: html parser found.
- WARNING: No `locals.scm` query found for html
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: `highlights.scm` found.
## c parser healthcheck
- OK: c parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## java parser healthcheck
- OK: java parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## python parser healthcheck
- OK: python parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## cpp parser healthcheck
- OK: cpp parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## go parser healthcheck
- OK: go parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## javascript parser healthcheck
- OK: javascript parser found.
- OK: `locals.scm` found.
- OK: `highlights.scm` found.
## css parser healthcheck
- OK: css parser found.
- WARNING: No `locals.scm` query found for css
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: `highlights.scm` found.
## Missing parsers
- WARNING: Some parsers are not installed:
typescript
regex
nix
swift
yaml
elm
vue
toml
lua
ruby
ocaml
scala
haskell
rust
json
markdown
julia
php
c_sharp
bash
tsx
- ADVICE:
- Install them using `:TSInstall language
Output of nvim --version
NVIM v0.5.0-576-g7efb302d2
Additional context
Add any other context about the problem here.
Should be solved by #117
The corresponding highlight is TSError. I don't know how to delete highlights without overwriting them so I use a hack:
require "nvim-treesitter.highlight"
local hlmap = vim.treesitter.TSHighlighter.hl_map
--Misc
hlmap.error = nil
This table also contains the other highlights
hlmap.error = nil
hlmap["punctuation.delimiter"] = "Delimiter"
hlmap["punctuation.bracket"] = nil
-- Constants
hlmap["constant"] = "Constant"
hlmap["constant.builtin"] = "Type"
hlmap["constant.macro"] = "Define"
hlmap["string"] = "String"
hlmap["string.regex"] = "String"
hlmap["string.escape"] = "SpecialChar"
hlmap["character"] = "Character"
hlmap["number"] = "Number"
hlmap["boolean"] = "Boolean"
hlmap["float"] = "Float"
-- Functions
hlmap["function"] = "Function"
hlmap["function.builtin"] = "Special"
hlmap["function.macro"] = "Macro"
hlmap["parameter"] = "Identifier"
hlmap["method"] = "Function"
hlmap["field"] = "Identifier"
hlmap["property"] = "Identifier"
hlmap["constructor"] = "Type"
-- Keywords
hlmap["conditional"] = "Conditional"
hlmap["repeat"] = "Repeat"
hlmap["label"] = "Label"
hlmap["operator"] = "Operator"
hlmap["keyword"] = "Repeat"
hlmap["exception"] = "Exception"
hlmap["include"] = "Include"
hlmap["type"] = "Type"
hlmap["type.builtin"] = "Type"
hlmap["structure"] = "Structure"
@vigoux knows more. Can you help me with #117
To disable this hihglight, adding the following will be enough:
highlight link TSError Normal
Did you try it? I also thought this would work but somehow my plug config executes the plugin code after my init.vim so that your line has no effect.
I would need to execute it manually after start up.
Edit: #121 solves this issue.
It should have been solved by #121
I have tried it.It works well to disable the highlighting of syntax errors. Thanks for your work.