Code Monkey home page Code Monkey logo

omnisharp's Introduction

#OmniSharp

OmniSharp is a plugin for Vim to provide IDE like abilities for C#. A list of currently implemented features is provied below.

OmniSharp works both on Windows and on Linux and OS X with Mono.

OmniSharp is just a thin wrapper around the awesome [NRefactory] (https://github.com/icsharpcode/NRefactory) library, so it provides the same completions as MonoDevelop/SharpDevelop. The server knows nothing about Vim, so could be plugged into most editors fairly easily.

##Features

  • Contextual code completion
    • Code documentation is displayed in the preview window when available
    • CamelCase completions are supported, e.g Console.WL(TAB) will complete to Console.WriteLine
  • Jump to the definition of an type/variable/method
  • Find implementations/derived types
  • Find usages
  • Contextual code actions
  • Lookup type information of an type/variable/method
    • Can be printed to the status line or in the preview window
  • Simple syntax error highlighting

##Screenshots ####Auto Complete Omnisharp screenshot

####Find Usages Find Usages screenshot

####Code Actions Code Actions screenshot

##Installation

Install [Python 2.7.3] (http://www.python.org/download/releases/2.7.3/). If you installed Vim using the windows installer, you will need to install the x86 (32 bit!) version of Python.

Verify that Python is working inside Vim with

:python print "hi"

Copy the contents of vimfiles into your $VIM\vimfiles directory.

(Optional but highly recommended) Install [SuperTab] (https://github.com/ervandew/supertab) Vim plugin.

Run the server

OmniSharp.exe -s (path\to\sln)

OmniSharp listens to requests from Vim on port 2000 by default, so make sure that your firewall is configured to accept requests from localhost on this port.

To get completions, open one of the C# files from the solution within Vim and press Ctrl-X Ctrl-O in Insert mode (or just TAB if you have SuperTab installed). Repeat to cycle through completions, or use the cursor keys (eugh!)

Simple syntax error highlighting is automatically performed when saving the current buffer.

To use the other features, you'll want to create key bindings for them. See the example vimrc for more info.

Example vimrc

"This is the default value, setting it isn't actually necessary
let g:OmniSharp_host = "http://localhost:2000"

"Set the type lookup function to use the preview window instead of the status line
let g:OmniSharp_typeLookupInPreview = 1

map <F12> :call OmniSharp#GotoDefinition()<cr>
nmap fi :call OmniSharp#FindImplementations()<cr>
nmap fu :call OmniSharp#FindUsages()<cr>
nmap <leader>tt :call OmniSharp#TypeLookup()<cr>
"I find contextual code actions so useful that I have it mapped to the spacebar
nmap <space> :call OmniSharp#GetCodeActions()<cr>

"Don't ask to save when changing buffers (ie when jumping to a type definition)
set hidden

###Disclaimer

This project is very much incomplete/buggy.

It may eat your code.

#####TODO

  • Refactorings
  • Add files to project
  • Highlight syntax errors as you type
  • Start the server from within Vim and auto discover the solution file where possible
  • Fix bugs

Pull requests welcome!

omnisharp's People

Contributors

aprilwade avatar nosami avatar zenakuten avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.