openlawlibrary / pygls

A pythonic generic language server
https://pygls.readthedocs.io/en/latest/
Apache License 2.0
585 stars 104 forks source link

Allow `source.fixAll` code action #293

Closed charliermarsh closed 1 year ago

charliermarsh commented 1 year ago

There's a code action called source.fixAll, referenced here, that's missing from the CodeActionKind enum.

Happy to add it via PR if welcome.

tombh commented 1 year ago

Charlie of Ruff fame!? 🙇

We just hadn't upgraded to conform to the latest LSP spec yet, we're still on v3.15. And manually following the spec will become a thing of the past for us too because we've got a new breaking change release PR that will swap out our LSP types to depend directly on Microsoft's own Python LSP types: #273. It's actually usable with pygls=1.0.0a2 and we're looking for feedback on it.

Anyway, either way, this just looks like a single line change, does this work: #294?

charliermarsh commented 1 year ago

Hahah I've never gotten that before! Very flattered! And thanks for all your work on pygls, it's much appreciated.

Yeah, #294 looks great! Thanks tons. I was considering PRing it myself but I saw some rumblings about the 1.0.0 release and so wasn't sure if there were still active contributions on the existing code.

Speaking of 1.0.0: would you say that it'd be worthwhile for me to attempt an upgrade now? I'm happy to migrate (with the expectation that some things may change, and so I may have to make further edits when it stabilizes), but if you expect significant changes, I'd probably hold off.

tombh commented 1 year ago

Haha, well I'm sure that'll be the first of many star struck moments. I think Ruff is an awesome project.

I'll get #294 released then.

To the best of our current knowledge, that 1.0.0 branch is in fact ready for release. It's really just down to me to decide when the right moment is to release it. I'm relatively new to the project, so a bit nervous to force a breaking change onto the world. I'm basically just waiting to see if there's any more feedback. So, if you're in the middle of developing a Pygls-server I would actually recommend 1.0.0a2 over the current stable release, just because it'll save you the refactor later on.

Actually, now that I think about it, I should update the README to say that we no longer recommend starting new projects with the current v0.x.

charliermarsh commented 1 year ago

Cool, I'm making a bunch of upgrades to the Ruff extension so it probably makes sense for me to give 1.0.0a2 a shot! In the interim though, thanks again for #294, will be really useful for me.

tombh commented 1 year ago

Great, #294 is waiting for review from the team, so will probably be released in the next few hours. Then you'll be able to use either; the current release or the alpha release 😏

charliermarsh commented 1 year ago

Initial upgrade here: https://github.com/charliermarsh/vscode-ruff/pull/37

tombh commented 1 year ago

That was quick! Glad it was straightforward. Just released the fix on the current stable version too https://pypi.org/project/pygls/0.13.1