aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTriton1712022-08-10 12:11:15 +0000
committerBlaž Hrastnik2022-10-11 07:48:04 +0000
commit8f19956218ebb561a7e4de86b67df130a5ed997b (patch)
tree9b242ebf5b321a13e9e3cfb68842bca8d56a3b4c
parent3ab9abb64283aed54f5ea7e8157629c2a2be3b33 (diff)
Add python indentation support to docs.
Document @extend-indented and @stop-extend captures for indent queries.
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--book/src/guides/indent.md13
2 files changed, 14 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 5c64d097..deeef34f 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -86,7 +86,7 @@
| prisma | ✓ | | | `prisma-language-server` |
| prolog | | | | `swipl` |
| protobuf | ✓ | | ✓ | |
-| python | ✓ | ✓ | | `pylsp` |
+| python | ✓ | ✓ | ✓ | `pylsp` |
| r | ✓ | | | `R` |
| racket | | | | `racket` |
| regex | ✓ | | | |
diff --git a/book/src/guides/indent.md b/book/src/guides/indent.md
index f4d916b2..c9306a10 100644
--- a/book/src/guides/indent.md
+++ b/book/src/guides/indent.md
@@ -46,6 +46,19 @@ capture on the same line, the indent level isn't changed at all.
- `@outdent` (default scope `all`):
Decrease the indent level by 1. The same rules as for `@indent` apply.
+- `@extend-indented`:
+Extend the range of this node to the end of the line and to lines that
+are indented more than the line that this node starts on. This is useful
+for languages like Python, where for the purpose of indentation some nodes
+(like functions or classes) should also contain indented lines that follow them.
+
+- `@stop-extend`:
+Prevents the first extension of an ancestor of this node. For example, in Python
+a return expression always ends the block that it is in. Note that this only prevents
+the next extension of one ancestor: If multiple ancestors can be extended (for example
+multiple nested conditional blocks in python), only the extension of the innermost
+ancestor is prevented.
+
## Predicates
In some cases, an S-expression cannot express exactly what pattern should be matched.