* feat: add class class definition
* feat: add try and if statement for dart
* feat: add support for methods/functions
* feat: add for_statement in dart
* chore: update readme to showcase dart support
* feat: add php switch/case statements to context
* Adopt simplified suggestion on switch statement
Co-authored-by: Lewis Russell <me@lewisr.dev>
* cleanup: adopt simplified suggestion on case stmnt
---------
Co-authored-by: Lewis Russell <me@lewisr.dev>
This plugin has been significantly rewritten to use Treesitter
queries instead of patterns for determining context regions for
languages.
The main benefits of this change are:
- it is a much simpler implementation since we can leverage core APIs.
- it fits in more generally with the Treesitter eco-system.
- it allows configuration of contexts to be provided from multiples sources.
- it allows more sophisticated configuration of contexts since queries
(with directives and predicates) are much more powerful than patterns.
- the query format should be usable for other editors.
The major downside of this new implementation is that it requires each
language to provide it's own query as opposed to using the general
purpose patterns. This means that some languages which had contexts
before may not have them now. If this is the case then please raise an
issue. Adding queries for a specific language is fairly simple but too
much work to implement for all 170+ parsers that exist.
This commits provides explicit support for:
- bash
- c
- cpp
- typescript
- rust
- json
- lua
- markdown
- python
- yaml
- php
- scala
- teal
- toml
- vim
Please see the README for instructions on how to add support for other
languages.
This commit also drops explicit support for Nvim 0.7. If you still need
support for this version then you can use the `compat/0.7` release.
Example:
```python
def example_func():
file_name = "tmp/secrets.txt"
with open(file_name, "rb+") as f:
# ...
# cursor here
```
Will show both the function definition and the `with` line as context.
Add to DEFAULT_TYPE_PATTERNS, treesitter syntax node types utilized by
Verilog.
The list of added node types are probably not exhaustive, but these seem
to be the ones needed for basic use.