diff options
| author | Yuan Fu | 2023-02-19 12:22:27 -0800 |
|---|---|---|
| committer | Yuan Fu | 2023-02-19 12:34:19 -0800 |
| commit | afbce8bb46798518998f517cbacdbd65d4531a3f (patch) | |
| tree | 3062209a032808165a8906d24440693d0e5e078e /test | |
| parent | 2e6093b425e21551806abed746765631a00942d6 (diff) | |
| download | emacs-afbce8bb46798518998f517cbacdbd65d4531a3f.tar.gz emacs-afbce8bb46798518998f517cbacdbd65d4531a3f.zip | |
Improve tree-sitter indent anchor prev-adaptive-prefix (bug#61314)
Now prev-adaptive-prefix looks at the current line and checks if it
begins with a prefix itself. If it does, prev-adaptive-prefix tries
to place the anchor before the prefix on the previous line, rather
than after it.
- prev line
- this line -> This line starts with a "-", i.e., begins with a
prefix, so we place the anchor at the beginning of the
"-" of the previous line, rather than after it
- prev line
this line -> This line doesn't start with a prefix, so the anchor
is placed after the previous line's "-".
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el:
(treesit-simple-indent-presets): Add local variable
this-line-has-prefix, base what anchor to return on the value of
this-line-has-prefix and whether the prev line has a prefix.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent.erts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 05d59c10a42..09c8ebcec44 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts | |||
| @@ -242,6 +242,21 @@ line 2 | |||
| 242 | */ | 242 | */ |
| 243 | =-=-= | 243 | =-=-= |
| 244 | 244 | ||
| 245 | Name: Block Comment prefixes (Bug#61314) | ||
| 246 | |||
| 247 | =-=-= | ||
| 248 | /* | ||
| 249 | - item1 | ||
| 250 | - item2 | ||
| 251 | - item3 | ||
| 252 | */ | ||
| 253 | =-=-= | ||
| 254 | /* | ||
| 255 | - item1 | ||
| 256 | - item2 | ||
| 257 | - item3 | ||
| 258 | */ | ||
| 259 | =-=-= | ||
| 245 | 260 | ||
| 246 | Code: | 261 | Code: |
| 247 | (lambda () | 262 | (lambda () |