Vim / Neovim

AutoCompletion

For C++, anything that can use an LSP like coc.nvim, nvim-lspconfig, or what not, should work as long as you generate a compilation database and point to it.

Additionally, YouCompleteMe works without the need of a C++ compilation database as long as you have run ./mach build or ./mach configure. Configuration for this lives in .ycm_extra_conf at the root of the repo.

Rust auto-completion should work both with Rust’s LSP rust-analyzer.

Make sure that the LSP is configured in a way that it detects the root of the tree as a workspace, not the crate you happen to be editing. For example, the default of nvim-lspconfig is to search for the closest Cargo.toml file, which is not what you want. You’d want something like:

root_dir = lspconfig.util.root_pattern(".git")

You also need to set some options to get full diagnostics:

"rust-analyzer.cargo.extraEnv": {
  "CARGO_TARGET_DIR": "/path/to/objdir"
},
"rust-analyzer.vfs.extraIncludes": ["/path/to/objdir", "/optional/path/to/windows_rs_dir"],
"rust-analyzer.check.overrideCommand": [ "/path/to/mach", "--log-no-times", "cargo", "check", "--all-crates", "--message-format-json" ],
"rust-analyzer.cargo.buildScripts.overrideCommand": [ "/path/to/mach", "--log-no-times", "cargo", "check", "--all-crates", "--message-format-json" ],

The easiest way to make these work out of the box is using codesettings.nvim, which automatically supports importing VSCode configuration files. ./mach ide vscode --no-interactive will then generate the right configuration for you.

ESLint

The easiest way to integrate ESLint with VIM is using the Syntastic plugin.

mach eslint --setup installs a specific ESLint version and some ESLint plugins into the repositories’ node_modules.

You need something like this in your .vimrc to run the checker automatically on save:

autocmd FileType javascript,html,xhtml let b:syntastic_checkers = ['javascript/eslint']

You need to have eslint in your PATH, which you can get with npm install -g eslint. You need at least version 6.0.0.

You can also use something like eslint_d which should also do that automatically:

let g:syntastic_javascript_eslint_exec = 'eslint_d'