Implementing Language Server Protocol (LSP) support for a programming language involves using frameworks like LSP-kit to handle the complex RPC communication, while focusing on implementing core features such as syntax error detection, type inference, and code completion; the implementation requires careful testing and documentation, and developers can learn from studying existing implementations rather than relying solely on AI tools.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Zig made building an LSP for my language trivialAdded:
Now, I'm just going down the old version of rather the programming language for you. And let me go into this file that doesn't work anymore. It just doesn't.
And we get LSP errors, which is amazing.
Right? We get We get like actual edits in the editor cuz the syntax doesn't match. Now, obviously, it doesn't give us good errors, but it gives us like an error, which is always nice. That's always nice a nice to catch before like compile time. Um It just speeds up the whole thing immensely. But yeah, we do have that now. And if we open say for example as there are we some random file and we want to make like a function of double for example. And it's going to take it an end of ends. Uh and then we say, "Yo, n by 2." That's what it's going to return. It's actually going to infer what it's going to have. So, if we say to uh const x equals double uh two, we know that it's an int and it's inferred somewhere, but if we say it's a string, it's going to say, "Yo, it wants a string, but it got an int." It knows that we got an int cuz it's inferred and such, right? And if we say pass in like an actual string where it wants an int, it says that. Now, you see, this is not the shape of the errors that I would want here. So, for example, this would be wants int, got string.
Uh this would be like This is going to be a lot of complexity that we'll have to like add later on, but uh I kind of I kind of prefer that it is. Now, obviously, it's it's kind of bad it's kind of bugged. It's not the best, but you know, that's how it is. I also have this, right? Uh it says here, "Wants wants one argument, got two."
Uh but obviously, I'm I'm going to I'm going to say like, "Yo, one extra argument."
Yeah, one extra args.
Uh that's how I'm going to do it, but not today. Um but yeah, let me actually go over how this is implemented. Let me uh first of all, zig built LSP fetch to get our dependencies. And what does that Huh?
Oh, that that was my That was my micro I thought I thought it was going crazy low key. Oh, oh, is this this Okay, well, this shouldn't be here, but anyways, anyways, we're going to LSP.zig. I actually started document in my code a little bit. So, you know, if you go into server.zig, it's all documented, it's all annotated. This is not the case for anything else, which I'm going to fix, right? I've been like specifically going on going out and like adding annotations everywhere to make it better. But yeah, this is what we have.
We use LSP-kit made by the ZLS team. Uh that's what they use. And they have this like little framework, quote and quote, uh which lets us implement our LSP very easily. We don't have to handle like the actual RPC here. We just do it. We just do it. We give it like a a little handler, which is like it's an interface essentially. Well, not necessarily an interface, but that's what we have. And it has to like have some certain functions. So, for example, if we want to implement uh textDocument/hover right here, we just make a function textDocument/hover. And it like does it all automatically, which I feel like is always nice.
Um so, that's what we do here. We use our like uh I have like a big workspace.zig file, right? It has like a ton of tests, which are all play in the tests. I feel like that's amazing. Um and it's like does the back-end stuff for this. Uh it like uh handles the whole thing with the compiler and the analyzer and the static uh slash non-static analyzing all of that stuff. All of that stuff. And then this is just like a thin wrapper. It's it's like a little bit of glue around that.
Um now, LSP is notoriously well, not notoriously. I actually don't know what the community situation in here is.
Um but it's very hard to test cuz you have to test it manually. And when you make like one change, it might cascade, which is like normal, but you know, I prefer to have tests. So, I did it for Python, right? I did it for Python.
Uh I pulled in pytest_lsp.
That's what it Uh and I just did all of this. I just did all of this. Uh you know, I consulted I consulted a little bit with the LLM how to use this cuz this is just stuff that I'm not familiar with. And it's stuff that does not come up in my LSP, unfortunately. So, I I did have to do that. Um but this is a temporary solution. So, uh and and it's not going to like get shipped to the user, so it's fine. Um so, yeah. That's what we have to test it. Uh it's very convenient, actually.
It's very convenient cuz uh you know, when you have to write all of this uh like by hand and then you have to uh read all of this again and then you have to modify it like all of the time. Uh it's important that the language like isn't efficient, but it's very easy to modify. It's very easy to delete. So, yeah. This is Pytest. Uh Pytest is a very nice framework for which we have to like initialize a VM, which I'm not going to do right now, but yeah. Uh that's what we have for it. Um that's that's what it does. Yeah. Uh and completion is just handled like this.
It's a little, you know, it's a little shitty. It's not It's not the best, but it works. All right, it works. It does all that you want here. Um it it's like super small. It's 200 lines. Um what we do here, by the way, is uh text document {slash} insert. It's a protocol in LSP for uh expanding stuff, right? So, if I say, for example, Hydra V and I say uh print and I do control Y to confirm it. Uh it gives me the arguments like inside the whole thing. Now, it doesn't work for anything. Uh it doesn't work for everything, so this doesn't work. And I have to fix all of that, but I'm quite like satisfied with what we have like today. I'm probably not going to do any more LSP work cuz I'm the kind of guy like I like to read specs and I like to read other people's code to actually like uh do stuff.
Right? I don't I don't like to like do guides and such.
Um but yeah, uh by reading other people's code, you know how and why they do stuff in their code bases, but it doesn't necessarily map onto mine.
Uh but as a matter of fact, I recommend you do that instead of like relying on an LLM to write your code cuz that's much better.
What did I do here?
What did I Okay, let's go. Um but yeah, this is like this like GitHub search replaces LLMs.
I'm not even kidding.
Like entirely. And it does like a better job of it than any LLM.
Uh so I recommend you do that. Uh and I don't see many people actually doing it for some reason. But yeah, that's what you want to do like all of the time.
Genuinely, that's like the way you want to do it.
Uh so yeah, I think I've yapped enough about this. Uh what else do we have here?
Oh yeah, also documentation for modules.
Documenting each module is always important, uh especially if you like uh set up stuff like this.
Uh you know, I have documentation for Neovim and Helix, but not for like VS Code or anything. Um but yeah, that's what I do. That's what I do.
Uh if you know anything about LSPs, please like help me.
Cuz I know like nothing about LSPs. I just know what other people did.
But there's no like theory available on the internet. That's all that we have on us.
Uh so yeah, that's how it is. Um my future plans are to make an actual format for this.
Uh I want to I want to like start like a little new module uh fresh from the start uh that doesn't like have to work with 50,000 lines of code. I feel like that's quite enjoyable. Uh but yeah, uh tap in. You know, there's going to be a little Discord server in the description. And you want to You want to go over there. You want to join that cuz uh that's a community of people who just like programming, not necessarily this language even.
Uh as a matter of fact, most people don't care about this language in the Discord so they just like a ton of a ton of dogs, a ton of nerds who like programming, and I'm a big fan of that.
I'm a big fan of that. There's like no people who LARP, which is crazy for 2026.
Uh so, yeah. Tap in, check it out, get Ravel, get Ravel the programming language. Give me a star on GitHub. Um check it out and submit an issue when you find a bug cuz there's like a lot of bugs here that, you know, I've been fixing them. I've been uh you know, trying to write a lot of code and then add tests for it, but uh that's a ton of work. That's a ton of work.
Uh I had to uh hand code like 30,000 lines of code, uh which is which is a lot of stuff. That's a lot of stuff for a person with memory issues. Uh so, yeah. That's how it is.
Uh thanks for listening. Thanks for checking this out.
Related Videos
resume fixed instantly 😭 Comment “app”andI’ll sendyou the link #parakeetaipartnership #resumetips
Ritcareer
686 views•2026-05-31
3D Basics in C
HirschDaniel
2K views•2026-06-05
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
Making Minecraft Clone with C++ & Raylib
PecaCSLive
686 views•2026-06-04
Instagram accounts got PWNed
EricParker
13K views•2026-06-03
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











