Custom Autocomplete with autoindent on new lines

Hi,

I’m using custom completions and want to make an autocompletion with multiple lines, but every new line should use the same indent that was used to start the completion, or the position at which the cursor was located. Is that possible?

For example with the following completion:

{
    label: 'test',
    apply: 'test: {\n\tkey: value\n}',
    type: 'keyword',
    info: 'test'
}

Completion should replace “test” with the following:

test: {
    key: value
}

If my cursor is already on an indent level with 4 spaces, I want the completion also with 4 spaces, like this:

    test: {
        key: value
    }

Thanks for helping :slight_smile:

Snippets can do this.

1 Like

Thank you for the hint. I will try it. :slight_smile: