genericptr / pascal-language-server

LSP server implementation for Pascal
GNU General Public License v3.0
49 stars 12 forks source link

Proxy implementation #41

Closed mvancanneyt closed 1 year ago

mvancanneyt commented 1 year ago

Hello Ryan,

Here my implementation of a proxy for LSP.

The server supports a unix socket or TCP/IP socket. By default a TCP/IP socket is used which listens on port 9898.

Currently, the proxy connects to port 9898 on localhost; so it should work out of the box. (it does here)

Everything is in place for making the proxy configurable.

I plan at least a config file for the proxy (it's halfway done).

I think command-line arguments would also be good, but I have yet to find out how to specify them in a config file/the settings in in VS code.

The code is set up so that it should be easy to support http/websocket protocols in the proxy.

Once I have the config file ready, I will also add a README.md or extend the current one.

genericptr commented 1 year ago

I'm not sure how this works so I'm going to trust you've tested it and it's working. :) Minor things, probably include the license header with your name at the top of all the new units. The code style is not the same as the existing one but honestly the code is kind of a mess anyways so I don't care too much. Going forward if you're working on an existing function/class try to match what we have but if you make your own classes you use the Delphi style (I think that's what it is right?)

mvancanneyt commented 1 year ago

I of course tested everything :-)

I included the license header, added configuration for the proxy. Fixed a log option (it was causing problems when threaded is used)

I adapted the README with instructions how to use the socket server and proxy.

No idea what you mean with code style being different, as far as I can see it is the same as the existing one, but then I am notoriously blind to coding style. Feel free to run the code through a code formatter if you think it is needed.

genericptr commented 1 year ago

Ok I haven't tested the "text mode" but if that still works I'm happy. Honestly we maybe should call that "STDIO mode" since that's what client packages seemed to be calling it but we can address that later if we need to.

There were a number of formatting problems with indentation and spaces between operators in particular like I:=10;. The case of fields is in question also and I believe we we were doing lowercase for fields like "fSomeVar: Integer". I don't want to bog us down with this but in general if you can match the existing styles in established files that would be great.