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

ref!: major refactor #150

Merged
merged 56 commits into from
Jul 21, 2024
Merged

ref!: major refactor #150

merged 56 commits into from
Jul 21, 2024

Conversation

xiaoshihou514
Copy link
Collaborator

@xiaoshihou514 xiaoshihou514 commented Jun 6, 2024

closes #68 #86 #123 #109 #76 #141 #111

changes

  • remove uv.spawn wrapper in favour of vim.system
  • do_lint now respects all config fields
  • linter can now use lnum_end and col_end
  • added step by step tutorial for advanced usage
  • remove all version checking code, only supports 0.10+ from now on
  • apply exepath fix for windows

internal changes

  • events now contains truly all autocmd related functions
  • utils now contains execution checking functions
  • use custom simpler table copy

@xiaoshihou514 xiaoshihou514 requested a review from glepnir June 6, 2024 10:37
lua/guard/events.lua Outdated Show resolved Hide resolved
lua/guard/util.lua Outdated Show resolved Hide resolved
@glepnir
Copy link
Member

glepnir commented Jun 7, 2024

the main idea of there i think we can now remove the custom spawn logic and move to vim.system with coroutine wrapper.

@xiaoshihou514 xiaoshihou514 changed the title doc: how to write custom formatting logic ref: switch to vim.system Jun 7, 2024
@xiaoshihou514
Copy link
Collaborator Author

I can try...

@xiaoshihou514
Copy link
Collaborator Author

xiaoshihou514 commented Jun 10, 2024

The main thread is still blocked on api.nvim_buf_set_lines(...), any way around it?
Seem to apply to current version as well

@xiaoshihou514
Copy link
Collaborator Author

xiaoshihou514 commented Jun 12, 2024

TODO: make linters support all config fields

@xiaoshihou514 xiaoshihou514 requested a review from glepnir July 2, 2024 08:02
lua/guard/lsp.lua Outdated Show resolved Hide resolved
@yebt
Copy link

yebt commented Jul 3, 2024

<3
I'm going to love this plugin, thank you very much

lua/guard/events.lua Outdated Show resolved Hide resolved
lua/guard/util.lua Outdated Show resolved Hide resolved
lua/guard/events.lua Outdated Show resolved Hide resolved
@xiaoshihou514 xiaoshihou514 requested a review from glepnir July 3, 2024 10:12
Copy link
Member

@glepnir glepnir left a comment

Choose a reason for hiding this comment

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

nice work. some edge cases can fix in later.

@xiaoshihou514 xiaoshihou514 merged commit 6c3b3cb into nvimdev:main Jul 21, 2024
@xiaoshihou514 xiaoshihou514 deleted the ref-api branch July 26, 2024 13:58
@anna328p
Copy link

anna328p commented Oct 1, 2024

hi hello you accidentally started writing double newlines to the linter (guard.nvim adds a newline to the end of each line in https://github.com/nvimdev/guard.nvim/blob/main/lua/guard/util.lua#L9-L16, and then nvim's SystemObj:write() adds a newline to the end of every line it writes, see https://github.com/neovim/neovim/blob/5331f87f6145f705c73c5c23f365cecb9fbc5067/runtime/lua/vim/_system.lua#L122-L125) which means the linter gets line numbers wrong and keeps complaining about there being too many newlines.

@xiaoshihou514
Copy link
Collaborator Author

hi hello you accidentally started writing double newlines to the linter (guard.nvim adds a newline to the end of each line in https://github.com/nvimdev/guard.nvim/blob/main/lua/guard/util.lua#L9-L16, and then nvim's SystemObj:write() adds a newline to the end of every line it writes, see https://github.com/neovim/neovim/blob/5331f87f6145f705c73c5c23f365cecb9fbc5067/runtime/lua/vim/_system.lua#L122-L125) which means the linter gets line numbers wrong and keeps complaining about there being too many newlines.

Oh wow nice catch! That explains why clippy always reports the double amount of line number.

I will push a fix tonight after some more testing.

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.

Errors with prettierd aren't handled
4 participants