You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide Guard lint to only lint and not format file.
Are there occasions where you want to do this manually? Please describe them.
Can I have a combination where linter is run asynchronously and formatter is run synchronously.
Sync stuff is not normally what people want, what's the motivation?
Provide options for configuring async nature of linters and formatters in vim.g.guard_config.
Same as above
Also a small doubt, I wanted know to why was the setup function deprecated. Most people generally expect for a setup function. Is there any chance to remove the vim.deprecate function in the setup?
@xiaoshihou514 Thank you for responding to my queries first of all.
require("guard.filetype")("java"):lint("checkstyle") - For the first point what I meant was that the configured linter doesnt run and throws a message saying no configured formatters. Basically, I just configured java checkstyle for linting with no formatter and ran Guard fmt and got a error message saying formatter not configured or something of that sort.
I wanted this feature because at my work, there are many cases where I should not touch the formatting of files since it changes git blame to my name even though I essentially made no change. But I still need the functionality to lint without formatting. That was my intention behind Guard fmt and Guard lint change.
For the third point, I wanted this feature because, let us just say a formatter takes time to format and other edits happen in the buffer, they get replaced by the text from formatter. Hence, I generally run it in sync mode. Linters can be run in async mode but formatters work best for me when run in sync mode.
Basically, you want to only run checkstyle manually and infrequently, but guard doesn't provide configs for events.
No what I meant is if I configure java linter like this require("guard.filetype")("java"):lint("checkstyle") It wont run and throw error saying no formatters found.
Nvm I found out what the issue was! I did not push checkstyle changes to my forked repo while developing linter for checkstyle! Really sorry for making you debug this issue.
Nvm I found out what the issue was! I did not push checkstyle changes to my forked repo while developing linter for checkstyle! Really sorry for making you debug this issue.
Ok! I am able to reproduce it. Just run Guard fmt with the following config
So there is no way to run a linter without configuring a formatter? Is it possible to provide a Guard lint to only lint and make Guard fmt to only format. Probably just invoking Guard can do both linting and formatting. I think this is a really good idea.
Activity
xiaoshihou514 commentedon Dec 9, 2024
You can hook into the linter logic in any way you want
Are there occasions where you want to do this manually? Please describe them.
Sync stuff is not normally what people want, what's the motivation?
Same as above
You can read more about the motivation here :)
231tr0n commentedon Dec 9, 2024
@xiaoshihou514 Thank you for responding to my queries first of all.
require("guard.filetype")("java"):lint("checkstyle")- For the first point what I meant was that the configured linter doesnt run and throws a message saying no configured formatters. Basically, I just configured java checkstyle for linting with no formatter and ranGuard fmtand got a error message sayingformatter not configuredor something of that sort.Guard fmtandGuard lintchange.xiaoshihou514 commentedon Dec 9, 2024
Basically, you want to only run checkstyle manually and infrequently, but guard doesn't provide configs for events.
231tr0n commentedon Dec 9, 2024
No what I meant is if I configure java linter like this
require("guard.filetype")("java"):lint("checkstyle")It wont run and throw error saying no formatters found.xiaoshihou514 commentedon Dec 9, 2024
This doesn't sound right, I will take a look a bit later.
231tr0n commentedon Dec 9, 2024
Sure
xiaoshihou514 commentedon Dec 9, 2024
Can't seem to repro (linter works standalone as in screenshot)
231tr0n commentedon Dec 9, 2024
Nvm I found out what the issue was! I did not push checkstyle changes to my forked repo while developing linter for checkstyle! Really sorry for making you debug this issue.
231tr0n commentedon Dec 9, 2024
Ok! I am able to reproduce it. Just run
Guard fmtwith the following configxiaoshihou514 commentedon Dec 9, 2024
Well... You didn't specify a formatter, so obviously
Guard fmtcan't do anything useful...231tr0n commentedon Dec 9, 2024
Yeah But I configured a linter right. So how do I get it to lint is my doubt.
231tr0n commentedon Dec 9, 2024
So there is no way to run a linter without configuring a formatter? Is it possible to provide a
Guard lintto only lint and makeGuard fmtto only format. Probably just invokingGuardcan do both linting and formatting. I think this is a really good idea.xiaoshihou514 commentedon Dec 9, 2024
Hey the linter is triggered automatically on these events
guard.nvim/lua/guard/filetype.lua
Lines 90 to 94 in d5b4a49
Maybe inject a few print statements into the linter to see if your regex is working properly.
You can trigger a manual lint refresh by
:lua require("guard.lint").do_lint()Hope that helps :)