Commit graph

47 commits

Author SHA1 Message Date
Amaan Qureshi
853b1ab39a style: fill in missing code docs wherever applicable 2023-02-24 01:08:23 -08:00
dundargoc
4612212c72 docs: fix typos 2023-02-23 11:39:43 -08:00
Attila Tajti
6ed8a41bd5 utils: respect shellslash setting
Use '/' as path separator on Windows when shellslash is set.
2022-12-14 17:27:16 +01:00
Lewis Russell
0948bf2274 feat(emmy): add emmylua annotations 2022-10-31 12:00:45 +01:00
Kiyan
91ee9e7376
fix(typo): utils.create_or_resue_writable_dir -> reuse (#3194) 2022-07-18 12:43:31 +02:00
Christian Clason
225b474560 chore: reformat with Stylua 0.14.0 2022-07-07 09:18:05 +02:00
Duncan McDougall
901ffe1a36
Add support for custom parser install locations #2959 (#3031) 2022-06-20 22:50:07 +02:00
kiyan
c2ec0cac81 fix(commands): add -bar to allow other commands
addresses #2920
2022-05-14 12:58:07 +02:00
badhi
503c99d766 typo fix 2022-02-13 10:39:55 +01:00
badhi
738a0136dd added doc for setup_command 2022-02-13 10:39:55 +01:00
badhi
0b10e96e0e Fixed formatting 2022-02-13 10:39:55 +01:00
badhi
763e0e43f7 Added extra argument to setup commands so that user can change the function args types 2022-02-13 10:39:55 +01:00
kiyan
58a4897e6d refacto: deprecate used_by in parsers.lua
- remove print_warning function from utils.lua (unused)
- cleanup some functions in parsers.lua (parameters overloading
  and wrong bufnr used).
- log a deprecation notice when using used_by in a parser definition
- default the filetype_to_parsername table to the list of filetypes
  previously in the used_by keys
- update the README to indicate that change
2022-02-06 14:30:57 +01:00
Christian Clason
bb319daf5f feat: specify abi version for generate on newer ts cli
Check tree-sitter CLI version and if > 0.20.3 and generating a parser
from grammar, use `--abi=vim.treesitter.language_version`.

Besides being able to opt-in to newer ABI benefits, this is a necessary
workaround for an upstream bug with 0.20.3, where `parser.h` is not
generated if the (optional) `--abi` flag is omitted.
2022-01-22 22:56:50 +01:00
Santos Gallegos
55860a76d9 Use wrapper around vim.notify with common options
Ref https://github.com/nvim-treesitter/nvim-treesitter/pull/1927#issuecomment-947064843
2021-10-22 23:46:16 +02:00
Santos Gallegos
be8f656087
Use stylua for autoformat code (#1480) 2021-07-04 21:12:17 +00:00
Shane Hird
5f60666d97 Fixed linting issues 2021-07-04 14:59:13 +02:00
Shane Hird
303121e0ec Improved passing bang to functions 2021-07-04 14:59:13 +02:00
Shane Hird
76ea2b8871 TSUpdate does not install if up to date 2021-07-04 14:59:13 +02:00
Shane Hird
b46580fb66 Use bang for TSInstall commands 2021-07-04 14:59:13 +02:00
Stephan Seitz
826683b1bf Fix: allow empty path in utils.get_at_path 2021-04-06 21:48:25 +02:00
Steven Sojka
6863f79118
refactor(all): language tree adaption (#1105) 2021-03-30 08:18:24 -05:00
Steven Sojka
7984975a2f
feat(install): allow ignore list when installing parsers (#1098) 2021-03-24 09:12:03 -05:00
kiyan
9d57216c0d chore: remove useless code and indent files 2021-02-27 13:36:33 +01:00
Brian Shu
28f2ba475f fixed not highlighting bug 2021-01-08 16:16:33 +01:00
Brian Shu
e0b49a9a18 added attach async 2021-01-07 11:16:16 +01:00
Stephan Seitz
25bf605940 Only update outdated_parsers on TSUpdate 2020-11-25 08:04:54 +01:00
Stephan Seitz
b66b533ecd chore: dedup join_paths <-> join_path 2020-09-28 17:40:34 +02:00
Stephan Seitz
0a51d492a5 Add lockfile and make lockfile default install revision 2020-09-27 13:09:12 +02:00
Florian Beeres
18adc9e176
Make :TSInstall work in Nix by adding a second module installation target (#473)
* Ignore tags file in project root

* Make :TSInstall work with Nix

This commit adds logic to determine where to install parsers, meaning
the *.so files. Until now the package path of the nvim-treesitter plugin
was used. But when installed with Nix, the plugin lands in "/nix/store",
which is read-only.

With this commit $XDG_DATA_HOME/nvim/site/parser/*.go will be used as
the parser installation path. The directory will be created if it
doesn't exist.

* Add generate_join function

The generate_join function is used to create two other functions, one
to join path segments, the other to join strings with a space for error
messages.
2020-09-18 09:44:07 +02:00
Markus Koller
fd6d09fd1f Find package path based on the Lua source file
This is more robust compared to the previous method where we walked
up the tree and matched on the directory name, which also required
that the repository was cloned in a directory named `nvim-treesitter`.
2020-09-10 15:11:04 +02:00
Stephan Seitz
5948aba886 feat(refactor.navigation): add navigation.goto_{next,previous}_usage 2020-08-31 18:56:41 +02:00
Oleg Matrokhin
ac13baadb6 remove second check 2020-08-30 23:48:11 +02:00
Oleg Matrokhin
cf9df71341 fix get_package_path function for paths with trailing slash 2020-08-30 23:48:11 +02:00
Stephan Seitz
ce7efd34c6 Add Windows support (mingw) 2020-08-27 22:20:30 +02:00
Stephan Seitz
32271b26ef Textobjects: set jump before going to adjacent_textobject 2020-08-17 17:45:46 +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
Steven Sojka
d73500eaa6 refactor(refactor): use higher local apis and some cleanup 2020-06-30 08:21:01 +02:00
Steven Sojka
058e8d2296 feat(refactor): highlight usages module 2020-06-30 08:21:01 +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
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
Stephan Seitz
d0b84dd89f Add 'nvim-treesitter/node-movement' 2020-05-03 10:51:15 +02:00
Thomas Vigouroux
7c7d4e5270 textobj: little refactor 2020-04-25 21:46:22 +02:00
Thomas Vigouroux
c62685841e textobj: add incremental scope selection 2020-04-25 21:46:22 +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
30b34fa505 feat: add node manipulation utils 2020-04-20 22:22:33 +02:00