How do “lang-servers” work within VScode? How can an extension figure out an entirely custom codebase and its functions and give me definitions on just right click?

439 views

It is crazy useful and ive no idea how it works.

Server makes me think it is a web service but it works even with like completely local code that is entirely custom and stuff.

All i know is i tend to need to compile the codebase once before it gets the new function definitions.

In: 5

18 Answers

Anonymous 0 Comments

Server doesn’t automatically mean web, internet, or even network. A server is just a program that provides a service.

In this case, your code will be sent through a program, which does some processing, and sends some symbols back that vscode can read.

Here’s how it works: https://microsoft.github.io/language-server-protocol/

Anonymous 0 Comments

Server doesn’t automatically mean web, internet, or even network. A server is just a program that provides a service.

In this case, your code will be sent through a program, which does some processing, and sends some symbols back that vscode can read.

Here’s how it works: https://microsoft.github.io/language-server-protocol/

Anonymous 0 Comments

servers don’t need to be exposed to the Internet for it to act as such, it can be bound to a local port, which you do if you want to do local webdev, or communicate via some IPC (inter process) mechanisms

programming languages are fairly rigid in that they are parseable, so the code editor just send your code for every interval via IPC to the “lang servers”, where it will parse your code and send back a detailed response of its structure in some standardised format that your code editor understands, without it actually know how to parse it

Anonymous 0 Comments

servers don’t need to be exposed to the Internet for it to act as such, it can be bound to a local port, which you do if you want to do local webdev, or communicate via some IPC (inter process) mechanisms

programming languages are fairly rigid in that they are parseable, so the code editor just send your code for every interval via IPC to the “lang servers”, where it will parse your code and send back a detailed response of its structure in some standardised format that your code editor understands, without it actually know how to parse it

Anonymous 0 Comments

Server doesn’t automatically mean web, internet, or even network. A server is just a program that provides a service.

In this case, your code will be sent through a program, which does some processing, and sends some symbols back that vscode can read.

Here’s how it works: https://microsoft.github.io/language-server-protocol/

Anonymous 0 Comments

servers don’t need to be exposed to the Internet for it to act as such, it can be bound to a local port, which you do if you want to do local webdev, or communicate via some IPC (inter process) mechanisms

programming languages are fairly rigid in that they are parseable, so the code editor just send your code for every interval via IPC to the “lang servers”, where it will parse your code and send back a detailed response of its structure in some standardised format that your code editor understands, without it actually know how to parse it

Anonymous 0 Comments

Imagine your editor can ask an expert questions about the codebase and help you navigate it that way. Then the editor doesn’t need to know much about each language – all the cool analysis is handled by the language-specific program.

That language expert program is the “language server.” It’s called a server because the editor can throw requests at it exactly the same way you’d ask a backend server for information.

In general, you shouldn’t think of a “server” as something that *has* to run remotely. You have *plenty* of computing power on your workstation to run local servers, and that’s typically how server development is done.

Anonymous 0 Comments

Imagine your editor can ask an expert questions about the codebase and help you navigate it that way. Then the editor doesn’t need to know much about each language – all the cool analysis is handled by the language-specific program.

That language expert program is the “language server.” It’s called a server because the editor can throw requests at it exactly the same way you’d ask a backend server for information.

In general, you shouldn’t think of a “server” as something that *has* to run remotely. You have *plenty* of computing power on your workstation to run local servers, and that’s typically how server development is done.

Anonymous 0 Comments

Imagine your editor can ask an expert questions about the codebase and help you navigate it that way. Then the editor doesn’t need to know much about each language – all the cool analysis is handled by the language-specific program.

That language expert program is the “language server.” It’s called a server because the editor can throw requests at it exactly the same way you’d ask a backend server for information.

In general, you shouldn’t think of a “server” as something that *has* to run remotely. You have *plenty* of computing power on your workstation to run local servers, and that’s typically how server development is done.

Anonymous 0 Comments

> How can an extension figure out an entirely custom codebase

Literally the same way the compiler can do the same thing. In fact, for a lot of language server implementations, they just use part of the actual compiler (the parser, the lexical, syntax and semantic analyzers), the output of which is [a tree representation](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of all the things in the code, plus the errors the analyzers found.