Comments (15)
this is an issue with neovim's api. A refactoring was coming up but got delayed because the author is not available. We will try to fix that issue ourselves, we'll keep this issue updated in the meantime
from nvim-treesitter.
Hi, the ERROR highlight is easily fixable:
require "nvim-treesitter".setup()
require "nvim-treesitter.highlight"
local hlmap = vim.treesitter.TSHighlighter.hl_map
--Misc
hlmap.error = nil
We probably should default to that. Then, @error
is not highlighted for you. hlmap defines how the tree-sitter queries are translated to Vim hightlight groups. I maintain my own mapping:
require "nvim-treesitter.highlight"
local hlmap = vim.treesitter.TSHighlighter.hl_map
--Misc
hlmap.error = nil
hlmap["punctuation.delimiter"] = "Delimiter"
hlmap["punctuation.bracket"] = "Delimiter"
-- 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"
The issues that you're observing are problems introduced by the last runtime update of Neovim built-in treesitter. Apparently, the code that's performing the regex queries still has some bugs.
from nvim-treesitter.
Treesitter highlighting is a completely different mechanism than standard highlighting. tbh they don't even share any single line of code (on the implementation side). Thus if you define syntax groups, treesitter will just not know that, you have to use queries to do so.
The colors changed and that's normal, treesitter highlighting tries to bring meaning together with colors, here for example, in red you find keywords, green are function calls and so on. So the colorscheme changed yes, but if you compare you go code and you typescript code, they look uniform and consistent on the highlighting side. To customize the behaviour though, you can customize the highlight groups nvim-treesitter
uses using :highlight link {TSHlGroup} {TheGroupYouWant}
.
from nvim-treesitter.
Ok. I got it. I will try to define them. Thanks .
from nvim-treesitter.
@PitcherTear22 It's my plugin spaceline.vim
from nvim-treesitter.
Would this be causing this issue I'm seeing?
from nvim-treesitter.
Yep, both of them are related, the way you can help is tell us the edit you did to cause that. Because that's actually the tree getting out of sync.
from nvim-treesitter.
@vigoux Sounds good. I'm getting it a lot on typescript code. Seems to be on just inserting text. Is this something we can fix or does it need to be fixed upstream in nvim?
from nvim-treesitter.
It needs to be fixed upstream. And it is related to especially gnarly parts of neovim, thus it requires quite q bit of effort (at least for me...) to fix.
from nvim-treesitter.
Same issue here. I found it has some problems with syntax. I defined some syntax group in my colorscheme. when i install treesitter. It didn't follow syntax group,It even changed the color scheme.
With typescript. It works better than default regexengine2
,But it looks like I didn't get more color schemes.
from nvim-treesitter.
@vigoux Aha thanks. About this highlight link {TSHlGroup} {TheGroupYouWant}
. I think i know the {TheGroupYouWant}
that the syntax group i defined in my colorscheme of ts or other language syntax group. This {TSHlGroup}
mean these?
require "nvim-treesitter.highlight"
local hlmap = vim.treesitter.TSHighlighter.hl_map
--Misc
hlmap.error = nil
hlmap["punctuation.delimiter"] = "Delimiter"
hlmap["punctuation.bracket"] = "Delimiter"
-- 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"
from nvim-treesitter.
Hmm you have a pretty old version of the plugin, I mean these. Update to latest master (on both neovim and the plugin) so that you can configure this how you like it.
from nvim-treesitter.
Just an update here, the only problem that isn't fixed is
When the using folds, some parts of the code doesn't get highlighted. This happens when I open a file where the text is folded (syntax is highlighted as normal), then go to the last line with G (syntax isn't highlighted, the whole text is white). This is fixed by forcing a redraw with .
I have updated the description
from nvim-treesitter.
I can't replicate this anymore with folding, but it still happens with other cases like #235. I'm closing this in favor of the other issue.
from nvim-treesitter.
Same issue here. I found it has some problems with syntax. I defined some syntax group in my colorscheme. when i install treesitter. It didn't follow syntax group,It even changed the color scheme.
With typescript. It works better than default
regexengine2
,But it looks like I didn't get more color schemes.
What colorscheme and font is this?
from nvim-treesitter.
Related Issues (20)
- neovim freezes if ampersand on string in typescript files HOT 2
- python: arguments in Callable not highlighted as types HOT 1
- tree-sitter-disassembly issue HOT 5
- Consider adding a highlight capture for struct/enum/union keywords HOT 13
- [Question]: How to disable conceal highlight?
- E5108: Error executing lua ...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:58: attempt to index field 'local' (a nil value) HOT 3
- nvim_treesitter#indent() should respect `breakindent` settings HOT 1
- conceal HOT 9
- Misleading capture names for type qualifiers and lifetimes HOT 4
- Markdown missing header mark highlights HOT 5
- Inconsitent highlighting between instances
- Error while highlighting markdown with code fences after update. HOT 4
- feat: add gularen parser HOT 1
- Delay actual highlight to make buffer open instantly HOT 2
- Typescript parser cannot be installed HOT 2
- `///` comments are not parsed as doxygen HOT 5
- Add fold text function as well as foldexpr function HOT 1
- My Custom Highlight Change Due To Update HOT 1
- Error detected while processing BufReadPost Autocommands for "*": HOT 4
- My Custom Highlight Change Due To Update HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-treesitter.