on master help sign in
Add python indentation support to docs.

Document @extend-indented and @stop-extend captures for indent queries.

commit8f19956218ebb561a7e4de86b67df130a5ed997b authorTriton171 <triton0171@gmail.com> dateWed 10 Aug 2022, 14:11 (4 years ago) parent3ab9abb
2 files changed+14−1
book/src/generated/lang-support.md+1−1 book/src/guides/indent.md+13
book/src/generated/lang-support.md+1−1
@@ -86,7 +86,7 @@
8686| prisma | ✓ | | | `prisma-language-server` |
8787| prolog | | | | `swipl` |
8888| protobuf | ✓ | | ✓ | |
89−| python | ✓ | ✓ | | `pylsp` |
89+| python | ✓ | ✓ | ✓ | `pylsp` |
9090| r | ✓ | | | `R` |
9191| racket | | | | `racket` |
9292| regex | ✓ | | | |
book/src/guides/indent.md+13
@@ -46,6 +46,19 @@ capture on the same line, the indent level isn't changed at all.
4646- `@outdent` (default scope `all`):
4747Decrease the indent level by 1. The same rules as for `@indent` apply.
4848
49+- `@extend-indented`:
50+Extend the range of this node to the end of the line and to lines that
51+are indented more than the line that this node starts on. This is useful
52+for languages like Python, where for the purpose of indentation some nodes
53+(like functions or classes) should also contain indented lines that follow them.
54+
55+- `@stop-extend`:
56+Prevents the first extension of an ancestor of this node. For example, in Python
57+a return expression always ends the block that it is in. Note that this only prevents
58+the next extension of one ancestor: If multiple ancestors can be extended (for example
59+multiple nested conditional blocks in python), only the extension of the innermost
60+ancestor is prevented.
61+
4962## Predicates
5063
5164In some cases, an S-expression cannot express exactly what pattern should be matched.