Sunday, 11 August 2024

Show HN: Multilspy – Cross platform framework to develop Language Server Clients https://bit.ly/3M1bCQJ

Show HN: Multilspy – Cross platform framework to develop Language Server Clients multilspy is a cross-platform library designed to simplify the process of creating language server clients to query and obtain results of various static analyses from a wide variety of language servers that communicate over the Language Server Protocol. It is easily extensible to support any language that has a Language Server and currently supports Java, Rust, C# and Python. We aim to continuously add support for more language servers and languages. Language servers are tools that perform a variety of static analyses on code repositories and provide useful information such as type-directed code completion suggestions, symbol definition locations, symbol references, etc., over the Language Server Protocol (LSP). Since LSP is language-agnostic, multilspy can provide the results for static analyses of code in different languages over a common interface. multilspy intends to ease the process of using language servers, by handling various steps in using a language server: * Automatically handling the download of platform-specific server binaries, and setup/teardown of language servers * Handling JSON-RPC based communication between the client and the server * Maintaining and passing hand-tuned server and language specific configuration parameters * Providing a simple API to the user, while executing all steps of server-specific protocol steps to execute the query/request. Some of the analyses results that multilspy can provide are: * Finding the definition of a function or a class (textDocument/definition) * Finding the callers of a function or the instantiations of a class (textDocument/references) * Providing type-based dereference completions (textDocument/completion) * Getting information displayed when hovering over symbols, like method signature (textDocument/hover) * Getting list/tree of all symbols defined in a given file, along with symbol type like class, method, etc. (textDocument/documentSymbol) Use of multilspy in AI4Code Scenarios like Monitor-Guided Decoding multilspy provides all the features that language-server-protocol provides to IDEs like VSCode. It is useful to develop toolsets that can interface with AI systems like Large Language Models (LLM). One such usecase is Monitor-Guided Decoding, where multilspy is used to find results of static analyses like type-directed completions, to guide the token-by-token generation of code using an LLM, ensuring that all generated identifier/method names are valid in the context of the repository, significantly boosting the compilability of generated code. MGD also demonstrates use of multilspy to create monitors that ensure all function calls in LLM generated code receive correct number of arguments, and that functions of an object are called in the right order following a protocol (like not calling "read" before "open" on a file object). https://bit.ly/4dkNXqt August 11, 2024 at 07:10PM

No comments:

Post a Comment