Commit graph

9 commits

Author SHA1 Message Date
TheLeoP
922c396b26 fix(python): right content for regex injection 2023-08-16 12:25:51 -04:00
Pham Huy Hoang
78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02: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
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
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
Stephan Seitz
d9105e00a6 Python highlights: Add regex injections: re.match(r"...") 2021-01-03 19:05:38 +01:00