text
stringlengths
0
2.02k
[2753.86 --> 2755.70] And then I just jumped straight to there.
[2756.10 --> 2757.80] If there's only one left.
[2757.86 --> 2759.24] Otherwise, I open quick fix list.
[2759.24 --> 2765.64] So that's like really cool because now I only have to press the button to jump to that implementation.
[2765.64 --> 2770.52] And it does exactly what I hope only in go code and everywhere else.
[2770.58 --> 2772.34] It does the standard definition.
[2772.34 --> 2772.62] Right.
[2772.62 --> 2776.74] So there's this concept and idea of like the way that we want to design.
[2776.74 --> 2788.72] It was this is just an interface for both language tool makers and like editor tool makers to be able to interact with in a way that you can customize to be just the way that you want.
[2789.08 --> 2789.72] Good explanation.
[2790.10 --> 2790.90] It's just amazing.
[2791.02 --> 2793.04] I'm trying to think of ways that I might implement this.
[2793.30 --> 2798.54] Nick, sometime you're welcome to come on my stream and we can work on implementing it for you or something.
[2798.62 --> 2799.72] It would be fun for this.
[2799.84 --> 2800.60] For some other case.
[2800.60 --> 2802.38] That'd be a lot of fun.
[2802.52 --> 2803.14] That does sound fun.
[2804.02 --> 2806.54] So tell me about the client server situation.
[2806.70 --> 2812.74] Is this like a network server or is this like an embedded binary that you call?
[2812.88 --> 2815.18] How does it actually talk and explain that?
[2815.68 --> 2815.84] Yeah.
[2815.84 --> 2823.58] So LSP can the primary modes that people use to communicate are either just standard in standard out or you can do it over TCP.
[2824.18 --> 2833.02] Generally, if you're doing it over TCP, people just use some pipe and then pretend that it's TCP or something like that instead of actually doing TCP.
[2834.28 --> 2838.00] But so NeoVim doesn't care what's on the other side.
[2838.30 --> 2840.60] We take a list of commands.
[2840.82 --> 2843.28] We spin up that thing and start it.
[2843.28 --> 2846.94] And then we have standard in standard out between the two.
[2847.18 --> 2851.28] And we just send basically JSON over the wire for a request.
[2851.50 --> 2855.32] And then they'll send JSON back over the wire to get to us.
[2855.34 --> 2856.48] And it's just like a pipe.
[2856.66 --> 2860.00] Generally speaking, it's possible to do to do other things.
[2860.00 --> 2863.66] So you could have anything on the other side.
[2864.02 --> 2866.14] So, for example, go, please.
[2866.24 --> 2869.06] The go language server is written in go.
[2869.06 --> 2873.74] And so it's just a go binary on your machine that you say, go, please start up.
[2874.00 --> 2881.94] You send basically a configuration request so it can understand what directory am I in, what's part of this project, all those kinds of things.
[2881.96 --> 2882.10] Right.
[2882.14 --> 2884.18] That's part of the protocol to understand.
[2884.40 --> 2887.24] And then it will just respond to requests as you send it.
[2887.24 --> 2894.42] So there's also things like Microsoft's PyLance, which you can only run in VS Code due to licensing concerns.
[2894.42 --> 2897.08] But that's written in TypeScript.
[2897.50 --> 2899.06] So it's not written in Python.
[2899.20 --> 2902.80] It just does the analysis in TypeScript and then sends the responses.
[2903.04 --> 2904.80] But you're just editing Python files.
[2904.86 --> 2905.82] You don't care what it's written.
[2905.90 --> 2907.86] And it's just a protocol that talks between the two.
[2907.86 --> 2910.54] So let's say I wanted to teach NeoVim a new language.
[2910.94 --> 2911.18] Yep.
[2911.30 --> 2912.48] Let's say I had a language called Inc.
[2912.70 --> 2914.50] And I wanted it to understand Inc.
[2915.02 --> 2922.00] Would I then provide my own LSP or would I plug something into the LSP that NeoVim ships with?
[2922.04 --> 2922.98] How would I get it in there?
[2923.60 --> 2925.84] Ah, so maybe I should take a step back.
[2925.96 --> 2930.66] So NeoVim's LSP client is just Lua code that's inside of NeoVim.
[2930.82 --> 2931.98] It's an LSP client.
[2932.10 --> 2934.70] It does not have its own language server in there.
[2935.00 --> 2935.24] Right.
[2935.30 --> 2935.78] That's correct.
[2935.78 --> 2938.76] So it doesn't know how to answer any of the questions.
[2938.88 --> 2940.12] It only knows how to ask.
[2940.34 --> 2944.22] I thought maybe it had like a set number of languages that already had all of the stuff
[2944.22 --> 2945.48] ready to go.
[2945.80 --> 2946.68] Yeah, no, it does not.
[2946.78 --> 2952.22] We have NVIM LSP config, which is just like a repo that helps you get some of those running.
[2952.42 --> 2956.66] But you need to figure out how to install those and make them executable on your machine.
[2957.16 --> 2959.70] Being a package manager is not what we're good at.
[2959.78 --> 2961.88] We're good at being a text editor.
[2962.28 --> 2962.36] Okay.
[2962.42 --> 2964.58] Someone else can figure that out and do that.
[2964.58 --> 2966.88] And there are various plugins to help you install.
[2966.88 --> 2973.12] But NeoVim just has basically a bunch of Lua code that knows how to handle the responses and
[2973.12 --> 2974.38] ask the right questions.
[2974.60 --> 2977.44] You need to install separate executables to do that.
[2977.96 --> 2982.58] And to that end, I'm using something called LSP install that handles installing those and
[2982.58 --> 2985.34] then using LSP config to configure them for NeoVim.
[2985.34 --> 2987.72] Yeah, it'll just install it for you and stuff.
[2987.80 --> 2989.38] So we leave that to other people.
[2989.48 --> 2990.14] You can handle that.
[2990.22 --> 2996.34] I'm sure there will be one for specific distros or specifically for Nix or there's one for
[2996.34 --> 2997.22] Docker containers.
[2997.56 --> 2999.22] There's a lot of different ways that you can do that.
[2999.28 --> 3001.26] That's not our strong suit.
[3001.40 --> 3003.80] We try and make text editors good and fast.
[3004.62 --> 3004.88] Gotcha.
[3005.82 --> 3008.86] Well, let's move on to TreeSitter because another cool technology.
[3008.86 --> 3011.94] It seems like they seem like they're similar, right?
[3012.02 --> 3014.78] I mean, you're talking about the syntax tree of a language.
[3015.30 --> 3018.34] Help us understand TreeSitter and how it's different than LSP.
[3018.98 --> 3019.16] Yeah.
[3019.30 --> 3021.08] So this is a really common question.
[3021.28 --> 3022.94] So it's a good one for sure.
[3023.48 --> 3028.56] So a really high level way that you should start thinking about both technologies is that
[3028.56 --> 3035.18] TreeSitter only deals with one particular file and it only deals with the text that is
[3035.18 --> 3035.82] in that file.
[3035.82 --> 3038.42] It has no additional information.
[3039.18 --> 3042.70] And LSP operates much more on like a project wide level.
[3042.94 --> 3045.16] It's going to open up and read all your files.
[3045.34 --> 3046.68] It's going to index all of them.
[3046.78 --> 3050.48] It's going to put a bunch of things in memory and then it's going to be able to have some
[3050.48 --> 3054.60] specific way that you can ask certain questions and it will give certain responses.