[Neovim] [LSP] How to handle two different HXML configs


I successfully installed and configured Haxe for Neovim with syntax highlighting and LSP and it works well!

The issue I am facing is that I have two .hxml configs, one for the code itself and one for the tests:

├── src
│  └── ...
├── test
│  └── ...
├── build.hxml
└── test.hxml
// build.hxml

-p src
--library random
--main Main


--js bin/js/main.js


--python bin/python/main.py
// test.hxml

-p src
-p test
-L utest
-x TestAll

and from the nvim-lspconfig server_configurations.md documentation about Haxe LSP, they say that:

By default, an HXML compiler arguments file named build.hxml is expected in your project’s root directory. If your file is named something different, specify it using the init_options.displayArguments setting.

which is fine when I am editing files in the src/ directory but when I want to edit my test files it doesn’t use test.hxml so I get errors when using utest.

Is there something I can do to configure a multi workspace setup?


Does moving the test.hxml into the test/ directory work?

1 Like

have you tried pointing languageserver to test.hxml instead of build.hxml?
alternatively add a display.hxml that has both classpaths and all libs used in both build and test runs and let languageserver use that one (choose a target that works for both cases).

Hi @logo,

Thanks for the anwser, but it doesn’t seem to work because the language server doesn’t find a build.hxml file.

This is the error I have when saving a file in the test directory:

haxe_language_server: -32603: Error: Could not process argument build.hxml (file not found)

Hi @ablum,

If I do that, it will change the way the server finds the .hxml file on all of my Haxe projects which is not very convenient… It would be nice if I could specify it per project thought

One similar solution I found was to add all the libraries in build.hxml (utest mainly) so I can work with the code and the tests. (not sure if it does dead code elimination or embed the whole library if not used…)

VSCode allows per workspace settings so it’s less an issue over there. you can also have multiple haxe.configurations where VSCode will automatically switch configurations depending on which file you open (see Automatic selection of Haxe configuration based on file name by Kallekro · Pull Request #544 · vshaxe/vshaxe · GitHub).

not sure how these translate to neovim. you might want to look into enabling project specific .vimrc files so you can have custom settings per project (of course those might come with security concerns, so make sure you take precautions).

1 Like

Nice, thanks!

Are you talking about that? Project local settings · neovim/nvim-lspconfig Wiki · GitHub

For example the Lua LSP server can read a local config file per project, is there something similar with Haxe where I can provide the haxe.configurations settings?

I believe that’s something handled by vshaxe extension and not contained in Haxe languageserver. so setting haxe.configurations will do probably nothing for you.

all I found was local .vimrc stuff, that can be dangerous and apparently was deprecated some time ago.

your link looks promising. I would try to play around with that. and set displayArguments to build.hxml or display.hxml or test.hxml depending on which of them is available in project root and what your personal preferences are.
you might even be able to add commands to quickly switch from build.hxml to test.hxml and back.

let’s hope some neovim users chime in, they might be able to give you some more hands on tips and tricks.

1 Like