GithubHelp home page GithubHelp logo

vls's Introduction

⚠️ Warning (Please read this first) ⚠️

What you're seeing is the developmental branch of the V Language server. This means that it may not be guaranteed to work reliably on your system.

If you are experiencing problems, please consider filing a bug report.

V Language Server

CI

V Language Server (also known as "VLS") is a LSP v3.15-compatible language server for the V programming language.

Download / Installation

Pre-built/Precompiled Binaries (Recommended)

Pre-built binaries for Windows (x64), MacOS (x64/M1), and Linux (x64) can be found here.

VSCode

The official V VSCode extension provides a way to automatically download and install VLS by checking the "Enable VLS" in the extension settings in which a message prompt will appear for you to install VLS.

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
  • V (0.2.2 and later).

NOTE: If you are downloading V from Homebrew and other community-maintained packages, please do v up first before proceeding.

Linux and MacOS users are also expected to install the Boehm GC library.

  • For Debian/Ubuntu users: sudo apt-get install libgc-dev
  • For MacOS (via Homebrew): brew install bdw-gc

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 current root directory `vls`.

Setup / Usage

To use the language server, you need to have an editor with LSP support. See this link for a full list of supported editors.

VSCode, VSCodium, and other derivatives

GitHub Web Editor is not supported yet at this moment. See this issue comment.

For Visual Studio Code and other derivatives, all you need to do is to install 0.1.4 or above versions of the V VSCode extension. 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

Sublime Text (3 and 4)

For Sublime Text, please install the LSP extension via Package Control. Afterwards, open the command palette, select Preferences: LSP Settings, and add the following configuration:

{
    "clients": {
        "vls": {
            "enabled": true,
            "command": ["<vls-dir>/vls"],
            "selector": "source.v"
        }
    }
}

If you cloned the repository and compiled it from source, the executable will be in the vls root directory. So make sure to set the command array to vls/bin/vls or vls/bin/vls.exe (for Windows).

Other Editors

VLS on JetBrain IDEs does not work at this moment. See issue 52 for more details.

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

Roadmap

  • Queue support (support for cancelling requests)

General

  • initialize (Activates features based on VSCode's capabilities for now.)
  • initialized
  • shutdown
  • exit
  • $/cancelRequest

Window

  • showMessage
  • showMessageRequest
  • logMessage
  • progress/create
  • progress/cancel

Telemetry

  • event (Implemented but not usable)

Client

  • registerCapability
  • unregisterCapability

Workspace

  • workspaceFolders
  • didChangeWorkspaceFolder
  • didChangeConfiguration
  • configuration
  • didChangeWatchedFiles
  • symbol
  • executeCommand
  • applyEdit

Text Synchronization

  • didOpen
  • didChange
  • willSave
  • willSaveWaitUntil
  • didSave
  • didClose

Diagnostics

  • publishDiagnostics

Language Features

  • completion
  • completion resolve
  • hover
  • signatureHelp
  • declaration
  • definition
  • typeDefinition
  • implementation
  • references
  • documentHighlight
  • documentSymbol
  • codeAction
  • codeLens
  • codeLens resolve
  • documentLink
  • documentLink resolve
  • documentColor
  • colorPresentation
  • formatting
  • rangeFormatting
  • onTypeFormatting
  • rename
  • prepareRename
  • foldingRange

Crash Reporting

When reporting a crash in the language server, you just need to copy the contents of the latest auto-generated error which can be found in the home directory (C:\Users\<user_name> for Windows, /home/<user_name> for Linux, and /Users/<user_name> for MacOS). The contents of the file can be then pasted into the issue tracker form.

Bugs that are not crashes however can still generate report by passing the --generate-report flag to the language server CLI.

Debugging

VLS provides a log file (${workspacePath}/vls.log) for debugging the language server incoming requests and outgoing responses / notifications. By default, this can only be saved and accessed on server crash. To save the log on every exit, pass the --debug flag to the language server CLI.

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

vls's People

Contributors

05st avatar alehander92 avatar danieldaeschle avatar ekopalypse avatar gladear avatar henrixounez avatar hungrybluedev avatar jarred-sumner avatar medvednikov avatar nedpals avatar serkonda7 avatar shyim avatar spaceface777 avatar spytheman avatar streaksu avatar surmanpp avatar ylluminarious avatar yuyi98 avatar zhouzhuojie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.