castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

Show a progress indicator for building documentation #82

Closed connorshea closed 5 years ago

connorshea commented 6 years ago

Right now when you run Solargraph: Build new gem documentation or Solargraph: Rebuild gem documentation, there's no indication of what the command is doing or if it's even running. This is super annoying, especially since it can take a few minutes for the docs to be generated.

Would it be possible to show what the number of gems that it's generated docs for, e.g. something like Documentation generated for 43/87 gems.

Thanks for the extension! :)

connorshea commented 6 years ago

So I looked at the commit that added this feature: https://github.com/castwide/vscode-solargraph/commit/03a74dcd29d36ac506b0fce968c90caef759196e

yard gems --rebuild --verbose provides a lot of info but parsing it would probably be a pain. That said, it takes a really long time for the command to run, so a progress indicator would still be nice. Even just a status bar indicator that said something like "Rebuilding documentation...". If more info could also be send to the developer tools that'd be useful as well.

connorshea commented 6 years ago

(For someone's future reference, probably: if your documentation generation is failing on mail you need to upgrade yard to at least 0.9.16: https://github.com/lsegal/yard/issues/1176)

Actually, there's already a line to set a status message like this, so why isn't working 🤔 It's lacking a semicolon, but I doubt that's the actual problem.

https://github.com/castwide/vscode-solargraph/blob/03a74dcd29d36ac506b0fce968c90caef759196e/src/extension.ts#L157

I tried disabling all other extensions, and my status bar is definitely enabled. (I can't find any settings I would have set that would effect this, and status bar messages show fine for when the server is booting).

EDIT: This code isn't in master, so that'd be why this isn't showing up :D Why was it removed in the first place?

castwide commented 6 years ago

Progress indicators would be a great feature for long-running commands. It's a little tricky to implement because it has to be custom-built in both the server and the client. The language server protocol doesn't have a specification for it, although there's a proposal at https://github.com/Microsoft/language-server-protocol/issues/70

Status bar notifications at the start and end of a process are a little easier. The current extension provides them for server initialization: "Starting the Solargraph language server" when it starts, and "Solargraph is ready" when it's finished. That process includes the preliminary mapping of the entire workspace, so it can take a while for large projects. (castwide/solargraph takes about 10 seconds on my desktop. rails/rails takes about 45).

The notification you found for building yardocs was removed because of drastic changes in the way those commands are implemented. The process gets executed by the server instead of the extension.

I'm not sure if or when I'll be able to implement progress indicators, but I can at least get those status bar notifications back. I'll add it to the roadmap.

castwide commented 6 years ago

Status bar notifications for gem documentation is in the master branch. It requires an update to the gem, which is currently in the castwide/solargraph gem-build-result branch. After the gem update is released, I expect to publish the extension update in version 0.18.0.

castwide commented 5 years ago

Version 0.18.0 includes status notifications when gem documentation starts and finishes. It should work with the latest gem.

connorshea commented 5 years ago

Thank you! ❤️ I’ll try testing it once I get into work later today.

connorshea commented 5 years ago

It looks like it works, although I ran into an error while building gem documentation :D I assume it has to do with the mail gem again.

It’d be nice if there were a button in the error notification that linked to the console (though if I remember correctly the last error was only visible in the developer tools, which you probably can’t/don’t want to link to).

castwide commented 5 years ago

Just tried it a few times. I got an error once, but it worked as expected the rest of the time. I'll see if I can narrow the problem down to a reproducible cause.

One minor bug, the extension doesn't dispose of the "Rebuilding all..." message after rebuilding all gem documentation. It works correctly when building new gem documentation only. I'll add a fix to the next patch release.