I set up my neo vim for haskell by following this blog
https://jkuokkanen109157944.wordpress.com/2020/11/10/creating-a-haskell-development-environment-with-lsp-on-nixos/
the only things that are suggested from coc are lexicographical things (that coc can read in the file) but it doesn’t use the language server so it doesn’t give me hints like how the function fmap is declared.
Mine:
Instead of:
my neovim nix looks like this I think I installed every package that is needed for this autocompletion
{ pkgs, ... }:
let
vimrc = pkgs.callPackage ./vimrc.nix {};
plugin = pkgs.callPackage ./plugins.nix {};
in {
environment.systemPackages = with pkgs; [
ghc
cabal2nix
haskellPackages.haskell-language-server
cabal-install
hlint
(neovim.override {
vimAlias = true;
withNodeJs = true;
configure = {
packages.myPlugins = with pkgs.vimPlugins; {
start = [
coc-nvim
haskell-vim
ghcid
vim-hindent
coc-json
coc-vimlsp
];
opt = [];
};
customRC = vimrc;
};
}
)];
}
my Cocconfig doesn’t fail and it starts the language server
{"languageserver": {
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
"filetypes": [ "lhaskell", "haskell" ],
"initializationOptions": {
"languageServerHaskell": {
"hlintOn": true,
"maxNumberOfProblems": 10,
"completionSnippetsOn": true
}
}
}
}
}
Do I Need a plugin or nix package, that the autocompletion uses the language server?
If this is the wrong Forum I am sorry, I thought the problem lies in the nix config and not in the vimrc (Feel free to suggest the right Forum.)
For Completeness my vimrc
" Helps force plugins to load correctly when it is turned back on below
filetype off
" Turn on syntax highlighting
syntax enable
" For plugins to load correctly
filetype plugin indent on
" Security
set modelines=0
" Show line numbers
set number relativenumber
" Show file stats
set ruler
" Blink cursor on error instead of beeping (grr)
set visualbell
" Encoding
set encoding=utf-8
set autoread
" Whitespace
set wrap
set textwidth=79
set formatoptions=tcqrn1
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set noshiftround
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Move up/down editor lines
nnoremap j gj
nnoremap k gk
" Allow hidden buffers
set hidden
" Rendering
set ttyfast
" Status bar
set laststatus=2
" Last line
set showmode
set showcmd
" Searching
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
" Formatting
map <leader>q gqip
" Visualize tabs and newlines
set listchars=tab:▸\ ,eol:¬
map <leader>l :set list!<CR> " Toggle tabs and EOL
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()