Skip to main content

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" and "method" fields, but only the "initialize" message contains an "id" field. The "id" field must be returned in a reply and therefore any message that doesn't contain one is a notification that does not expect a reply.

My LSP code takes the "method" field and uses it to create an object using reflection and populating it with data from JSON. So far I have "msg_initialize" and "msg_initialized" Types that are working and a "msg_shutdown" that doesn't seem to work at the moment.

My LSP "initialize" response currently only returns the hover capability which means I should start getting additional messages when I get back to it.


Comments

Popular posts from this blog

Discord Gateway for MQTT

I have created a new organisation  on Github today as a place to add automation scripts and the first one I will add is a gateway for Discord. This core of this script was originally created when I needed to send crash alerts from an application I had written to my phone so that could act upon them quickly. This proved useful and I added it to additional scripts and applications, but found that it was a bit limited if I wanted the alert to be logged elsewhere so I updated my apps and scripts to send to MQTT. Once my alerts were in MQTT I could pick them up from NodeRed and perform various actions; but I missed having them arrive in Discord, so last night I created an MQTT-2-DISCORD module that includes  support for multiple discord channels. Installation is fairly simple and I have documented the process in the README.md file associated with the repository. After installation, visit Discord and obtain a webhook for the channel you want to recieve messages into. You can name t...

Wednesday morning!

I've not posted in a while.  I guess I'm not really used to telling the world about my life... must get better at that! Since my last post,  I have upgraded the disk and RAM on my laptop and installed Linux Mint 19.3 and found it handles my external monitor much better than the previous release.  While restoring my data and having a clear out I stumbled on a couple of unfinished projects that I really should complete, but more about that later.

Fixed Z Axis Alignment

I finally got around to fixing the Z-Axis alignment issue: After getting the frame sorted and the axis all mounted; I noticed that the Left Z-Axis didn't align As you can see, its out by quite a lot! So I ordered a replacement bracket and today I fitted it: That's much better! Its a shame it sticks out a bit, so maybe it is a piece I need to have custom made. It'll do for now.