Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:OmniSharpBuild not working with Roslyn server #345

Closed
Stewmath opened this issue Mar 30, 2018 · 7 comments
Closed

:OmniSharpBuild not working with Roslyn server #345

Stewmath opened this issue Mar 30, 2018 · 7 comments

Comments

@Stewmath
Copy link

Currently trying to transition to Roslyn, which hasn't played nice with me in the past. Running Arch Linux.

When I run the command "OmniSharpBuild", vim errors out with this output:

Error detected while processing function OmniSharp#Build:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/matthew/linux-config/.vim/bundle/omnisharp-vim/python/OmniSharp.py", line 211, in build
    js = json.loads(getResponse('/build', {}, 60))
  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

The "FixIssue" command gives a similar error. However, autocompletion and warnings are working properly.

I installed the roslyn server "omnisharp.http-linux-x64.tar.gz v1.29.1". I wasn't sure whether to use this or the "mono" variant, but they both seem to give the same problem.

Vim version information:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 26 2018 23:00:19)
Included patches: 1-1542
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    +tcl/dyn
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl/dyn          +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           +python/dyn        +vreplace
+conceal           +linebreak         +python3/dyn       +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua/dyn           +ruby/dyn          +X11
+dialog_con_gui    +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             +xim
+digraphs          +modify_fname      +smartindent       -xpm
+dnd               +mouse             +startuptime       +xsmp_interact
-ebcdic            +mouseshape        +statusline        +xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.26/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm
@nickspoons
Copy link
Member

Yes, there are some features that have never been set up properly with the roslyn server unfortunately - either because roslyn doesn't support them, or roslyn just has different request/response structure and needs tweaking on the OmniSharp-vim side.

So I think some of the documented commands and functionality really need to be removed from the documentation - hopefully temporarily, and then we can add them back in again once someone gets them working.

@nickspoons
Copy link
Member

In the meantime, you can build using vim and msbuild by setting your makeprg and errorformat like this:

set errorformat=\ %#%f(%l\\\,%c):\ %m
set makeprg=msbuild\ /nologo\ /v:q\ /property:GenerateFullPaths=true\ /clp:ErrorsOnly\ .

I have done this before on arch but I can't exactly remember what was required. I think there's a mono-based msbuild in the aur?

@nickspoons
Copy link
Member

I haven't used FixIssue before and I'm not exactly sure what it does. It doesn't appear to exist in roslyn (https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Abstractions/OmniSharpEndpoints.cs). But if you have fzf, ctrlp or unite installed, then GetCodeActions works, and there's an open PR #342 right now to upgrade this to use the newer roslyn "v2" of this endpoint which has more code actions - I've been using the v2 version myself and it works very well.

@Stewmath
Copy link
Author

Thanks for the vim magic. Though I had to hardcode my sln file's location, and for some reason the quickfix filename gets messed up when I build asynchronously. It's working well enough now though.

@nickspoons
Copy link
Member

If the quickfix filenames are bad it's probably the errorformat - I use that in Windows, it may be wrong for Linux.

@Stewmath
Copy link
Author

It's correct when I use make, but not Make (vim-dispatch).

�[?1h�=�[6n/home/matthew/programs/.../File.cs|29 col 17| error CS1001: Identifier expected [/home/matthew/programs/.../Project.csproj]

I thought it might be related to color, but I passed "/consoleloggerparameters:DisableConsoleColor" to msbuild and that didn't fix it, so I'm not sure.

@nickspoons
Copy link
Member

Closing this in favour of #386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants