yegappan / lsp
Language Server Protocol (LSP) plugin for Vim9
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing yegappan/lsp in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewLanguage Server Protocol (LSP) plugin for Vim. You need Vim version 9.0 or above to use this plugin. This plugin is written using only the Vim9 script. Installation You can install this plugin directly from github using the following steps: After installing the plugin using the above steps, add the following line to your $HOME/.vimrc file: You can also install and manage this plugin using any one of the Vim plugin managers (dein.vim, pathogen, vam, vim-plug, volt, Vundle, etc.). You will also need to download and install one or more language servers corresponding to the programming languages that you are using. Refer to the https://langserver.org/ page for the list of available language servers. This plugin doesn't install the language servers. Features The following language server protocol (LSP) features are supported: • Code completion • Jump to definition, declaration, implementation, type definition • Peek definition, declaration, implementation, type definition and references • Display warning and error diagnostics • Find all symbol references • Document and Workspace symbol search • Display code outline • Rename symbol • Display type and documentation on hover • Signature help • Code action • Display Call hierarchy • Display Type hierarchy • Highlight current symbol references • Formatting code • Folding code • Inlay hints • Visually select symbol block/region • Semantic Highlight Configuration To use the plugin features with a particular file type(s), you need to first register a LSP server for that file type(s). The LSP servers are registered using the function. This function accepts a list of LSP servers. To register a LSP server, add the following lines to your .vimrc file (use only the LSP servers that you need from the below list). If you used vim-plug to install the LSP plugin, the steps are described later in this section. The above lines register the language servers for C/C++, Javascript/Typescript, Go and Rust file types. Refer to Configs.md for various language server specific configuration. To register a LSP server, the following information is needed: Field|Description -----|----------- |One or more file types supported by the LSP server. This can be a String or a List. To specify multiple multiple file types, use a List. |complete path to the LSP server executable (without any arguments). |a list of command-line arguments passed to the LSP server. Each argument is a separate List item. |User provided initialization options. May be of any type. For example the *intelephense* PHP language server accept several options here with the License Key among others. |A dictionary of notifications and functions that can be specified to add support for custom language server notifications. |A dictionary of request handlers and functions that can be specified to add support for custom language server requests replies. |A dictionary of booleans that can be specified to toggle what things a given LSP is providing (folding, goto definition, etc) This is useful when running multiple servers in one buffer. The function accepts a list of LSP servers with the above information. Some of the LSP plugin features can be enabled or disabled by using the function, detailed in . Here is an example of configuration with default values: If you used vim-plug to install the LSP plugin, then you need to use the LspSetup User autocmd to initialize the LSP server and to set the LSP server options. For example: Supported Commands The following commands are provided to use the LSP features. Command|Description -------|----------- |Apply the code action supplied by the language server to the diagnostic in the current line. |Display a list of code lens commands and apply a selected code lens command to the current file. |Display the diagnostic message for the current line. |Jump to the first diagnostic message for the current buffer. |Jump to the next diagnostic message in the current line. |Disable diagnostic message highlights. |Enable diagnostic message highlights. |Jump to the next diagnostic message after the current position. |Jump to the next diagnostic message after the current position, wrapping to the first message when the last message is reached. |Jump to the previous diagnostic message before the current position. |Jump to the previous diagnostic message before the current position, wrapping to the last message when the first message is reached. |Display the diagnostics messages from the language server for the current buffer in a new location list. |Display the symbols in the current file in a popup menu and jump to the selected symbol. |Fold the current file. |Format a range of lines in the current file using the language server. The **shiftwidth** and **expandtab** values set for the current buffer are used when format is applied. The default range is the entire file. |Go to the declaration of the keyword under cursor. |Go to the definition of the keyword under cursor. |Go to the implementation of the keyword under cursor. |Go to the type definition of the keyword under cursor. |Highlight all the matches for the keyword under cursor. |Clear all the matches highlighted by :LspHighlight. |Show the documentation for the symbol under the cursor in a popup window. |Display the list of symbols calling the current symbol. |Display the list of symbols called by the current symbol. |Show the list of symbols defined in the current file in a separate window. |Open the declaration of the symbol under cursor in the preview window. |Open the definition of the symbol under cursor in the preview window. |Open the implementation of the symbol under cursor in the preview window. |Display the list of references to the keyword under cursor in a location list associated with the preview window. |Open the type definition of the symbol under cursor in the preview window. |Rename the current symbol. |Expand the current symbol range visual selection. |Sh…