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:
│ └── ...
│ └── ...
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
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
Is there something I can do to configure a multi workspace setup?
Does moving the test.hxml into the test/ directory work?
have you tried pointing languageserver to
test.hxml instead of
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).
Thanks for the anwser, but it doesn’t seem to work because the language server doesn’t find a
This is the error I have when saving a file in the
haxe_language_server: -32603: Error: Could not process argument build.hxml (file not found)
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).
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
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
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
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.