-
Notifications
You must be signed in to change notification settings - Fork 13
SuperBOL LSP
This page aims to help you install and use the LSP with editors that are not VSCode. For VSCode check this page.
As the studio is developed using opam
the easiest way to install it is with opam
The first thing you want to do is to install and initialize opam
:
# install opam
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
# initialize opam
opam init
Then you'll need a switch with the good version of ocaml
to install SuperBOL with.
opam switch create superbol-studio 4.14.1
# you can change the `superbol-studio` by any name you want, just replace it in the following occurences
You can now check the next section (You know opam
) to install the SuperBOL LSP on your system.
First you must clone the repo and install a dependency:
git clone https://github.com/OCamlPro/superbol-studio-oss.git
cd superbol-studio-oss
opam install drom -y
Then you want to install SuperBOL (assuming the targeted install opam switch is superbol-studio
):
drom install --switch superbol-studio -y
Once the command is done running, you can check if everything went well with
opam exec -- superbol-free --version
You can add the SuperBOL LSP to your coc configuration:
{
"colors.enable": true,
"languageserver": {
"cobol": {
"command": "opam",
"args": [ "exec",
"--switch",
"superbol-studio",
"--",
"superbol-free",
"lsp" ],
"filetypes": ["cobol"]
}
},
}
If you wish to use semantic highlighting with coc, you must add to the coc configuration:
"semanticTokens.enable": true
and to your vim configuration:
au FileType cobol setlocal syntax=OFF
To work with vim-lsp you should add to your configuration:
if executable('opam')
au User lsp_setup call lsp#register_server({
\ 'name': 'superbol',
\ 'cmd': {server_info->['opam', 'exec', '--switch', 'superbol-studio', '--', 'superbol-free', 'lsp', '--force-syntax-diagnostics']},
\ 'allowlist': ['cobol'],
\ })
endif
If you want semantic highlighting to work with vim-lsp you can add to your configuration:
let g:lsp_semantic_enabled = 1
au FileType cobol setlocal syntax=OFF
You must have neovim/nvim-lspconfig
installed.
Add these lines to your neovim configuration:
require("lspconfig.configs").cobol = {
default_config = {
cmd = {
"opam",
"exec",
"--switch",
"superbol-studio",
"--",
"superbol-free",
"lsp",
"--force-syntax-diagnostics",
},
filetypes = { "cobol" },
root_dir = function(startpath)
return require("lspconfig").util.find_git_ancestor(startpath)
or require("lspconfig").util.path.dirname(startpath)
end,
settings = {},
},
}
require("lspconfig").cobol.setup({
on_attach = my_attach_function, -- should be the same as your other lsp
capabilities = my_capabilities, -- should be the same as other lsp
})
For the cobol mode in emacs, you can check this page