GNU bug report logs -
#77094
31.0.50; yaml-ts-mode does not indent after yaml mapping keys
Previous Next
Full log
Message #11 received at 77094 <at> debbugs.gnu.org (full text, mbox):
On Tuesday, March 18th, 2025 at 03:40, the_wurfkreuz via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> wrote:
> If i have a yaml file with this content:
> ```
> apiVersion: v1
> kind: Service
> metadata:
> ```
>
> And i try to create a new line executing the `newline` command from the end
> of the 'metadata:' line, the newly created line wont be indented:
>
> ```
> apiVersion: v1
> kind: Service
> metadata:
> following_text
> ```
>
> But in the yaml-mode and any other text editor i've tried, it always
> indents after mapping keys like this:
>
> ```
> apiVersion: v1
> kind: Service
> metadata:
> following_text
> ```
>
>
> Steps to reproduce:
> 1. emacs -Q
> 2. Interactively install the yaml treesitter grammar (i've compiled from this repo https://github.com/ikatyang/tree-sitter-yaml)
> 3. M-x yaml-ts-mode
> 4. Clean the scratch buffer and paste this:
>
> apiVersion: v1
> kind: Service
> metadata:
>
> 5. Move the cursor to the 'metadata:' line. Use `move-end-of-line` and
> `newline` commands.
>
> The cursor isn't indented and placed at the very start of the next line.
> I expect it to be indented.
>
Thanks for the report.
yaml-ts-mode currently doesn't supply any indentation rules.
I have been working on them on and off for a long time but could never
get them perfect due to how the grammar behaves in certain cases and
sort of lost motivation. But they say you shouldn't let perfect be the
enemy of good.
I will update and cleanup what I've been working on hopefully sometime
later this week/weekend and post it here, and will deal with whatever edge
cases as they come up.
This bug report was last modified 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.