Skip to content

ref!: major refactor#150

Merged
xiaoshihou514 merged 56 commits intonvimdev:mainfrom
xiaoshihou514:ref-api
Jul 21, 2024
Merged

ref!: major refactor#150
xiaoshihou514 merged 56 commits intonvimdev:mainfrom
xiaoshihou514:ref-api

Conversation

@xiaoshihou514
Copy link
Copy Markdown
Member

@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
Comment thread lua/guard/events.lua Outdated
Comment thread lua/guard/util.lua Outdated
@glepnir
Copy link
Copy Markdown
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.

Co-authored-by: glepnir <glephunter@gmail.com>
@xiaoshihou514 xiaoshihou514 changed the title doc: how to write custom formatting logic ref: switch to vim.system Jun 7, 2024
@xiaoshihou514
Copy link
Copy Markdown
Member Author

I can try...

@xiaoshihou514
Copy link
Copy Markdown
Member 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
Copy Markdown
Member 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
Comment thread lua/guard/lsp.lua Outdated
@yebt
Copy link
Copy Markdown

yebt commented Jul 3, 2024

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

Comment thread lua/guard/events.lua Outdated
Comment thread lua/guard/util.lua Outdated
Comment thread lua/guard/events.lua Outdated
Comment thread lua/guard/format.lua
@xiaoshihou514 xiaoshihou514 requested a review from glepnir July 3, 2024 10:12
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member 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