1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
local util = require 'lspconfig.util'
local function find_hxml(path)
return vim.fs.find(function(name)
return name:match '.hxml$'
end, { path = path, type = 'file' })
end
return {
default_config = {
cmd = { 'haxe-language-server' },
filetypes = { 'haxe' },
root_dir = util.root_pattern('*.hxml', '.git'),
settings = {
haxe = {
executable = 'haxe',
},
},
-- Default value is set by on_new_config.
init_options = {},
on_new_config = function(new_config, new_root_dir)
if new_config.init_options.displayArguments then
return
end
local hxml = find_hxml(new_root_dir)[1]
if hxml then
vim.notify('Using HXML: ' .. hxml)
new_config.init_options.displayArguments = { hxml }
end
end,
},
docs = {
description = [[
https://github.com/vshaxe/haxe-language-server
The Haxe language server can be built by running the following commands from
the project's root directory:
npm install
npx lix run vshaxe-build -t language-server
This will create `bin/server.js`. Note that the server requires Haxe 3.4.0 or
higher.
After building the language server, set the `cmd` setting in your setup
function:
```lua
lspconfig.haxe_language_server.setup({
cmd = {"node", "path/to/bin/server.js"},
})
```
By default, the language server is configured with the HXML compiler arguments
contained in the first `.hxml` file found in your project's root directory.
If you want to specify which one to use, set the `init_options.displayArguments`
setting:
```lua
lspconfig.haxe_language_server.setup({
-- ...
init_options = {
displayArguments = { "build.hxml" },
},
})
```
]],
},
}
|