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(extensions): allow github extensions to be installed through development mode #5002

Conversation

asmodeus812
Copy link
Contributor

Problem description #5001

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 78.57143% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 98.55%. Comparing base (48bae5f) to head (7ae5ff3).

Files Patch % Lines
src/extension/installer.ts 78.57% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5002      +/-   ##
==========================================
- Coverage   98.56%   98.55%   -0.02%     
==========================================
  Files         273      273              
  Lines       26072    26074       +2     
  Branches     5390     5390              
==========================================
- Hits        25698    25697       -1     
- Misses        218      222       +4     
+ Partials      156      155       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@asmodeus812 asmodeus812 force-pushed the bugfix/fix-github-extension-deployment branch from 6d362d0 to 7ae5ff3 Compare May 2, 2024 14:11
@fannheyward
Copy link
Member

fannheyward commented May 6, 2024

Similar discussion #4960

I'd like to recommend to use plugin manager to install extensions that not published to npm yet. Something like Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'} https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions#use-vims-plugin-manager-for-coc-extension

This fix treats the URL github.com as whitelist to allow running in development mode, what if an extension hosted with gitlab.com or sr.ht or custom git repo? My thought: limit CocInstall to run in production only, and use plugin manger to run in development mode, with more flexibility.

The primary use of CocInstall from a URL is to install code snippets like https://github.com/rafamadriz/friendly-snippets.

@asmodeus812
Copy link
Contributor Author

asmodeus812 commented May 6, 2024

Hi Thanks for taking a look,

The main reason i would like to have coc manage this instead of a plugin manager, is first most package managers do not provide an api to do this programatically, they are declarative, so you have do it in your plugin config, where as i want the clone and build of the extension to happen programatically when i choose that. I can easily do that with CocInstall for regular npm hosted packages. I do not like the idea of having two completely separate paths working differently but essentially doing the same thing.

Secondly there is no way to ever build an extension from a clone of a github repo with the current implementation. Most of coc extensions have a lot of devDependencies, and the current implementation fails to build everthing that it downloads from github, due to the devDeps not being downloaded in production mode. Meaning that feature (to pull an extension from github) is effectively dead as it is. It is not working anyway. (It can only work if the owner includes the lib build artifacts, which noone does, it is not a good idea too since those could be quite big)

As for the source being github, can be easily extended to work with other hosts, but most package managers only support github (maybe gitlab too, at the very best) to begin with any way.

If it is a custom git repo, it should be probably managed by the user, i think coc providing a way to clone from github is at the very least an MVP, allowing users to pull from packages which are possibly not published or the repo is not synced with npm that often (which was one of my other use cases too, i had an extension not be up to date in npm compared to the repo), anything more should be managed by the user.

I just wanted to make the existing feature work correctly.

@fannheyward fannheyward changed the title Allow github extensions to be installed through development mode feat(extensions): allow github extensions to be installed through development mode May 7, 2024
@fannheyward fannheyward merged commit e1999ee into neoclide:master May 7, 2024
3 of 4 checks passed
@fannheyward
Copy link
Member

cc @Freed-Wu

fannheyward added a commit that referenced this pull request May 17, 2024
2c7e715 chore(packages): dependencies (#5010)
fce6804 feat(completion): add reTriggerAfterIndent (#5009)
c7e92a7 chore(packages): dependencies (#5008)
97d7055 chore(packages): dev dependencies (#5007)
4a31f1a test(installer): pnpm case (#5006)
e1999ee feat(extensions): allow github extensions to be installed through development mode (#5002)
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