-
Notifications
You must be signed in to change notification settings - Fork 59
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: public progress API for non-lsp use cases #178
Conversation
f8bc9d8
to
5cc3d6b
Compare
Hey @willothy this is an awesome feature, thanks for making the PR! A couple of organizational nits:
I'll review the actual code more soon (I've been working a lot of documentation today so that's just been top of mind). |
Sounds good! I'll make those changes now. |
5cc3d6b
to
5542298
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks so much for the organizational changes!
My non-nit concerns are primarily about how the Handle
methods and the Message
fields are combined and delegated. I've written about them inline.
I have some ideas about how I'd like this to end up, so I'll take a pass through and take a crack at addressing some of the issues I raised. But please let me know if anything I've said doesn't make sense, or if I've missed the point of something you did.
Refactoring now, I'm not a fan of the way I did this either - I'm not sure the reactivity is really even needed, maybe it's best to use |
lol I thought the very same thing while reviewing this, but then I stopped thinking that because I think it's also a very cool use of metamethods. And I think I see an elegant (ish) way to make it work. Do you mind if I take a crack at it? And if it still ends up kludgy, we can expose an interface that only supports updates using the |
Of course, go ahead! Exactly, it's cool but maybe not needed. We'll see how it goes. I'm also reworking it though fyi, so I'll be pushing to this branch. |
Ok, I'll let you work on it first! It's your PR (: Some notes about what I was thinking (in case these suggestions are helpful):
The main hiccup I foresee with this approach is that |
Thanks! I've pushed a reworked version that addresses (I think) all of your feedback, and I think your suggestions align with what I've done in the latest commit. The raw fields can technically be accessed, but I named the field |
I don't think this should be needed, if bulk updates are needed they can be done at once with |
a951c99
to
e9bef6b
Compare
Alright, should be good to look over again :) |
bf50612
to
5c76be6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I left a bunch of smaller comments/suggestions inline.
nit: I prefer to use the following format for doc comments:
---@class SomeClass no space for things that begin with @
---@field eg any
--- But space in front of regular paragraphs.
--- Like this.
---
--->lua
--- -- another exception made for vimhelp code markers
--- -- to avoid confusing vimhelp
---<
---
--- etc.
6db4556
to
278e28a
Compare
Related: #70 |
Is the main difference the |
5604d4d
to
db1b125
Compare
Yep, that's right. Also, I'm testing the API doc generation using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions to appease lemmy-help
Yeah I've had that experience as well :/ It's tough to get lemmy-help working correctly |
Just pushed 0665f05, which gives you a script to try generating docs yourself (: |
Cool, I'll rebase and then mess around with it until it works. |
774851f
to
d59adf8
Compare
Seems to be working now! Docs are generated. |
54b7f0d
to
e5db22d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good to me, thanks for the fantastic PR!
just a sec, there are warnings from the type annotations. |
Thanks for building this plugin! Glad I could contribute something cool :) |
Co-authored-by: John Hui <11800204+j-hui@users.noreply.github.com>
e5db22d
to
edab311
Compare
Ok, all good to go! The syntax that worked was |
Awesome! Thanks for taking the time to review this, I'm excited to see what people come up with! |
Yeah me too! Thanks again for the idea and implementation! |
Totally, my pleasure! Do you have a setup for tests, or would you accept a followup PR with CI and some tests? |
Oh I'd love that 😍 It's been on my TODO list but I haven't gotten around to it yet. (The possibility of testing was one of the reasons behind me splitting up the plugin into separate progress and notifications subsystems, and also maintaining a notifications view/abstract state separate from the window). |
Cool, sounds good! Do you have a preference for plenary vs. mini for test framework? |
This is something I've been wanting for a while, since the only way to do it (until now) was to create a mock LSP server/client using
vim.lsp.start()
. This PR adds a functionprogress.create()
which returns a reactive progress handle, allowing for progress messages to be created and easily updated by users in their configs or in other plugins.The handle is identical to the
ProgressMessage
type, except it has methods for reporting / completing the progress and is reactive to changes so the user doesn't need to callnotify
repeatedly.Could also be simplified if the reactivity isn't needed, so all updates would be done with
ProgressHandle:report()
.Still needs docs and stuff, but figured I'd open up a PR with what I have to see if there's interest.