| Age | Commit message (Collapse) | Author |
|
|
|
|
|
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.
|
|
|
|
|
|
So, there are two problems:
- There was an infinite loop when inc selection was initiated
from an injection.
- The comparison was wrong when the whole file was selected,
this is because ts matches the EOF.
This is an extra line with one char (EOF).
I put a workaround to try to select the node from the main
tree, but we should try to select the node from the parent tree of the
injection, but I wasn't able to get the parent tree from the node.
|
|
|
|
This will avoid using internal data.
|
|
The range from ts nodes are a little different than
neovim's nodes. They start at 0 and the end is exclusive.
For example, a nvim range (1, 3, 2, 4) is the equivalent to the ts
range (0, 2, 1, 4).
Since we may hit parent nodes that have the same range as its child,
we skip those till we find one that actually changes the selection
(since this is the relevant part for the user).
Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/232
|
|
|
|
|
|
|
|
|
|
|
|
- shared query group stuff -> query.lua
- local-specific stuff from ts_utils -> locals.lua
|
|
|
|
|
|
- remove buf_state and related code
- add get_node_at_cursor()
- better incremental selection (code is localized)
|
|
|
|
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
|
|
As suggested in #37, rename the textobj module to incremental_selection.
Also adds a utility function to get the config of a module.
|