www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Language server

reply Alain De Vos <devosalain ymail.com> writes:
In a perfect world there would be someone uploading a youtube 
video how to implement
neovim with a dlang language-server.
With function-completions-help where hints are given about the 
functions and libraries.
If anyone could do this , this would be nice to have.
Apr 26 2022
parent reply Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Tuesday, 26 April 2022 at 18:15:57 UTC, Alain De Vos wrote:
 In a perfect world there would be someone uploading a youtube 
 video how to implement
 neovim with a dlang language-server.
 With function-completions-help where hints are given about the 
 functions and libraries.
 If anyone could do this , this would be nice to have.
I'm not a vim user, but there is this: https://wiki.dlang.org/D_in_Vim If that is what you needed to get what you want, maybe make a YouTube video about it ;-) -- Bastiaan.
Apr 27 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
I have not tested yet but i found two interesting links,

https://github.com/Pure-D/serve-d/blob/master/editor-vim.md

https://github.com/neoclide/coc.nvim
Apr 27 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
I have now a language server running for dlang and ocaml on the 
neovim editor.
I'll post here the config init.vim for someone who might be 
interested.

```
call plug#begin()
Plug 'https://github.com/vim-airline/vim-airline.git'
Plug 'https://github.com/preservim/nerdtree.git'
Plug 'https://github.com/lifepillar/pgsql.vim.git'
Plug 'https://github.com/rafi/awesome-vim-colorschemes'
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
"   - Vim (Windows): '~/vimfiles/plugged'
"   - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the 
argument
"   - e.g. `call plug#begin('~/.vim/plugged')`
"   - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
" Shorthand notation; fetches 
https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | 
separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or 
above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin'
" Use release branch (recommend)
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Initialize plugin system
Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-d', { 'for': 'd' }
Plug 'roxma/nvim-yarp'
Plug 'majutsushi/tagbar'
Plug 'Rasukarusan/nvim-select-multi-line'
Plug 'akinsho/toggleterm.nvim'
Plug 'tpope/vim-commentary'
Plug 'autozimu/LanguageClient-neovim', {
     \ 'branch': 'next',
     \ 'do': 'bash install.sh',
     \ }
Plug 'dense-analysis/ale'
call plug#end()

set number
set autoindent
set tabstop=4
set shiftwidth=4
set smarttab
set softtabstop=4
set mouse=a
set encoding=UTF-8
set rtp^="/usr/home/x/.opam/4.13.1+options/share/ocp-indent/vim"
set hidden

" enable ncm2 for all buffers and set completeopt
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window remaining in the only 
tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && 
exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif

nmap <F8> :TagbarToggle<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call 
LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call 
LanguageClient#textDocument_rename()<CR>
nnoremap <Space>v :call sml#mode_on()<CR>
" By applying the mappings this way you can pass a count to your
" mapping to open a specific window.
" For example: 2<C-t> will open terminal 2
nnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm"<CR>
inoremap <silent><c-t> <Esc><Cmd>exe v:count1 . "ToggleTerm"<CR>

let g:opamshare = substitute(system('opam var 
share'),'\n$','','''')
      execute "set rtp+=" . g:opamshare . "/merlin/vim"
let g:sql_type_default = 'pgsql'
let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"
let g:LanguageClient_serverCommands = {'ocaml': ['ocamllsp']}
let g:sml#echo_yank_str = 1
" set
let g:toggleterm_terminal_mapping = '<C-t>'
let g:ale_sign_error                  = '✘'
let g:ale_sign_warning                = '⚠'
highlight ALEErrorSign ctermbg        =NONE ctermfg=red
highlight ALEWarningSign ctermbg      =NONE ctermfg=yellow
let g:ale_linters_explicit            = 1
let g:ale_lint_on_text_changed        = 'never'
let g:ale_lint_on_enter               = 0
let g:ale_lint_on_save                = 1
let g:ale_fix_on_save                 = 1
let g:ale_linters = {
\   'ocaml':      ['merlin'],
\}
let g:ale_fixers = {
\   'ocaml':      ['ocamlformat'],
\   '*':          ['remove_trailing_lines', 'trim_whitespace'],
\}
:colorscheme jellybeans
"gc: comment

let g:LanguageClient_serverCommands = {
  \   'ocaml':           ['ocamllsp'],
  \}

```
May 13 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
I tried neovim editor & serve-d and failed.
I tried kate editor & serve-d and failed.

https://github.com/Pure-D/serve-d

Anyone has a clue ?
May 17 2022
parent Tejas <notrealemail gmail.com> writes:
On Wednesday, 18 May 2022 at 01:04:16 UTC, Alain De Vos wrote:
 I tried neovim editor & serve-d and failed.
 I tried kate editor & serve-d and failed.

 https://github.com/Pure-D/serve-d

 Anyone has a clue ?
I'm using [lunarvim](https://github.com/LunarVim/LunarVim). It provides you the ability to intall LSPs and treesitter parsers natively. Did you use `dub init` to create a project before trying to use `serve-d`? That could be why it doesn't work for you, maybe
May 17 2022