SwiftFiddle / swiftfiddle-lsp

Swift language protocol server web API for swiftfiddle.com.
https://swiftfiddle.com
MIT License
13 stars 2 forks source link

[Usage Issue] - Quick setup help? #87

Open tikimcfee opened 2 years ago

tikimcfee commented 2 years ago

Hey there! Been following your libraries closely, and this lsp implementation is the latest in a line of super useful tools. Thank you very much for publishing it.

If I may, would you perhaps write out a few the necessary configurations to get this up and running? After pulling it down and trying to run, it errors out when trying to open a web socket for the API, and is looking for a resource directory and a debug.yaml configuration file. I tried to see if that was something I could generate or find in the root, but no dice on my end.

EDIT: Ah, I tried using the included docker files and managed to get it running, which is awesome! On reading some of the implementation, it looks like there's some expectation with what resources are preloaded or available to the running Vapor instance. I'm curious if this is something that can be configured in the Dockerfile? (to include resources into the server's resources) Or, is there another way you instruct the LSP to open up documents outside the container?

Thank you much for your time, and let me know if there's anything I can add to help diagnose or solve this!

kishikawakatsumi commented 2 years ago

Hello. Before I explain how to set up, let me check if perhaps this service is what you are expecting. I do not believe this service will be of any use to you.

This is a service that https://swiftfiddle.com/ uses internally for code completion and displaying type information. I don't see this service as something that others can make useful use of, but what do you hope to gain from knowing how to use it?

tikimcfee commented 2 years ago

Thanks for the time @kishikawakatsumi, and I doubly appreciate your making sure it's the right fit.

I have been looking for a semi-packaged "Swift-LSP client" for a while now, because I just cannot for the life of me figure out how to get it running myself. Between trying to communicate with the core language server process over stdin/stder, complicated structure and usage of the LSP itself, web socket implementation goofiness, and of course everything in between with dealing with shared workspaces, build caches and indices, and more.

This repo seemed a nice and easy way to bring up a localhost instance of a frontend to the internal LSP toolchain process to get access to all the standard LSP usages - completions, type information, and jump to definition. I'm working on something that uses a lot of the same ideas in your SwiftAST explorer, and much of the drive stems from the same place! Ideally, I would be able to have this docker image pull in source code remotely (git api), or share a filesystem reference to a repo on the host machine, either way.

So yep, that's the idea. If you still think there are better options, no worries - I appreciate your time in all cases. However, if you do think this isn't too far from workable, I'm absolutely all eyes and ears for your assistance, and of course offer up anything else I might be able to share to help you help me, haha.

P.S.: If you're curious, my driver for all of this is a still-mostly-toy 3D code visualizer. It's incomplete missing some core pieces, but it's at least eye catching!