-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(treesitter): no longer depends on nvim-treesitter #151
base: main
Are you sure you want to change the base?
Conversation
Will bump neovim version to 0.9. However, the stable version is 0.7.2 from https://packages.debian.org/search?keywords=neovim. We can write adaptive functions to be compatible with 0.7.2. |
Should be done now. I think there's only |
else | ||
parser = parsersCache:get(srcBufnr) | ||
if parser and not api.nvim_buf_is_valid(parser:source()) then | ||
parser = nil | ||
parsersCache:set(srcBufnr, nil) | ||
end | ||
end | ||
if parser and configs.is_enabled('highlight', parser:lang(), srcBufnr) then | ||
if parser and treesitter.highlighter.active[srcBufnr] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without nvim-treesitter
, we can't decide whether the buffer of lang should render, so the condition may be meanless.
highlighter.active[bufnr]
checks whether the target buffer is rendered by treesitter or not, it is incorrect to use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way to enable treesitter highlighting is vim.treesitter.start
in the future, nvim-treesitter
will no longer needed, the config module is removed in the experimental branch, see https://github.com/nvim-treesitter/nvim-treesitter/tree/main.
In the meantime, it is supported in neovim 0.10 now, now c
, lua
, and vim
parsers and corresponding queries are bundled within neovim distribution, so everyone has treesitter bundled and highlight enabled for lua, see https://github.com/neovim/neovim/blob/5931f780e0282ad486fa070bb05b3877cc1d44f0/runtime/ftplugin/lua.lua#L2
nvim-treesitter
will only provide extra parsers and queries in the experimental main
branch and the future 1.0 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, we need a prediction to decide whether the buffer of lang should render, highlighter.active[bufnr]
is a state here, not a prediction. Without nvim-treesitter
, passby this condition. If you have any ideas for prediction, write it to code directly.
Second, we must keep the original configs.is_enabled
for nvim-treesitter
.
else | ||
parser = parsersCache:get(srcBufnr) | ||
if parser and not api.nvim_buf_is_valid(parser:source()) then | ||
parser = nil | ||
parsersCache:set(srcBufnr, nil) | ||
end | ||
end | ||
if parser and configs.is_enabled('highlight', parser:lang(), srcBufnr) then | ||
if parser and treesitter.highlighter.active[srcBufnr] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, we need a prediction to decide whether the buffer of lang should render, highlighter.active[bufnr]
is a state here, not a prediction. Without nvim-treesitter
, passby this condition. If you have any ideas for prediction, write it to code directly.
Second, we must keep the original configs.is_enabled
for nvim-treesitter
.
Update: I have temporarily frozen this PR because I realized that upstream is still making changes to the API. |
The former API was already removed on the develop
main
branch of thenvim-treesitter
repo.