Commit graph

133 commits

Author SHA1 Message Date
Stephan Seitz
2caac44720 fix: Allow re-parsing in Python, XFAIL \ indentation test 2022-02-06 19:42:57 +01:00
Stephan Seitz
059fbc487c indents: allow aligned_indent for unfinished calls in C and Python 2022-02-05 18:54:55 +01:00
Stephan Seitz
c4e3564ea3 highlights(python): add support for pattern matching
Fixes #2080
Depends on https://github.com/tree-sitter/tree-sitter-python/pull/140
2022-01-28 19:11:20 +01:00
Munif Tanjim
bb60706433 feat(indent): support @aligned_indent for python 2022-01-21 10:51:51 +01:00
Munif Tanjim
c0110e34aa feat: rewrite indent module 2022-01-21 10:51:51 +01:00
Rafik Draoui
9b262596e0 Remove Python docstring injections
These injections lead to inconsistent highlighting since some edge cases
aren't handled (as mentioned in the PR description that introduced the
injections [0]). Besides, not all Python projects use reStructuredText
syntax in docstrings.

If someone still wants to use them, they can extend the base injection
queries through `after/queries/` [1] or enable them with
`vim.treesitter.set_query`.

See also: https://github.com/nvim-treesitter/nvim-treesitter/pull/1204

[0]: https://github.com/nvim-treesitter/nvim-treesitter/pull/917
[1]: ad69e2528a (adding-queries)
2022-01-04 23:15:30 +01:00
Santos Gallegos
56634f49ab Update queries
- Don't use the old form for predicates
- Update some invalid queries
2021-12-22 21:17:28 +01:00
Fabian
e01c7ce972
highlights(python): Improve self and cls highlight (#2134)
1. This function simplifies an unnecessary lua-match usage.
2. Fixes an accidental change, where "cls" was changed to "class" (fe4f320b66)
3. Match functions, which have have a decorator.
4. But exclude @staticmethod
5. Only highlight "cls" as @variable.builtin when the decorator is @classmethod

This might be a bit to complicated and some of this not to useful,
as this existing rule:

```scm
 ((identifier) @variable.builtin
  (#eq? @variable.builtin "self"))
```

overwrites the queries anyway.
2021-12-18 16:49:30 -05:00
Lewis Russell
011ac894ec Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
2021-11-23 10:02:06 +01:00
Santos Gallegos
6888242b98 Python: highlight semicolon 2021-11-12 19:51:04 +01:00
Dundar Göc
6a4fdb317d chore: fix typos 2021-11-02 23:47:48 +01:00
Santos Gallegos
6d08b25f0e Update queries/python/highlights.scm 2021-11-01 16:54:46 +01:00
Santos Gallegos
df06643aa1 Revert "feat: add del keyword for highlights"
This reverts commit 385193d41f.
2021-11-01 16:54:46 +01:00
Ashish Panigrahi
385193d41f feat: add del keyword for highlights 2021-11-01 13:19:27 +01:00
Santos Gallegos
10419ee747 Python: highlight interpolation escaped chars
Support for these was just added in the grammar.
2021-10-22 09:21:42 +02:00
Santos Gallegos
948fa6a260
Python: fix class highlights (#1548) 2021-07-11 15:06:52 -05:00
Sergio Alejandro Vargas
017760113a Highlights(python): Add @keyword.function
Use `@keyword.function` for `def` and `lambda`
2021-07-06 00:53:40 +02:00
antonk52
90f15d9bf7 feat(keywords) merge return and yield into keyword.return group 2021-07-04 21:49:17 +02:00
antonk52
bd9095e969 feat(keywords) add keyword.return & keyword.yield 2021-07-04 21:49:17 +02:00
Stephan Seitz
6d5b4f19f3 python(highlights): don't use type for APP 2021-07-01 22:50:33 +02:00
Stephan Seitz
fe4f320b66 highlights(python): use any-of? 2021-05-16 21:13:12 +02:00
Santos Gallegos
67f0857015 Revert "Comment: use @combined to create just one tree per buffer (#1252)"
This reverts commit 4a7a713c52.
2021-05-07 16:51:57 +02:00
Santos Gallegos
4a7a713c52
Comment: use @combined to create just one tree per buffer (#1252)
* Comment: use `@combined` to create just one tree per buffer

There is no need to create a tree per line/block for comments.
Should fix https://github.com/nvim-treesitter/nvim-treesitter/issues/1251

* Add injections for scss

* Fix jsonc

* Combine jsdoc
2021-04-28 07:19:07 -05:00
Santos Gallegos
e4083fc8e1
Add comment parser to highlight comment tags (#893)
Closes #236
2021-03-12 11:21:46 -05:00
Santos Gallegos
af36d31cb7
Python: inject rst in docstrings (#917)
Since hasn't been much discussion around
https://github.com/nvim-treesitter/nvim-treesitter/issues/806.
I'm just porting the injection queries.
I've been using this for a while now.

Things I've noticed:

- Due that rst uses indentation for its syntax,
  everything is treated as an block quote (but it looks good).
  This can be solved by having a predicate like `#dedent!`.
- Looks like there is a bug in how the injected content is extracted

  ```
  def foo():
      """Foo bar"""
  ```

  That would be parsed as a section title for some reason,
  but it's a paragraph.

  In rst it would be a title if the content was:

  ```
  """
  Foo bar
  """
  ```

  If the content is

  ```
  """Foo bar"""
  ```

  That's just a paragraph.

I'll try to debug that from the neovim side next week or so.
2021-02-05 15:01:50 +00:00
Jędrzej Boczar
e4f8e4147c indent: add Python @ignore queries 2021-01-14 13:54:43 +01:00
Jędrzej Boczar
e6b8c5e680 indent: add Python @return queries 2021-01-14 13:54:43 +01:00
Stephan Seitz
b441f257a4 Python highlights: update definition of decorator 2021-01-07 08:52:41 +01:00
Stephan Seitz
1cf7a1ddc9 Python locals: Add new node with_clause 2021-01-07 08:52:41 +01:00
Stephan Seitz
40588da97c Remove usages of @embedded in highlights 2021-01-06 09:12:32 -05:00
Stephan Seitz
d9105e00a6 Python highlights: Add regex injections: re.match(r"...") 2021-01-03 19:05:38 +01:00
Santos Gallegos
c74be54deb Python (folds): allow to fold strings
Mostly useful for folding docstrings
2021-01-02 04:21:47 +01:00
Jędrzej Boczar
ac42192e19 Improve python/indents.scm 2020-12-21 22:58:17 +01:00
Santos Gallegos
1ad1f3b35a Python: fix self highlighing 2020-12-18 20:33:04 +01:00
Evan
01baa52899 Update indents.scm 2020-12-18 16:42:05 +01:00
Evan
c200de65aa Create indents.scm for python 2020-12-18 16:42:05 +01:00
Stephan Seitz
b3a3403e25 Update Python queries 2020-11-30 11:19:22 +01:00
Stephan Seitz
8c4eb15886 Python highlights: Fix #688 (definition.associated -> field) 2020-11-23 21:45:05 +01:00
Stephan Seitz
1e0ab0b885 Fix Python queries for parser update 2020-11-03 20:26:08 +01:00
Stephan Seitz
93f9708a3c Dart highlights: Reset highlight in interpolation 2020-10-05 06:37:31 +02:00
Stephan Seitz
3362f45196 Remove textobjects module 2020-10-04 14:20:20 +02:00
Stephan Seitz
58ec0bd7ef Python locals: account for https://github.com/tree-sitter/tree-sitter-python/pull/83 2020-09-21 22:56:01 +02:00
Stephan Seitz
cd9cab7990 fix(python): use @Normal again for f-strings @none is not aggressive enough 2020-09-19 15:06:04 -05: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
Santos Gallegos
68d8f4c02e Remove @definition.doc captures
These aren't really definitions and are being show in the definitions
list. We aren't using them at the moment, we could use another group or
query file.
2020-09-17 09:18:05 +02:00
kiyan42
2fe1f2877e reset python interpolation node 2020-09-15 00:19:04 +02:00
Stephan Seitz
bcf421b4e7 Fix #307: Use and document TSVariable/TSVariableBuiltin in all languages 2020-09-14 18:27:20 +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
Thomas Vigouroux
b90e520ccd ci: fix wrong queries 2020-09-11 12:02:35 +02:00
Santos Gallegos
fcdb3eb35d Python: update folds
Missed one
2020-09-03 19:03:05 +02:00