An implimentation of the LSP for the Links programming langauge
brandonf2002 / links-lsp Goto Github PK
View Code? Open in Web Editor NEWAn implimentation of the LSP for the Links programming langauge
License: MIT License
An implimentation of the LSP for the Links programming langauge
License: MIT License
Get rename working. Plain as simple.
I just wrote handle_requests
to make use of the GATD and this not only looks and feels cleaner but also saves on doing the string comparison twice.
This should be changed in both the handle_notifications
and initialize
functions too.
Currently we have a dir called LSP that just contains type definitions and helper functions. This should be changed to be called lsp_types for clarity
Currently, the comms are modelled using an ADT that looks like this:
type file = string
type tcp_stream = int
type communication_channel =
| Stdio
| Pipe of file
| Socket of tcp_stream
And is used like:
let read_message ch : string =
match ch with
| Stdio -> read_message_stdio ()
| Pipe f -> failwith "Not implemented"
| Socket s -> failwith "Not implemented"
Because the communication is only ever chosen when the program starts and is never changed during the execution of the program the use of the match
statement will induce unneeded CPU instructions every time a message is sent/received.
We could make use of first class modules to import only the functionality we need on start up, reducing the extra checks needed during the match statement
This is useful for both me as the dev but also for the end users to debug the server when it inevitably breaks.
There is some standard to logging somewhere, this seems to be evident due to the fact that neovim has the command LSPLog
which fetches the logging info for the Language Servers.
These are 3 required notifications that have to be handled by the LSP. These are:
Currently, this gets run every time we try and parse text, should probably just save the state of the first initialise on start
Currently we have a match that ends like:
...
| Response _ -> failwith "Response"
| Batch_response _ -> failwith "Batch_response"
| Batch_call _ -> failwith "Batch_call");
These should not fail. I'm fine not implementing these but failing seems dumb.
Currently, we just read a message, write the contents to a file and terminate. Thats it.
We need to implement some form of read -> process -> write loop.
This would be easy to do as a single-threaded application. However, there is a chance that there may be messages that are waiting while we process a request.
This is why language servers are typically asynchronous, this is from the LSP spec "Language servers usually run in a separate process and clients communicate with them in an asynchronous fashion."
Currently all files are in bin/main.ml. This should be fixed
This should just be a vague wrapper for the yojson library that helps incorporate the json-rpc protocol and some LSP specifics as well.
Currently my method of testing is just to try it and read the logs. This does not seem great.
However it also seems like a lot of work for a currently unclear amount of benefit.
Idk if these should be virtual or real threads (maybe both? Probably virtual).
But a few implementations of language servers I've seen have used a main thread to process the information and then helper threads whose full jobs are to handle the transfer of data.
We need to get links in the LS ASAP.
Once #16 is done this should be high on the list
This is sent to the client by the server to update the client with the capabilities of the server. This is sent in the very first message of servers handshake response
Just noting this now so that I don't forget it
For the completion (And possibly other things down the line) we store the most recently successfully parsed ASTs. This is due to the fact that when completion is actually needed in when the program is in an unparsable state. This is all fine.
The issue is: Should we keep the parsed and desugared trees at the same point in time. To rephrase this somewhat. There are points where the first parse is successful, the desugar fails, should we choose not to update the parsed AST in this case?
Currently we update it, but this might not be the best thing to do. It may be better to keep both at the same "time" state for consistency. I do not know.
Putting it here to fix later.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.