Ale: Any chance to integrate OmniSharp?

Created on 27 Sep 2017  路  11Comments  路  Source: dense-analysis/ale

Most helpful comment

If you really want it, you could open a pull request for it.

All 11 comments

I'm not sure. I don't know how it works. Someone else might.

Caveat - I'm new to extending Vim + Ale so my observations might not be totally accurate or completely unfounded :)

OmniSharp doesn't fit as neatly into the typical usage I've seen of Ale. By that I mean typically there's a standalone command that performs the linting whereas OmniSharp runs as a separate long-running process (using HTTP to handle back and forth between vim), it loads project files at startup to bootstrap a lot of rich functionality including linting.

It has a /codecheck endpoint that does the linting of source code and the OmniSharp-Vim plugin exposes this via Omnisharp#CodeCheck() function.

@w0rp - is it possible / can you suggest anyways to define a linter like (I know return types aren't correct but this how I could envisage it working):

function! ale_linters#cs#GetCommand(buffer) abort
        " From omnisharp-vim, returns 0 || 1
    return g:OmniSharp_loaded
endfunction

function! ale_linters#cs#Executable(buffer) abort
    call OmniSharp_CodeCheck()
endfunction

call ale#linter#Define('cs', {
\   'name': 'omnisharp',
\   'executable_callback': ale_linters#cs#Executable
\   'command_callback': ale_linters#cs#GetCommand
...

So basically instead of calling out to an external cmd, invoke a Vim function? Feels like this might be outside the use-case for Ale, and should perhaps just write a custom function to invoke the Vim function and manually add the results to the linting errors collection?

I'm not sure, that sounds a bit unusual.

Yeah, I suppose fundamentally it operates like Language Server Protocol Server would, in fact the OmniSharp team appear to be working on that (https://github.com/OmniSharp/csharp-language-server-protocol)
I didn't notice that Ale had support for LSP so maybe this will be a lot easier when this OmniSharp LSP implementation is available.

Integrating with an LSP server is a better bet.

You should maybe check out (https://github.com/OmniSharp/omnisharp-node-client). I have had success getting ominsharp support using the vim-lsp plugin. What all goes into defining linters that take advantage of ale's lsp capabilities?

Have a look at the rls or pyls linters for examples. There are a few other examples. Also consult the documentation for ale#linter#Define.

Ah damn I just switched from syntastic to ale recently and I want to start using omnisharp. The integration with syntastic is working fine so I guess the solution is to just go back to using that for now.

If you really want it, you could open a pull request for it.

Actually, OmniSharp works well with ALE. Maybe https://github.com/w0rp/ale/blob/master/doc/ale-cs.txt and https://github.com/w0rp/ale#1-supported-languages-and-tools could be updated ? And this current Issue could be closed ?

I'll add some text in the documentation. Thanks for the information!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aressler38 picture aressler38  路  3Comments

janhellmich picture janhellmich  路  3Comments

alexlafroscia picture alexlafroscia  路  4Comments

catbaron0 picture catbaron0  路  3Comments

kronos29296 picture kronos29296  路  4Comments