⚠️ Warning (Please read this first) ⚠️
OFFICIAL EFFORTS ARE NOW LOCATED AT: https://github.com/vlang/v-analyzer
🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺 🔺
V Language Server
V Language Server (also known as "VLS") is a LSP v3.15-compatible language server for
the V programming language
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
VSCode
The official
V VSCode extension
If you want to use an existing copy of VLS, please refer to this
guide
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:
NOTE
: If you are downloading V from Homebrewand 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
VSCode, VSCodium, and other derivatives
GitHub Web Editor
and VSCode Onlineare not supported yet at this moment. See this issue comment.
For
Visual Studio Code
If you have VLS downloaded in a custom directory, you need to input the absolute path of the
vls
vls
vls/bin/vls
vls/bin/vls.exe
Sublime Text (3 and 4)
For Sublime Text, please install the
LSP extension
Preferences: LSP Settings
{
"clients": {
"vls": {
"enabled": true,
"command": ["v", "ls", "--socket"], // or ["<path-to-vls>", "--socket"] if you downloaded / compiled it manually
"tcp_port": 5007,
"selector": "source.v"
}
}
}
Be sure to install the
Sublime V Plugin
NeoVim
For NeoVim, install
nvim-lspconfig
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
.v
:LspInstallServer
Panic Nova
See the
VLS extension
IntelliJ IDEA, GoLand, and other derivatives
VLS on JetBrains / IntelliJ-based IDEs does not work at this moment.
See
issue 52
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\<user_name\.vls\reports
~/.vls/reports
Bugs that are not crashes however can still generate reports by passing the
--generate-report
Logging
VLS provides a log file (
${workspacePath}/vls.log
--debug
Frequently Asked Questions
What is a language server?
A language server is a software that understands the code provided by the user and provides information to supported text editors and IDEs. Think of it as a compiler that does not emit an executable but a format that your text editor can use in order for you to work on a project better and faster.
Some of the commonly used features such as autocompletion / IntelliSense, go to definition, and diagnostics are directly handled by the language server itself and not by the dedicated language extensions.
What does it support?
Currently, VLS supports the following language features:
Feature Name | Supported? | Notes |
---|---|---|
Diagnostics | ✅ | Via
v -check |
Completion | ✅ | Needs polish |
Hover | ✅ | |
Signature Help | ✅ | |
Go to Declaration | ❌ | |
Go to Definition | ✅ | |
Go to Implementation | ✅ | Limited to interfaces for now. |
References | ❌ | |
Document Highlight | ❌ | |
Code Lens | ✅ | Stub implementation |
Code Action | ❌ | |
Document Symbol / Outline | ✅ | |
Workspace Symbols | ✅ | Limited to opened documents. |
Document Link | ✅ | Stub implementation |
Formatting | ✅ | Via
v fmt |
Range Formatting | ❌ | |
Type Formatting | ❌ | |
Rename | ❌ | |
Folding Range | ✅ |
For a full list of features/methods VLS supports, see
CAPABILITIES.md
Contributing
Submitting a pull request
- Fork it (
https://github.com/vlang/vls/fork
) - Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
-
nedpals
- creator and maintainer -
danieldaeschle
- maintainer -
hungrybluedev
- contributor -
streaksu
- contributor -
ylluminarious
- contributor -
yuyi98
- contributor