ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Omni​Sharp

by OmniSharp ST3

C# IDE Plugin for Sublime Text 3

Details

Installs

  • Total 26K
  • Win 14K
  • OS X 9K
  • Linux 2K
Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11
Windows 0 12 12 16 17 12 19 20 11 14 5 23 18 20 19 19 19 20 19 19 22 17 27 12 11 14 22 22 20 23 9 12 15 17 20 13 19 11 7 25 24 19 20 30 14 13
OS X 1 4 3 4 6 8 5 10 14 14 2 10 10 14 7 8 7 2 12 6 11 5 5 4 2 3 5 2 3 10 7 5 4 8 2 7 1 4 7 6 8 11 6 13 7 6
Linux 0 4 3 6 2 2 3 4 0 1 0 0 2 3 5 4 2 0 2 2 1 4 2 4 2 4 2 2 0 2 2 0 3 3 2 3 2 4 2 1 3 4 2 1 3 0

Readme

Source
raw.​githubusercontent.​com

Help Required

****Looking for a maintainer. If you'd like to help manage this plugin please file and issue****

Linux & OSX Windows
Build Status Build status

OmniSharpSublime for ST3

OmnisharpSublime is a plugin for ST3 to provide a C# development environment. It communicates with OmniSharpServer by nosami for IDE functions.

It works on: 1. Mac OSX 2. Linux 3. Windows

Features

  1. Auto OmniSharpServer running
  2. Asynchronous communication with OmniSharpServer (Never freeze!)
  3. Auto Completion
  4. Goto definition
  5. Rename
  6. Goto implementation
  7. Syntax/Semantic error highlighting
  8. Displays possible override methods
  9. Find Usages
  10. Format Document
  11. Displays code issues such as assigment is redundant
  12. Fix code issues - put cursor on highlighted issue and select Fix Code Issue
  13. Remove Unused, Add Missing and Sort Using Statements
  14. Code Actions eg. Convert LINQ query to Fluent Syntax
  15. Add File To Project
  16. Remove File from Project (via sidebar and context menu)
  17. Add New C# Class & Interface (via sidebar and context menu) via File Templates which also adds to csproj
  18. Type Lookup with Documentation
  19. Hide/Show Info Panel
  20. Run Unit Tests
  21. Build/ReBuild/Clean Solution
  22. Reload Solution

Requirements

Installation

Building From Source

  1. Move to ST3 plugin directory in console.

    cd {path to ST3 plugin directory}/Packages
    
  2. Clone repository.

    git clone https://github.com/OmniSharp/omnisharp-sublime.git OmniSharp
    
  3. Move to plugin directory, update submodule and build.

    #Windows
    cd OmniSharp
    git submodule update --init --recursive
    build.cmd
    
    #Linux Or Mac OSX
    cd OmniSharp
    git submodule update --init --recursive
    ./build.sh or ./build.cmd
    

Selecting OmniSharp Version

Currently both omnisharp-server and omnisharp-roslyn are both supported. To swap between the different version open up the sublime command window ctrl-shift-p, type Select Server Version and press enter. Prebuilt-Roslyn and Prebuilt-Legacy are the only two working servers that work unless you have built the plugin from source.

Project Setting

The server will automatically find the the solution file from the folder you have opened in Sublime. If you have multiple solutions you have to specify the solution file you wish to use in a sublime-project.

  1. Go to File -> Open and select the folder with your solution in it.

  2. Go to Project -> Save Project As and save a YOURPROJECTNAME.sublime-project in the same location as your *.sln

  3. Open your YOURPROJECTNAME.sublime-project file that should now appear in the sidebar on the left

  4. Enter the location to the *.sln file like below

Example of a sublime-project

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ],
    "solution_file": "./testconsoleprj.sln"
}

Once the YOURPROJECT.sublime-project is set up and saved, follow the below:

  1. Close Sublime (YMMV but this seems to be the best way to open the YOURPROJECTNAME.sublime-project)
  2. Open Sublime
  3. Click Project -> Open Project, and select your YOURPROJECT.sublime-project file

NOTE : For ASP.Net vNext applications please use the Roslyn branch of this repository.

C# language-specific settings

Create C# settings file as shown in this picture

Imgur

Paste the below in. This will launch intellisense on . and < symbols

{
    "auto_complete": true,
    "auto_complete_selector": "source - comment",
    "auto_complete_triggers": [ {"selector": "source.cs", "characters": ".<"} ],
 }

OmniSharpServer Settings

The Sublime plugin communicates to OmniSharp Server which has various available settings stored in a config.json file. By default the location of this file is in a folder under the Sublime OmniSharp packages folder called PrebuiltOmniSharpServer and there is also a user specific plugin setting that specifies the location of this config.json file. To prevent your settings being overridden on new releases of the Sublime package, we recommend you store your config.json file somewhere other than the default location. Once you have taken a copy of config.json and put it somewhere safe you will need to update the Sublime plugin's user setting called "omnisharp_server_config_location".

Format Document Settings

When you press Ctrl + K + D to format the document you may see CR markers.

CR Markers

This is to do with the settings for OmniSharpServer.

  1. Click Preferences - Browse Packages
  2. Go to OmniSharp/PrebuiltOmniSharpServer/ sub directory
  3. Open config.json and modify the eolMarker setting to \n like below

OR

Open your safely tucked away config.json file and modify the eolMarker setting to \n like below

"TextEditorOptions": {
    "tabsToSpaces": true,
    "tabSize": 4,
    "indentSize": 4,
    "continuationIndent": 4,
    "labelIndent": 0,
    "eolMarker": "\n",
    "indentBlankLines": false,
    "wrapLineLength": 80
  },

Unit Tests

For the plugin to be able to run unit tests you need to configure the test runner. This is done in the server config file.

  1. Click Preferences - Browse Packages
  2. Go to OmniSharp/PrebuiltOmniSharpServer/ sub directory
  3. Open config.json and modify the TestCommands like below

OR

Open your safely tucked away config.json file and modify the TestCommands like below

"TestCommands": {
    "All": "nunit-console.exe -nologo {{AssemblyPath}}",
    "Fixture": "nunit-console.exe -nologo {{AssemblyPath}} -run={{TypeName}}",
    "Single": "nunit-console.exe -nologo {{AssemblyPath}} -run={{TypeName}}.{{MethodName}}"
   },