/haxe-language-server

Language Server Protocol implementation for the Haxe language

Primary LanguageHaxeMIT LicenseMIT

Haxe Language Server

CI

This is a language server implementing Language Server Protocol for the Haxe language.

The goal of this project is to encapsulate haxe's completion API with all its quirks behind a solid and easy-to-use protocol that can be used by any editor/IDE.

Used by the Visual Studio Code Haxe Extension. It has also successfully been used in Neovim and Sublime Text[1][2], but no official extensions exist at this time.

Note that any issues should be reported to vshaxe directly (this is also the reason why the issue tracker is disabled). Pull requests are welcome however!

IMPORTANT: This requires Haxe 3.4.0 or newer due to usage of -D display-stdin, --wait stdio and tons of other fixes and additions related to IDE support.

Building From Source

The easiest way to work on the language server is probably to build it as part of the vshaxe VSCode extension as instructed here (even if you ultimately want to use it outside of VSCode), which allows for easy debugging.

However, you can also build it as a standalone project like so:

git clone https://github.com/vshaxe/haxe-language-server
cd haxe-language-server
npm install
npx lix run vshaxe-build -t language-server

This creates a bin/server.js that can be started with node server.js.

Usage with (Neo)vim

There's a large amount of language client plugins for (Neo)vim, but the best choice currently seems to be coc.nvim. A coc-settings.json that is known to work with haxe-language-server looks like this:

{
    "languageserver": {
        "haxe": {
            "command": "node",
            "args": ["<path-to-server.js>"],
            "filetypes": ["haxe"],
            "trace.server": "verbose",
            "initializationOptions": {
                "displayArguments": ["build.hxml"]
            },
            "settings": {
                "haxe.executable": "haxe"
            }
        }
    }
}

Where <path-to-server.js> can either be a server.js you built from source or simply downloaded as part of the Haxe Visual Studio Code extension ("/<you-home-folder>/.vscode/extensions/nadako.vshaxe-<version>/bin/server.js").