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

Support installation of clangd server. #5

Merged
merged 11 commits into from
May 5, 2020
Merged

Support installation of clangd server. #5

merged 11 commits into from
May 5, 2020

Conversation

sam-mccall
Copy link
Member

This supports downloading the latest zip release from github (on
supported platforms), extracting it within the extension's 'global storage',
and running it from there.

Several flows are supported:

  • install triggered via command palette
  • check for updates triggered via command palette
  • check for updates automatically on startup (OFF by default in this patch)
  • offer to install if we can't find clangd (ON by default in this patch)

This supports downloading the latest zip release from github (on
supported platforms), extracting it within the extension's 'global storage',
and running it from there.

Several flows are supported:
  - install triggered via command palette
  - check for updates triggered via command palette
  - check for updates automatically on startup (OFF by default in this patch)
  - offer to install if we can't find clangd (ON by default in this patch)
@sam-mccall sam-mccall requested a review from hokein April 26, 2020 00:14
@sam-mccall
Copy link
Member Author

Demo of install flow: https://dump.video/i/RSJf9j.mp4
Demo of update flow + "installed but not selected" condition: https://i.imgur.com/wu0u5VN.mp4

I do want to work out how to make this testable, and may even reusable with coc.nvim. But wanted to get some feedback on the UI decisions and structure too.

Copy link
Collaborator

@hokein hokein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do want to work out how to make this testable, and may even reusable with coc.nvim. But wanted to get some feedback on the UI decisions and structure too.

The UI workflow looks great!

I just leave some nits on the code. Yeah, the concern is that the current code seems to be coupled with vscode UI, I think we can extract the code (at least the download & install bits) to a separate node module, so that it can be reused, and easier to write tests (I don't think there is an easy way to test the vscode UI bits, maybe we just leave them untested). And likely we will end up with storing the same clangd binary multiple times (e.g. storing clangd binary in a coc-specific/vscode-specific directory).

package.json Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
src/install.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@sam-mccall sam-mccall force-pushed the master branch 2 times, most recently from a603aa1 to 12a287a Compare May 2, 2020 22:03
@sam-mccall
Copy link
Member Author

(I'd still like to take a look at the structure to see how to make this reusable for coc and for testing)

@sam-mccall sam-mccall requested a review from hokein May 5, 2020 14:55
sam-mccall added a commit to clangd/coc-clangd that referenced this pull request May 5, 2020
Also has auto-update checks, but turned off by default for now.

See:
- Library with main logic: clangd/node-clangd@3ce82ac
- PR for vscode-clangd: clangd/vscode-clangd#5
Copy link
Collaborator

@hokein hokein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! the install code now is pretty clear.

}

class UI {
constructor(private context: vscode.ExtensionContext,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say the parameters are unused, then realized the TS compiler will generate the class members for us.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's weird syntax but pretty handy...

@sam-mccall sam-mccall merged commit df77d21 into master May 5, 2020
fannheyward added a commit to clangd/coc-clangd that referenced this pull request May 6, 2020
* Support installation of clangd binaries if not found.

Also has auto-update checks, but turned off by default for now.

See:
- Library with main logic: clangd/node-clangd@3ce82ac
- PR for vscode-clangd: clangd/vscode-clangd#5

* chore(package): bundle @clangd/install

* feat(install): restart coc after download

Co-authored-by: Heyward Fann <fannheyward@gmail.com>
Co-authored-by: Heyward Fann <fannheyward@users.noreply.github.com>
@hokein hokein deleted the autoinstall branch May 28, 2020 09:02
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.

None yet

2 participants