Omar Valdez
51bba660a8
refactor(queries): Remove quotes from properties in set! directive
2024-07-28 11:43:41 +02:00
Grace Petryk
f16a775830
feat(python): Improved python indentation ( #6859 )
...
* feat: improve python indentation
* use lua-match
* revert concatenated_string changes, handle function def hanging indents
* lint
* add delimiters to param query
* add test cases
2024-07-16 20:13:41 +09:00
ObserverOfTime
ec6307e5b0
refactor(python): merge docstring queries
2024-06-28 10:06:52 +02:00
Kai Moschcau
60c2b084c2
feat(awk,cmake,python,r,starlark): deactivate spelling in shebangs
2024-05-01 15:01:48 +02:00
Riley Bruins
9a47a523e3
feat: import statement folds for common languages
2024-05-01 10:00:01 +02:00
Riley Bruins
f58cae6c22
feat: more @keyword.type captures
2024-05-01 09:59:50 +02:00
Colin Kennedy
037c6af78f
fix(python): captures inner string contents with spell
2024-04-17 04:23:55 +00:00
vsajko
c65413f2ac
fix(python): add staticmethod to builtin decorators
2024-03-30 01:30:13 +02:00
Phạm Huy Hoàng
722617e672
refactor(format): drop extra indentation for field
2024-03-21 15:51:26 +01:00
再生花
31641d72a4
feat(format-scripts): linewrap predicates
...
"format-ignore".kick()
2024-02-23 10:42:01 +02:00
Riley Bruins
d96bf9d522
fix(python): better try-except indentation ( #6097 )
2024-02-15 00:39:59 +07:00
Jongwook Choi
cb79d24461
feat(python): allow comments before module docstring
...
Example:
```python
#!/usr/bin/env/python
# some comment before module docstring
# Copyright (c) LICENSE foo bar
"""module docstring."""
```
Python indeed recognizes it:
```
$ python -c 'import testfile; print(testfile.__doc__)'
module docstring.
```
2024-01-25 23:28:11 +01:00
Amaan Qureshi
55562407b6
chore(python): update member lua pattern
2024-01-24 15:21:39 +09:00
Phạm Huy Hoàng
77e298e4de
chore: format queries
2024-01-21 23:55:02 +09:00
Zeb Nicholls
4a4dbe1cb1
fix(python): add support for typed (kw)args (PEP 484) ( #5875 )
2024-01-19 16:21:57 +00:00
Pham Huy Hoang
57a8acf0c4
chore: query formatting
2024-01-19 16:58:37 +01:00
Pham Huy Hoang
edee83272e
refactor: manual pre-cleanup
...
Moving comments, adding `format-ignore` to lines that will be better
with it
2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455
feat!: align standard captures with upstream
...
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(3f44b89685/highlight/src/lib.rs (L20-L72) ):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting ):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
ObserverOfTime
17fae3f4a3
feat(injections): add printf format strings
2024-01-19 16:58:37 +01:00
Christian Clason
5b90ea2aba
feat(locals)!: switch to upstream captures
2024-01-19 16:58:37 +01:00
ObserverOfTime
ab818bf5a2
fix(python): restrict typed parameter highlight
...
Only the name is a parameter and not the value
2023-12-14 13:05:40 -05:00
ObserverOfTime
2583eb351b
fix(python): highlight variadic lambda parameters
2023-12-14 13:05:40 -05:00
Riley Bruins
1610b1aafb
feat(python): @string.regex capture, injection improvements ( #5697 )
...
* feat(python): `@string.regex` capture, injection improvements
* fix(python): match regex only for first argument of re module
* chore(python): remove unneeded capture
Co-authored-by: Santos Gallegos <stsewd@proton.me>
* fix(python): only highlight string content itself as regex
---------
Co-authored-by: Santos Gallegos <stsewd@proton.me>
2023-11-21 01:26:18 +09:00
Pham Huy Hoang
107e61afb7
refactor: Remove all (ERROR) @error captures
...
As discussed in PR#5421, capturing `@error` is inconsistent, requiring
deep nesting (or priority) in order to correctly have red backgrounds to
it.
Some queries has this capture, some don't. For consistency purposes,
removing all of them is more preferable.
For re-enabling error, either add `(ERROR) @error` or `(ERROR _ @error)`
to your custom queries.
2023-10-25 18:18:50 +02:00
Amaan Qureshi
0e27391e90
feat(python): update parser & highlights
2023-08-16 20:28:11 -04:00
TheLeoP
922c396b26
fix(python): right content for regex injection
2023-08-16 12:25:51 -04:00
Amaan Qureshi
64d1696d6d
fix(python,starlark): update parsers & add escape_interpolation
2023-08-16 03:23:24 -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
Amaan Qureshi
9bfc966769
fix(python): fields should not match uppercase-beginning names
2023-04-29 19:38:30 -04:00
Pham Huy Hoang
1ca9b938c1
Add Python else elif dedent ( #4618 )
...
* feat(python): add interactive else/elif dedent
* fixup
* add test
2023-04-29 10:35:35 +02:00
Amaan Qureshi
87faf372eb
fix(python,starlark): builtin types should come after types
2023-04-25 03:04:05 -04:00
Amaan Qureshi
01b42a1a57
feat(python,starlark): highlight type conversions as @function.macro
2023-04-25 03:04:05 -04:00
Amaan Qureshi
5ab25d8a1f
fix(python,starlark): update field match pattern
2023-04-25 03:04:05 -04:00
Amaan Qureshi
85330918f0
perf: remove match where possible
2023-04-21 18:24:17 -04:00
Pham Huy Hoang
c9ef5e58f7
feat(python): add break/continue dedent
2023-03-25 00:31:57 -04:00
Pham Huy Hoang
1ffa019856
feat(python): add match-case indents
2023-03-25 00:31:57 -04:00
George Harker
cb568af539
use indent.X syntax for captures and properties of set directives
...
update CONTRIBUTING.md
adjust indents for bass
fix doc capture comment
2023-03-24 13:07:53 -04:00
George Harker
b4fcc61175
split delimiter into open_delimiter and close_delimiter
2023-03-24 13:07:53 -04:00
George Harker
d1333dd7e5
refactor(indent)!: Rework indent, aligned indent
...
indents now use @indent.X style captures, and indent.PROP for properties to set on those captures, as documented in the help.
Captures are:
indent.auto
indent.begin
indent.end
indent.dedent
indent.branch
indent.ignore
indent.align
indent.zero
Properties are:
indent.immediate
indent.start_at_same_line
indent.open_delimiter
indent.close_delimiter
indent.increment
indent.avoid_last_matching_next
Multiple opening delims on one line and multiple closing on a line are collapsed so as not to over indent,
The final line of @indent.align blocks which must in some cases be treated specially to avoid clashing with the next line is treated the same regardless of whether the @indent.align capture actually uses aligned indentation or just normal indentation. The indent.avoid_last_matching_next property controls this.
Adjust python to use these.
List, set, dict and tuple all use @indent.align which permits both hanging and aligned styles.
Finally, try: on it’s own will indent when typing live but make no guaranteeds about whole-file formatting.
Includes lucario387:fix-align-indent
2023-03-24 13:07:53 -04:00
Anthony Shi
9253ce66f9
fix(python): add object as @type.builtin
2023-03-22 05:27:28 -04:00
Pham Huy Hoang
01e8a51451
feat(python): add "return" patterns to @indent_end
...
`return ...` is usually the last line of a
function/statement, so mark some possible patterns of `return` with
`@indent_end` to dedent the line after it
2023-03-16 13:41:19 +01:00
Pham Huy Hoang
f5ddd8f92e
fix(python): add missing @indent_end
2023-03-16 03:46:01 -04:00
George Harker
fa0644667e
fix: change folding algorithm to fix Python indents
2023-03-15 22:44:59 +01:00
Amaan Qureshi
95bcd6a8fa
feat: add @string.documentation where applicable
2023-03-05 17:15:32 -05:00
Amaan Qureshi
33ba346e60
feat!: add @keyword.coroutine capture
2023-03-03 07:07:52 -08:00
Anthony Shi
8894d78f63
Update highlights.scm for Python
...
Added new keywords "is not" and "not in"
2023-03-02 22:54:45 -05:00
Christian Clason
f95ffd09ed
python(highlights): adapt query to parser change
2023-02-28 20:27:09 +01:00
ObserverOfTime
14fa6e015e
highlights(python): fix captures
2022-11-26 13:17:51 +02:00
Stephan Seitz
c924128771
highlights(python): add "except*"
...
Added in https://github.com/tree-sitter/tree-sitter-python/pull/176
About the feature https://realpython.com/python311-exception-groups/#exception-groups-and-except-in-python-311
2022-10-25 12:14:53 +02:00
ObserverOfTime
9b43ab819c
highlights: use @preproc where appropriate
2022-10-15 08:49:01 -07:00