Commit graph

15 commits

Author SHA1 Message Date
Thomas Vigouroux
808765a6c8
fix: update interface following languagetree merge (#687) 2020-11-23 12:46:27 -06:00
Thomas Vigouroux
6eca8d2f38 parser: only use parse to get a tree
This will avoid using internal data.
2020-11-03 21:16:51 +01:00
Santos Gallegos
9c456edb3a Incremental selection: fix skipping some nodes
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
2020-09-07 18:24:55 +02:00
evakuator
92c18c8efa use xmap in detach 2020-09-01 20:50:31 +02:00
evakuator
c5d5e48e0f use xmap instead of vmap in textobjects 2020-09-01 20:50:31 +02:00
Steven Sojka
3fe8bbcf9c fix(modules): do not reattach if already attached 2020-08-22 06:07:21 -05:00
Rafał Camlet
3c7528a294 Add noremap option to mappings 2020-08-06 13:28:53 +02:00
kiyan42
a855538e0a fix decremental selection 2020-08-02 20:14:34 +02:00
Stephan Seitz
8cf2dc7f9a Refactor locals.lua:
- shared query group stuff -> query.lua
- local-specific stuff from ts_utils -> locals.lua
2020-07-16 09:34:31 +02:00
Stephan Seitz
69cabc69be Add textobjects module 2020-07-14 22:34:43 +02:00
Stephan Seitz
5642507f6a Make luacheck happy 2020-07-05 19:21:06 +02:00
kiyan42
38af29a912 refacto: remove buf_state
- remove buf_state and related code
- add get_node_at_cursor()
- better incremental selection (code is localized)
2020-06-19 13:45:33 +02:00
Stephan Seitz
3b3a692e2c Remove postspaces and avoid one global 2020-05-22 17:07:28 +02:00
kiyan42
45dcebb15f refacto/feat: better handling of parser updates
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
2020-05-12 16:16:48 +02:00
Thomas Vigouroux
39da51bbd1 modules: move textobj to incremental_selection
As suggested in #37, rename the textobj module to incremental_selection.
Also adds a utility function to get the config of a module.
2020-05-02 13:29:40 +02:00
Renamed from lua/nvim-treesitter/textobj.lua (Browse further)