Open cannorin opened 4 years ago
memo:
ale#lsp#CreateMessageData
-(message data)-> ale#lsp#Send
ale#lsp#RegisterCallback
Hi, I would like to help on this! :) Is there any work in progress?
-- Edit --
I could get a basic support with this code
function! Fsharp_callback(bufnr, lines) abort
" output example: Program.fs(7,5,7,9):FSharpLint warning FL0038: Consider changing `path` to PascalCase.
let pattern = '\([^(]\+\)(\(\d\+\),\(\d\+\),\(\d\+\),\(\d\+\)):FSharpLint \(\w\+\) \(.*\)$'
let lines = a:lines[1:-2]
let result = []
for line in lines
let matches = matchlist(line, pattern)
if len(matches) >= 7
if matches[6] == 'error'
let type = 'E'
else
let type = 'W'
end
let element = {
\ 'text': matches[7],
\ 'detail': matches[7],
\ 'lnum': matches[2],
\ 'col': matches[3],
\ 'end_lnum': matches[4],
\ 'end_col': matches[5],
\ 'filename': fnamemodify(matches[1], ':p'),
\ 'type': type
\ }
call add(result, element)
endif
endfor
return result
endfun
call ale#linter#Define('fsharp', {
\ 'name': 'FSharpLint',
\ 'alias': ['fsharplint'],
\ 'executable': 'dotnet',
\ 'command': '%e fsharplint --format msbuild lint %t',
\ 'callback': 'Fsharp_callback',
\ 'lint_file': 1,
\ })
But I'm not very help with it, it depends on files being written to disk and do it's not using LSP, I will try adding an LSP version, but then I would not use dotnet fsharplint
at all right? Once I got things more structured I open a PR :)
Great project by the way :-)
-- Edit --
I tested this approach better a it's terribly slow, I don't know if this because the dotnet fsharplint
is slow to start or if it's because of disk I/O, I'm betting that the first is the worse problem.
Anyway, I couldn't find a LanguageClient_serverComands line for FsautoComplete anywhere so I don't really know what it would be, I searched in the readme and in your dotfiles/.vimr. Are you using FsharpAutoComplete as LSP server? In theory it would be possible to get all FsharpAutoComplete features without ALE dont? Just LanguageClient_neovim would be enough
-- Edit --
Okay I got it, it was not easy to find out but here is what worked for me
let g:LanguageClient_serverCommands = {
\ 'fsharp': ['dotnet', expand('~/.vim/plugged/Ionide-vim/fsac/fsautocomplete.dll')]
\ }
@dhilst Hi, thank you very much for your work! I'm failing to take the time to improve Ionide-vim, so I don't have any WIP on this. It will help me a lot if you could improve it and make a PR!
@cannorin Hello, no problem I have some spare time at weekends, I will try add ALE support, once I got something working I open a PR so you can review.
Cheers
Related: #5 Refs: