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

feat: support formatting changed lines only #1028

Merged
merged 7 commits into from
Oct 19, 2023
Merged

feat: support formatting changed lines only #1028

merged 7 commits into from
Oct 19, 2023

Conversation

ayamir
Copy link
Owner

@ayamir ayamir commented Oct 18, 2023

Propose it because this requirement is common as the readme of this plugin: https://github.com/joechrisellis/lsp-format-modifications.nvim#what-problem-does-this-solve
Additionally, it's inevitable to add this function by modifying the formatting.lua file, which isn't what we want to see.

@ayamir ayamir linked an issue Oct 18, 2023 that may be closed by this pull request
@ayamir
Copy link
Owner Author

ayamir commented Oct 18, 2023

@jh244212647 checkout to this pr and test it.

@jh244212647
Copy link

测了一下,能满足需求,大佬非常给力,另外这个pr如果合入,settings["format_modify"] = false会不会好一点

Copy link
Collaborator

@Jint-lzxy Jint-lzxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🍉

@Jint-lzxy Jint-lzxy changed the title feat: support format only for modifications. feat: support formatting changed lines only Oct 18, 2023
Copy link
Collaborator

@CharlesChiuGit CharlesChiuGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But I wonder if all LSP support rangeFormatting at this point. 🤔

@ayamir
Copy link
Owner Author

ayamir commented Oct 19, 2023

LGTM. But I wonder if all LSP support rangeFormatting at this point. 🤔

Not all, just some support it:
joechrisellis/lsp-format-modifications.nvim#1 (comment)
https://github.com/joechrisellis/lsp-format-modifications.nvim#tested-language-servers

@ayamir ayamir merged commit 783f0ec into main Oct 19, 2023
4 checks passed
@ayamir ayamir deleted the feat/format-modify branch October 19, 2023 08:21
ttbug pushed a commit to ttbug/nvimconf that referenced this pull request Oct 19, 2023
* feat: support format only for modidications.

Signed-off-by: ayamir <lgt986452565@gmail.com>

* fixup:! correct the format logic.

* fixup!: set `format_modify` = `false` by default.

* fix: clarify `format_modify` & cleanup

* fix: add missing `vim.notify`

* fix CI

* fix(settings): sort formatting-related entries

---------

Signed-off-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com>
singlemancombat pushed a commit to singlemancombat/nvim-config that referenced this pull request Oct 22, 2023
* feat: support format only for modidications.

Signed-off-by: ayamir <lgt986452565@gmail.com>

* fixup:! correct the format logic.

* fixup!: set `format_modify` = `false` by default.

* fix: clarify `format_modify` & cleanup

* fix: add missing `vim.notify`

* fix CI

* fix(settings): sort formatting-related entries

---------

Signed-off-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to partially format the document?
5 participants