Commit graph

1195 commits

Author SHA1 Message Date
Santos Gallegos
72f5d72413 LanguageTree: don't error when injecting a language 2020-10-21 16:20:52 +02:00
Thomas Vigouroux
e9129eee49 fix(languagetree): avoid language self-injection
This avoids some stack overflows when a language includes itself.
This is a temporary solution, and will be addressed later when actually
managing our own parsers.
2020-10-21 08:36:23 +02:00
Zeger Van de Vannet
392c4b978b Add verilog/systemverilog queries 2020-10-20 16:33:13 +02:00
Stephan Seitz
4da47d6dea Remove textobjects from built_in_query_groups 2020-10-19 22:36:38 +02:00
kiyan42
1735528db5 Treesitter indent
also fixes the memoize_by_buf_tick function
2020-10-19 21:08:15 +02:00
kiyan42
36b5f6f075 start indent module 2020-10-19 21:08:15 +02:00
Thomas Vigouroux
f7d92f663c feat(languagetree): implement language tree
Allow the LanguageTree to be used as an option for highlighting.

Co-authored-by: Santos Gallegos <stsewd@protonmail.com>
Co-authored-by: Yazdani Kiyan <yazdani.kiyan@protonmail.com>
2020-10-19 18:28:45 +02:00
Stephan Seitz
994e42fac4 Fix: avoid overwriting tables in insert_to_path
The following query will result in matches with only one node though it
requires two nodes to be a match.

```scheme
(function_definition
 (comment) @function.inner.start
  body: (block) @function.inner)
```
Why? First `insert_to_path` is called for `@function.inner.start` which
will result int the following table.

```lua
{ function = { inner = { start { node } } } }
```
`insert_to_path` will overwrite the result
```lua
{ function = { inner = { node  } } }
```

Related #552
2020-10-16 13:48:59 +02:00
kiyan42
e5d8b6ade7 Remove get_parser logic
upstream now handles parsers by itself, so we don't need to do it
in this repo.
2020-10-16 13:48:24 +02:00
Thomas Vigouroux
06452845d6 fix(highlights): use new highlighter interface 2020-10-13 09:25:09 +02:00
Thomas Vigouroux
3b7b4daadb query: remove unnecessary query parsing 2020-10-12 20:04:31 +02:00
Thomas Vigouroux
2c8d401bb8 highlight: use new highlighter interface 2020-10-12 20:04:31 +02:00
Thomas Vigouroux
c055899dc0 feat(queries): modeline mechanism for base langs
This implements https://github.com/neovim/neovim/pull/13059#issuecomment-704414189

This behaves like modelines and remove the use of the base_language map.
Also, this allows to fine-tune what we actually want to include per
query, which is better IMO.
2020-10-11 19:09:22 +02: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
45397ebbd9 fix(highlights): Add TSNamespace highlight
Start adding highlights for
     - C++
     - Rust (including other scoped_identifier/scoped_type_identifier fixes)
     - JS (only namespace_import)

Addresses #516
2020-10-10 15:31:51 +02:00
Suhas Hebbar
f5ac2b4a1a Shorten module reference shell_command_selectors to shell. 2020-10-06 19:08:42 +02:00
Suhas Hebbar
46ce4adca8 Code Refactor
- Move select_* function to shell_command_selectors.lua.
- Rename select_args to select_compiler_args.
2020-10-06 19:08:42 +02:00
Suhas Hebbar
40edefc476 Remove dependency on unzip.
Use tar instead which should be available on default Unixes and Windows
2020-10-06 19:08:42 +02:00
Corey Williamson
c2acddd651 Add teal parser 2020-10-05 12:02:59 +02:00
Stephan Seitz
9f5237b6c5 Fix: fallback git-installation (list of commands is expected) 2020-10-04 21:48:25 +02:00
Pau Ruiz Safont
f1c272676b feat: add ocamllex parser and highlights 2020-10-04 14:33:29 +02:00
Stephan Seitz
3362f45196 Remove textobjects module 2020-10-04 14:20:20 +02:00
Steven Sojka
7f325538cc
Merge pull request #487 from steelsojka/remove-refactor
chore(modules): remove refactor module
2020-10-04 07:01:53 -05:00
Alvaro Muñoz
3dc2e9331e initial support for CodeQL 2020-09-30 17:06:58 +02:00
Stephan Seitz
b66b533ecd chore: dedup join_paths <-> join_path 2020-09-28 17:40:34 +02:00
Stephan Seitz
18fca90457 Add progress info to iter_cmd 2020-09-27 13:09:12 +02:00
Stephan Seitz
0a51d492a5 Add lockfile and make lockfile default install revision 2020-09-27 13:09:12 +02:00
Steven Sojka
82a8b859c6 chore(modules): remove refactor module 2020-09-25 10:30:35 -05:00
Stephan Seitz
0643fa3003 feat(parsers): add possibility to install from other branches
More and more Github repos are switching to "main" branch.
Example: `tree-sitter-wasm`
2020-09-22 21:27:24 +02:00
Stephan Seitz
8c10b1a14d fix(checkhealth): use pcall to check for syntax errors in query files 2020-09-20 10:37:06 +02:00
Stephan Seitz
e31cbdc13d feat(install): make compiler selectable
Compilers are selectable via 'nvim-treesitter.install'.compilers (list of compilers) or environment variable CC

Addresses #502
2020-09-19 20:05:22 +02:00
Stephan Seitz
8c4bc2803c fix: only concatenate cmd.err if not nil 2020-09-19 10:45:52 -05:00
Pau Ruiz Safont
2efeb80a44 feat(install): print more information when there's a failure 2020-09-19 13:35:12 +02:00
Pau Ruiz Safont
749a8a7f25 feat: add parser for ocaml interface files
The files have the mli extension. The parser grammar uses the name
ocaml_interface, but since vim the underscore has a special meaning
ocamlinterface is used as the filetype.
2020-09-19 13:35:12 +02:00
Stephan Seitz
7e3c4f8089 Add @keyword.operator for operators that are English words and add @exception for Java/JS 2020-09-19 07:30:49 +02:00
Rasmus Michelsen
2624c00b37 Ensure that updated files are replaced w/o warning 2020-09-18 22:35:45 +02:00
Akin Sowemimo
3652bed53e Re-add attribute highlight 2020-09-18 21:30:13 +02:00
TravonteD
c366a041c8 Add TSTag and TSTagDelimiter groups
These groups will be added for use with xml-like tags such as html and
jsx.
2020-09-18 17:09:43 +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
Stephan Seitz
ee9dd63ecd fix(folds): has_fold -> has_folds 2020-09-16 10:02:37 +02:00
kiyan42
71ba2afc70 add TSNone 2020-09-15 00:19:04 +02:00
Santos Gallegos
50991e370b Folds: rename query files to folds.scm to be consistent
We use plural names for all query files except folds.
2020-09-14 18:26:30 +02:00
Santos Gallegos
31e6d1e647 TextObjects: refactor wrong func names
Reading the code, these functions should be named differently

a755017dd5/lua/nvim-treesitter/query.lua (L203-L203)
2020-09-12 10:51:06 +02:00
Stephan Seitz
d180dca74d Yield meaningful error messages in iter_cmd{,_sync} when cmd.err == nil 2020-09-11 18:01:33 +02:00
Santos Gallegos
20b822314d Allow to call setup on already loaded modules. 2020-09-11 08:45:50 +02:00
Santos Gallegos
facdb691d9 Improve startuptime
- Don't load everything at startup
- Don't define an autocomand for each module and for each supported lang
  (this creates nxm autocomand!)
2020-09-10 22:58:59 +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
Santos Gallegos
9ec7e56fda Ocaml: fix parser
Paths were changed https://github.com/tree-sitter/tree-sitter-ocaml/pull/41
2020-09-10 09:15:18 +02:00