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!: event API #181

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

feat!: event API #181

wants to merge 23 commits into from

Conversation

xiaoshihou514
Copy link
Collaborator

@xiaoshihou514 xiaoshihou514 commented Dec 9, 2024

Add event API to provide control to guard autocmds.

  • events field in tool config
  • auto_lint option
  • Guard lint
  • Guard disable -> Guard disable-fmt
  • Guard enable -> Guard enable-fmt
  • Guard disable-lint
  • Guard enable-lint
  • Tests for linting functionality
  • Error reporting for linter
  • Other minor fixes and refactors

@231tr0n
Copy link

231tr0n commented Dec 10, 2024

Apologies for commenting here but are we providing lint_on_save option similar to format_on_save.

@xiaoshihou514
Copy link
Collaborator Author

@231tr0n The goal is to give full control over on what events what should happen.

@231tr0n
Copy link

231tr0n commented Dec 10, 2024

@231tr0n The goal is to give full control over on what events what should happen.

Ohh so lint_on_save, fmt_on_save and save_on_fmt are no more a thing is it?

@xiaoshihou514
Copy link
Collaborator Author

I think I will keep the existing options as nice deafults.

@231tr0n
Copy link

231tr0n commented Dec 10, 2024

I think I will keep the existing options as nice deafults.

Just a suggestion but I think it would be better to probably remove these options and let users decide when to format and lint and just provide Guard fmt and Guard lint which they can use anywhere they wish to like in BufWrite and BufWritePost events. It also reduces the amount of code to be maintained creating a win-win situation. You are free to ignore this comment if you dont want to do it that way.

One more thing is if we are going to keep the options, then might as well provide lint_on_save since that makes sense as well.

@xiaoshihou514
Copy link
Collaborator Author

Yeah I guess it makes sense.

Will call it auto_lint since it's not exactly lint on save.

@xiaoshihou514
Copy link
Collaborator Author

Reminder to self:

  • individual event handling
  • check au attach needs to handle custom events

@xiaoshihou514
Copy link
Collaborator Author

Need to rewrite the whole event module, will take a while to land

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.

3 participants