Commit graph

32 commits

Author SHA1 Message Date
kiyan
8b748a7570 chore: cleanup main file, move statusline in module 2022-07-18 15:44:59 +02:00
francisco souza
44b7c81002 fix(ts_utils): fix swap_nodes after get_node_text change
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.
2022-04-21 23:57:35 +02:00
ranjithshegde
2490a8bbca fix(statusline): adjust to the new API (query) 2022-04-18 17:52:18 +02:00
Christian Clason
2248b64781 fix(statusline): don't use deprecated function 2022-04-18 15:36:28 +02:00
Stephan Seitz
c3848e713a chore: deprecate ts_utils.get_node_text 2022-04-18 14:17:51 +02:00
Santos Gallegos
be8f656087
Use stylua for autoformat code (#1480) 2021-07-04 21:12:17 +00:00
Stephan Seitz
3727be629c Remove 'CI' guard (we can have now the newest version of nvim again) 2020-12-07 13:30:45 +01:00
Stephan Seitz
fccc159b48 fix: make version check work on non-CI environments 2020-11-23 20:09:04 +01:00
Thomas Vigouroux
808765a6c8
fix: update interface following languagetree merge (#687) 2020-11-23 12:46:27 -06:00
Kristijan Husak
9ad47c65bd Use utils get_node_text to get line content and trim all whitespaces. 2020-10-11 13:35:18 +02:00
Kristijan Husak
3aa7e575e2 Remove old statusline implementation with new one. 2020-10-11 13:35:18 +02:00
Kristijan Husak
62df1143da Add implementation for improved statusline. Closes #545. 2020-10-11 13:35:18 +02:00
Stephan Seitz
38df2d252f Add warning about required Neovim version 2020-09-03 15:33:18 +02:00
Steven Sojka
579c9936d6 feat(highlights): add is predicate 2020-08-16 09:04:07 -05:00
Steven Sojka
884080f89a feat(configs): dynamic module defintions 2020-07-07 13:53:23 +02:00
kiyan42
7f6f7596da add used_by key to parsers
Enables the use of multiple filetypes for one parser.
2020-06-29 17:18:22 +02:00
Thomas Vigouroux
ec903ac99d fix(statusline): don't call if no parser 2020-06-21 19:50:24 +02:00
kiyan42
df17a48c85 refactor: parser list and lang->ft/ft->lang
- move parser list in `parsers.lua`
- most `ft` variable where changed to `lang`, `ft` is only used on
  autocmd binding, and lang is used for everything else. Functions have
  been defined to make the switch between `ft` and `lang`
2020-06-20 12:31:52 +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
kiyan42
8be2dc64a2 Expose internal api.
- add `exposed_state` to expose 'current_node' and 'cursor_pos'
for a current buffer to the user.
- add `get_buf_state` and `get_node_api` for users.
- add documentation about api functions.
- remove `node_movement` module which should be done in user side.
2020-05-15 14:19:29 +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
7682a1a49f feat: provide a statusline indicator
It will show the current branch at the cursor going the tree as such.
root->node->subnode->leaf

If an argument is provided to `statusline`, then the tree will be
truncated as follows :
..->subnode->subnode
2020-05-05 20:06:45 +02:00
kiyan42
f489b4b0a3 fix: config is enabled also checks parser existence 2020-04-25 16:18:53 +02:00
kiyan42
62786ec7c6 feat/refacto: improve configurations
- You should now get the configs through functions
- Configs for languages are now inside a local object called parsers
- You can get the parser installation configurations with `get_parser_configs`
- A new object has been initialized inside configs to specify module config (called config).
- Provide functions to enable/disable a module on one buffer
- Provide functions to enable/disable a module on all buffers, and if filetype is
  specified, for specific filetype
- Provide function to determine if module is activated for a specified filetype
2020-04-24 22:15:21 +02:00
Thomas Vigouroux
d05728e155 feat: syntax highlighting 2020-04-22 22:02:42 +02:00
kiyan42
62ce7744db feat/refacto: add configs.lua, setup install
- configs.lua holds the `repositories` data
- install health moved to health.lua
- plugins loads _root.setup() on startup
- install and list command are available through vim
> use them with `:TSInstall lang` and `:TSInstallInfo`
2020-04-21 23:40:23 +02:00
kiyan42
0de42dd7fb feat: add parser list 2020-04-20 22:33:13 +02:00
Thomas Vigouroux
d25549917d perf: don't compute locals on buffer updates
Instead we lazily evaluate them on request.
This allow two things :
    * better performances
    * being sure the locas are up to date
2020-04-19 20:16:03 +02:00
Thomas Vigouroux
b2b6e51a7c feat: add locals to setup procedure 2020-04-19 17:28:59 +02:00
kiyan42
2967ca5203 add parser installer 2020-04-19 15:13:38 +02:00
Thomas Vigouroux
2526baf4cc feat: add parsers module and better match iter
The `parsers` module manages parsers for us, for now only in a really
basic way.

iter_prepared_mathes iters on an enhanced versions of the matches, where
captures are directly accessible via their names to allow things like :
    ((itentifier) @def.first (identifier) @def.last)
To be handled like this in lua:
    match.def.first
    match.def.last

Also adds a `set!` predicate to allow setting data within the prepared
match (see queries/lua/locals.scm) for examples.
2020-04-19 09:45:54 +02:00
Thomas Vigouroux
5897d72b07 feat: add empty setup function
Will be used later to setup everything so that a language works properly
in each situation.
2020-04-18 19:32:51 +02:00