Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(snippet): correct indent with newline #27674

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Conversation

glepnir
Copy link
Member

@glepnir glepnir commented Feb 29, 2024

Problem: snippet newline use before line indent after expand.

Solution: it should level + 1.

@clason
Copy link
Member

clason commented Feb 29, 2024

Please don't make unrelated changes in a commit; it makes it harder to review. (If you want to include these changes here, at least put them in a separate refactor commit.)

runtime/lua/vim/snippet.lua Outdated Show resolved Hide resolved
@glepnir glepnir marked this pull request as draft February 29, 2024 11:12
@glepnir glepnir force-pushed the snippet_indent branch 3 times, most recently from 00e1e4d to e1af381 Compare February 29, 2024 11:41
runtime/lua/vim/snippet.lua Outdated Show resolved Hide resolved
runtime/lua/vim/snippet.lua Outdated Show resolved Hide resolved
test/functional/lua/snippet_spec.lua Outdated Show resolved Hide resolved
test/functional/lua/snippet_spec.lua Outdated Show resolved Hide resolved
test/functional/lua/snippet_spec.lua Show resolved Hide resolved
Problem: snippet newline use before line indent after expand.

Solution: it should level + 1.
@glepnir glepnir marked this pull request as ready for review March 2, 2024 01:58
@bfredl bfredl merged commit 8350839 into neovim:master Mar 15, 2024
31 checks passed
@github-actions github-actions bot removed the request for review from folke March 15, 2024 08:32
@glepnir glepnir deleted the snippet_indent branch March 15, 2024 09:21
mfussenegger added a commit to mfussenegger/neovim that referenced this pull request Apr 27, 2024
Reverts parts of neovim#27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
mfussenegger added a commit to mfussenegger/neovim that referenced this pull request Apr 27, 2024
Reverts parts of neovim#27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
mfussenegger added a commit that referenced this pull request Apr 28, 2024
Reverts parts of #27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
huangyingw pushed a commit to huangyingw/neovim that referenced this pull request May 31, 2024
Reverts parts of neovim#27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants