After some discussion, it looks like the easiest thing to do for now is
to keep a private copy of get_node_text (just to skip the deprecation
message) and invoke that, until core provides an equivalent function
that can return the node content in a table representing the node
"lines".
Also fixes the statusline by calling the private version for
get_node_text until a change is made in core.
Offset encoding is a mandatory argument to
`vim.lsp.util.apply_text_edits` since bc722c8a74
Since we are always within a Neovim context, we can just pass `"utf-8"`.
https://github.com/nvim-treesitter/nvim-treesitter/pull/1829
half fixed incremental selection for the vim parser,
but other bugs still remain (infinite selection and skip selecting the
root node).
Problems can be replicated with these two files:
(missing selecting the root node)
```vim
set scrolloff=7
set scrolloff=7
```
(infinite loop)
```vim
set scrolloff=7
```
The main problem is that we try to map
the current selection range to a TS range,
but the TS range of a node could include the EOL/EOL marks
so it's impossible to know when to change the vim range
to match the TS range, is more easy to transform the
TS range to a vim range and do the comparison.
Be sure to call `parser:parser()` to get a tree instead of getting the
tree directly. This will not cost anything is the buffer is freshly
parsed.
Fixes#181
features:
- node_movement is moving between scopes.
- add selection initialization from normal mode
- add a decremental selection
improvements:
- attach to buffer to run tree parsing on change
- run state update on CursorMoved
- the buffer state is:
```
{
cursor_pos = { row=row, col=col },
current_node = node_under_cursor,
selection = {
range = nil, -- activates when starting a selection
nodes = {} -- filling up when starting an incremental selection
},
parser = parser, -- parser for current buffer
}
```
- refacto all the modules reliant on parsing the tree, update the current nodes, get the current nodes...
fixes:
- fix has_parser to look for .so libraries
- fix should select the whole file when selection root in selection