OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.68k stars 166 forks source link

dotnet cli and all tooling 1.0.0 support #294

Open johnhidey opened 7 years ago

johnhidey commented 7 years ago

With the announcement recently that the dotnet tooling has went 1.0.0 are there plans to added in support for this. Currently, I'm unable to build a project without a makefile present.

all:
    dotnet build

It could be that I am doing something wrong, but I have never been able to get this to work without the makefile. Any insight into this

markwoodhall commented 7 years ago

For now, I've just been setting makeprg in my vimrc to the appropriate build command, along with a suitable errorformat, which I think is already defined.

On Sun, 12 Mar 2017, 13:49 John Hidey, notifications@github.com wrote:

With the announcement recently that the dotnet tooling has went 1.0.0 are there plans to added in support for this. Currently, I'm unable to build a project without a makefile present.

all: dotnet build

It could be that I am doing something wrong, but I have never been able to get this to work without the makefile. Any insight into this

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vim/issues/294, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2g9cHonL1JLUYQ12-LiJGU5pAgEBYLks5rk_ftgaJpZM4Mai2B .

johnhidey commented 7 years ago

Thanks @markwoodhall, I'll give that a try. I'm fairly new to vim and have been loving it. Left visual studio behind about 3 months ago and haven't looked back yet. Keep up the great work on this project.

markwoodhall commented 7 years ago

To give a bit more info, I do something like this:

autocmd BufNewFile,BufRead *.cs setlocal errorformat=\ %#%f(%l\\\,%c):\ %m
autocmd BufNewFile,BufRead *.cs setlocal makeprg=dotnet\ build\ /property:GenerateFullPaths=true
johnhidey commented 7 years ago

Thanks @markwoodhall

Here is what I am using and seems to be doing the trick, but I do like the way you have done it a little better using the BufNewFile and BufRead. I'll make that change.

autocmd FileType cs let &makeprg="dotnet build"

I do have a few questions if you wouldn't mind helping out a newbie.

My setup is as follows.

Intellisense is working great, but not all the other commands. Some of the other commands like Code Actions will throw an exception.

Error detected while processing function <SNR>92_AcceptSelection[27]..ctrlp#OmniSharp#findcodeactions#accept:
line    3:                                                                                                                                       
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/johnhidey/.vim/bundle/omnisharp-vim/python/OmniSharp.py", line 94, in runCodeAction
    text = json.loads(js)['Text']
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
E858: Eval did not return a valid python object

I would be grateful for any help you might be able to provide.

JasonThomasData commented 6 years ago

I might just add that OmniSharp will work fine without this, all you need is to use the dotnet new sln --name <NAME> command, since OmniSharpServer needs that .sln file. I thought I'd mention this in case there's any plans to support the dotnet cli, since this is my favourite feature of it so far. Sorry if this is slightly off topic but I wanted to make a mention of this. Info about this handy trick is here - https://andrewlock.net/creating-and-editing-solution-files-with-the-net-cli/