-
Notifications
You must be signed in to change notification settings - Fork 305
Servers VHDL
The rust_hdl language server is still under heavy development. As of now (Jan. 2019) it allows only for syntax checking and very basic semantic analysis.
As the server name implies, it's written in Rust so you must have Rust toolchain installed.
After compilation you have to manually add binaries to your $PATH. My choice is to put them in '/usr/local/bin'.
git clone https://github.com/kraigher/rust_hdl.git
cd rust_hdl
cargo build --release
sudo cp target/release/vhdl_ls /usr/local/bin
sudo cp target/release/vhdl_parser /usr/local/bin
if executable('vhdl_ls')
au User lsp_setup call lsp#register_server({
\ 'name': 'vhdl_ls',
\ 'cmd': {server_info->['vhdl_ls']},
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'vhdl_ls.toml'))},
\ 'whitelist': ['vhdl'],
\ })
endif
Keep in mind that vhdl_ls requires vhdl_ls.toml file for proper operation in large projects.
GHDL is the dominant open source tool for VHDL analysis, simulation and synthesis.
The actual ghdl-ls
binary is part of GHDL project, so you need to install or build GHDL itself.
GHDL can come with one of 3 backends: mcode, gcc, llvm. For the purpose of language server I recommend the mcode backend.
If you choose to compile GHDL yourself, don't forget to add ghdl-ls
binary to your $PATH
. My choice is to put it in '/usr/local/bin'.
Configuration is almost identical as for rust_hdl
.
if executable('ghdl-ls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ghdl-ls',
\ 'cmd': {server_info->['ghdl-ls']}, " add [-v] for debugging purposes and enable `vim-lsp` logging
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'hdl-prj.json'))},
\ 'whitelist': ['vhdl', 'vhd'],
\ })
endif
For ghdl-ls
to work properly with larger codebase, you need to prepare hdl-prj.json
project description file.
As of (Mar 2021) format of this file isn't yet frozen or extensively documented, but you can find some examples in this GH thread
The .vimrc
config above will look for this file in the directory of VHDL you've opened, or in any parent directories.