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

Integration with Swift Package Index #769

Open
dschaefer2 opened this issue Apr 27, 2024 · 3 comments · May be fixed by #809
Open

Integration with Swift Package Index #769

dschaefer2 opened this issue Apr 27, 2024 · 3 comments · May be fixed by #809
Labels
enhancement New feature or request

Comments

@dschaefer2
Copy link
Member

The Swift Package Index is a valuable resource for discovering gems in the Swift package ecosystem. The index web site has a cool feature that gives you code snippets that you can paste into your Package.swift to hook up the dependencies. It would be a great productivity enhancer if we could leverage the index with automations in VSCode with the help of sourcekit-lsp to discover and add these dependencies.

A potential solution would be to add a command that opens the Swift Package Index website in webview. We can inject Javascript into these pages to make the necessary calls to allow sourcekit-lsp to add dependencies to the package with the right URL and and version. swiftlang/sourcekit-lsp#1193 provides an example on how this could be done.

From there, there are two options to hook up the UI. We could inject HTML buttons and action code in the "Use this package" dialog. The better option is to work with the SPI team to add this code to the pages directly, detecting whether vscode was present and making the calls there.

The index also provides snippets for adding the target dependencies. I think that would better be done in the language server as the user is adding the target so I don't believe automation around that part of the index UI would be necessary. The user can still use the current Copy function there to add those manually in the meantime.

@daveverwer
Copy link

Hello @dschaefer2! I just got pinged with this thread. It's an interesting idea!

@finestructure and I run the Swift Package Index and we'd certainly rather be involved early with any plans you have. Would it be worth having a chat? Our Discord is probably the best place to say hi and we can start up a DM conversation or quick call there.

@dschaefer2
Copy link
Member Author

Thanks! Yeah, this could be really cool. I'm just thinking of ways of making the Package manifest easier to work with. I'm probably not the one that's going to be working on this though. I know @daveyc123 was taking a peak at it, or he may have someone else in mind.

@daveverwer
Copy link

Well, we're here (or there) whenever you need us! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants