Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vlang/vls

V language server. (Old V language server - see v-analyzer)
https://github.com/vlang/vls

language-server v

Last synced: 12 days ago
JSON representation

V language server. (Old V language server - see v-analyzer)

Awesome Lists containing this project

README

        

> ## ⚠️ Warning (Please read this first) ⚠️
>
> ## OFFICIAL EFFORTS ARE NOW LOCATED AT: https://github.com/vlang/v-analyzer
> 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺

# V Language Server
[![CI](https://github.com/vlang/vls/actions/workflows/ci.yml/badge.svg)](https://github.com/vlang/vls/actions/workflows/ci.yml)

V Language Server (also known as "VLS") is a LSP v3.15-compatible language server for [the V programming language](https://github.com/vlang/v).

# Installation
You can get the V language server on a variety of methods.

## Via V CLI (Recommended)
Starting with V 0.3.1, you can now install and update VLS via the V CLI by simply executing the following command:
```
v ls --install
```

## Pre-built/Precompiled Binaries
Pre-built binaries for Windows (x64), MacOS (x64/M1), and Linux (x64) can be found [here](https://github.com/vlang/vls/releases/latest).

## VSCode
The official [V VSCode extension](https://github.com/vlang/vscode-vlang) provides built-in support for VLS. To install VLS, go to the V section of your editor's settings and check the "Enable VLS" setting. This will look for any existing installation of VLS and will download a copy if there's none.

If you want to use an existing copy of VLS, please refer to this [guide](#vscode-vscodium-and-other-derivatives).

## Build from Source
> **NOTE**: TCC, the default compiler shipped with V, is not recommended ATM due to some issues in the Tree Sitter's output.

To build the language server from source, you need to have the following:
- GCC/Clang (Latest),
- [Git](https://git-scm.com/download)
- [V](https://github.com/vlang/v) (0.2.2 and later).

> **NOTE**: If you are downloading V from [Homebrew](https://brew.sh) and other community-maintained packages, please do `v up` first before proceeding.

Afterwards, open your operating system's terminal and execute the following:
```
## Clone the project:
git clone https://github.com/vlang/vls && cd vls

## Build the project
## Use "v run build.vsh gcc" if you're compiling VLS with GCC.
v run build.vsh clang

# The binary will be created in the `bin` directory inside the vls folder.
```

# Usage
To use the language server, you need to have an editor with [LSP](https://microsoft.github.io/language-server-protocol/) support. See [this link](https://microsoft.github.io/language-server-protocol/implementors/tools/) for a full list of supported editors.

## VSCode, VSCodium, and other derivatives
> [GitHub Web Editor](https://github.dev) and [VSCode Online](https://vscode.dev) are not supported yet at this moment. See this [issue comment](https://github.com/vlang/vscode-vlang/issues/272#issuecomment-898271911).

For [Visual Studio Code](https://code.visualstudio.com) and other derivatives, all you need to do is to install 0.1.4 or above versions of the [V VSCode extension](https://github.com/vlang/vscode-vlang). Afterwards, go to settings and scroll to the V extension section. From there, enable VLS by checking the "Enable VLS" box.

If you have VLS downloaded in a custom directory, you need to input the absolute path of the `vls` language server executable to the "Custom Path" setting. If you cloned the repository and compiled it from source, the executable will be in the `vls` root directory. So make sure to add `vls/bin/vls` or `vls/bin/vls.exe` (for Windows).

![Instructions](images/instructions.png)

## Sublime Text (3 and 4)
For Sublime Text, please install the [LSP extension](https://packagecontrol.io/packages/LSP) via [Package Control](https://packagecontrol.io). Afterwards, open the command palette, select `Preferences: LSP Settings`, and add the following configuration:
```jsonc
{
"clients": {
"vls": {
"enabled": true,
"command": ["v", "ls", "--socket"], // or ["", "--socket"] if you downloaded / compiled it manually
"tcp_port": 5007,
"selector": "source.v"
}
}
}
```

Be sure to install the [Sublime V Plugin](https://github.com/elliotchance/vlang-sublime) first in order for the language server to start properly.

## NeoVim
For NeoVim, install [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and install vls on your system.

Then, you open your lsp configuration and add the following to enable the usage of the vls `require('lspconfig').vls.setup{}`.

Afterwards, just paste the following line into your neovim configuration `vim.cmd([[au BufNewFile,BufRead *.v set filetype=vlang]])`.

## Vim
For Vim, please install [vim-lsp](https://github.com/prabirshrestha/vim-lsp) and [vim-lsp-settings](https://github.com/mattn/vim-lsp-settings). Afterwards, open any `.v` file, and execute `:LspInstallServer`.

## [Panic Nova](https://nova.app/)
See the [VLS extension](https://extensions.panic.com/extensions/louis77/louis77.vlang-vls/) for detailed instructions on how to install VLS on Panic Nova.

## IntelliJ IDEA, GoLand, and other derivatives

VLS on JetBrains / IntelliJ-based IDEs does not work at this moment.
See [issue 52](https://github.com/vlang/vls/issues/52) for more details.

You can use IntelliJ V plugin instead: https://intellij-v.github.io

## Other Editors
For other editors, please refer to the plugin's/editor's documentation for instructions on how to setup an LSP server connection.

## Crash Reports
VLS generates a report and notifies the user by default when something is wrong. These crash reports are accessible which can be found inside `C:\Users\