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

Make more libraries available #1917

Merged
merged 2 commits into from
Nov 21, 2020

Conversation

gandarez
Copy link
Contributor

@gandarez gandarez commented Nov 16, 2020

I started implementing a new plugin for this awesome project however I realized there's a lack of imported functions. So this PR makes few more libaries available when developing a plugin.

  • os.UserHomeDir
  • http.Get
  • http.Post
  • zip.OpenReader
  • zip.NewReader
  • zip.NewWriter

Also I added Unzip function to util.go. Since it's my very initial contribution please let me know if I missed something.

Here is the PR for the plugin channel and here is the repo for the plugin.

@zyedidia
Copy link
Owner

What's the use-case for making it possible for plugins to make arbitrary http requests and unzip files?

@gandarez
Copy link
Contributor Author

WakaTime is a plugin where eventually at the first time you install it in your machine must download a client. You can check what's about by going here www.wakatime.com and lookgin at my repo https://github.com/wakatime/micro-wakatime

@gandarez
Copy link
Contributor Author

I realized you approved micro-editor/plugin-channel#57 but this PR haven't been approved yet and wakatime plugin might break if users install it.

@zyedidia
Copy link
Owner

Hmm, would you like me to unlist it until this is resolved? You can also just require a higher version (which will be necessary anyway because these changes won't be backported to 2.0.8). I suppose I'm a little concerned about the security implications of allowing plugins to make http requests, but plugins can already run arbitrary shell commands so maybe it's not hugely different from that. Would it be reasonable to ask users to manually install the cli? An alternative approach could also be to run a shell script that is bundled with the plugin to perform the installation.

Also instead of UserHomeDir, note that you can access os.getenv("HOME"), or probably even better config.ConfigDir from the import micro/config.

@Calinou
Copy link
Contributor

Calinou commented Nov 16, 2020

Allowing HTTP requests will also make it possible to create a plugin for Code::Stats.

@gandarez
Copy link
Contributor Author

Actually all other IDEs allow the plugins to be autonomous enough and we don't require the users to install it manually unles they want to do it. Of course that's the normal flow for WakaTime. I don't see any concerns on allowing plugins to make http requests since they can fetch/send data from Apis.

@gandarez
Copy link
Contributor Author

@zyedidia any update here?

@zyedidia zyedidia merged commit 7a5f7e4 into zyedidia:master Nov 21, 2020
@gandarez gandarez deleted the feature/plugin-development branch January 8, 2023 22:58
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.

3 participants