Skip to main content

Posts

Showing posts from June, 2021

LSP templates

I took a step back with my LSP and decided that what I really need is a template based system for building responses. Previously I had started creating the JSON on the fly but realised that the jsonrpc specification has what it called interfaces which are basically templates, so I wrote a Type that allows you to add templates and variables and then it joins them all together for you. It works well but I might find a better way at some later time. After getting the template system working and removing some debug messages that I think might be inadvertently picked up as responses. For reference, the LSP receives an "initialise" message from the client that contains a lot of data. In my case it was over 4k in size. The LSP then returns an "initialized" message and receives confirmation from the client in the form of an "initialized" notification. The "initialize" and "initialized" messages are very similar. Both contain "jsonrpc"

LSP and JSON

I've taken on the challenge of writing an LSP for BlitzMax NG to help with the integration of the vs-code extension.  For those who don't know what an LSP is; it is simply a communications component that is used by any IDE to obtain information regarding your source code. It then uses this information to create outline views, hover, help and diagnostics etc. Rather than use the BlitzMax JSON module, I decided to write a JSON parser specifically for this application that gives me a little more control to transpose JSON directly into BlitzMax Types. I will publish this on GitHub shortly. With the JSON module almost complete, the LSP application can now read/write to/from StdIO and I'm currently working on getting the "initialize" and "shutdown" event handlers operational. Watch this space.