Skip to content

Commit

Permalink
Merge pull request #601 from DustinCampbell/merge-master-into-release
Browse files Browse the repository at this point in the history
Merge master into release
  • Loading branch information
DustinCampbell committed Jul 21, 2016
2 parents 05c876c + 8a33c49 commit a2e2142
Show file tree
Hide file tree
Showing 38 changed files with 1,018 additions and 698 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,40 @@ Welcome to the C# extension for Visual Studio Code! This preview provides the fo
* Lightweight development tools for [.NET Core](https://dotnet.github.io).
* Great C# editing support, including Syntax Highlighting, IntelliSense, Go to Definition, Find All References, etc.
* Debugging support for .NET Core (CoreCLR). NOTE: Mono and Desktop CLR debugging is not supported.
* Support for project.json projects on Windows, OS X and Linux, and csproj projects on Windows.
* Support for project.json projects on Windows, macOS and Linux, and csproj projects on Windows.

The C# extension is powered by [OmniSharp](https://github.com/OmniSharp/omnisharp-roslyn).

### **Important!** Breaking Changes as of 1.2

* The C# extension now only supports .NET Core 1.0. Please upgrade any RC1 or RC2 projects to the 1.0.0 release build.
* **Support for .csproj projects is partially functional on OS X and Linux.** This will impact anyone doing .csproj development on OS X or Linux (e.g. Unity, Xamarin, etc.). We are working to address this in the near future. However, for now, you can use the [Legacy C# Support extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.omnisharp).
### What's New in 1.3

* Support for Unity and Mono development on macOS and Linux has been restored! This release brings back support for the Mono version of OmniSharp, which is used to provide *much* better support for .csproj/.sln projects. Please note that Mono version 4.0.1 or newer is required.
* Generation of tasks.json and launch.json files can now properly handle nested projects. [#170](https://github.com/OmniSharp/omnisharp-vscode/issues/170)
* New UI that makes it easy to select a process ID when attaching the debugger to another process. Note: If you have an existing launch.json file, you can re-generate it by deleting the file, closing your workspace in Visual Studio Code and opening it again. Or, you can open the launch.json file and change the `processId` value to `"${command.pickProcess}"`.
* Support for debugging in .cshtml files. To enable this, add a `sourceFileMap` entry to your launch.json with the following content: `"sourceFileMap": { "/Views": "${workspaceRoot}/Views" }`
* Support for conditional breakpoints
* New support for changing variable values in the debugger! To try this, just right-click on the variable name and select 'Set Value'. Note: To properly support this feature, we've changed the display of variable type names in the debugger to a shortened form. The full type name can be viewed by hovering over the name with the mouse.
* New configuration option to enable [stepping into properties and operators](https://github.com/OmniSharp/omnisharp-vscode/blob/release/debugger.md#stepping-into-properties-and-operators).
* Duplicate warnings and errors should no longer accumulate in Unity projects [#447](https://github.com/OmniSharp/omnisharp-vscode/issues/447)

### Supported Operating Systems

* Currently, the C# extension supports the following operatings systems:
* Windows (64-bit only)
* macOS
* Ubuntu 14.04 / Linux Mint 17
* Ubuntu 16.04
* Debian 8.2
* CentOS 7.1 / Oracle Linux 7
* Red Hat Enterprise Linux (RHEL)
* Fedora 23
* OpenSUSE 13.2

### Found a Bug?
Please file any issues at https://github.com/OmniSharp/omnisharp-vscode/issues.

### Debugging
The C# extension now supports basic debugging capabilities! See http://aka.ms/vscclrdebugger for details.

### What's new in C# extension version 1.2

* Adds debugger support for new Linux versions: Ubuntu 16.04, Fedora 23, openSUSE 13.2, and Oracle Linux 7.1
* Enhanced debug console output: module loads are now output, and there are launch.json options for controlling what is output
* Source file checksum support for breakpoints. This ensures that the debugger only sets breakpoints in code that exactly matches the open document.
* Support for editing the value of variables in the watch and locals window (requires VS Code 1.3)

### Development

First install:
Expand Down
27 changes: 21 additions & 6 deletions debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ This page gives you detailed instructions on how to debug code running under .NE
File bugs and feature requests [here](https://github.com/OmniSharp/omnisharp-vscode/issues) and [join our insiders group](http://landinghub.visualstudio.com/dotnetcoreinsiders) to help us build great tooling for .NET Core.

####Requirements
* Requires .NET Core 1.0 RC2 or newer (will not work with earlier versions)
* Requires .NET Core 1.0 (rc2 are earlier releases are not supported)
* X64 only
* Supports OSX, Ubuntu 14.04, Red Hat Enterprise Linux 7.2, Debian 8.2, Centos 7.1, and Windows 7+
* Supported operating systems:
* macOS: 10.11+ (El Capitan+)
* Linux: Red Hat Enterprise Linux 7.2+, Ubuntu 14.04 LTS, Ubuntu 16.04 LTS, Debian 8.2+, Linux Mint 17+, CentOS 7.1+, Oracle Linux 7.1+, Fedora 23, openSUSE 13.2
* Windows: 7+

###First Time setup
##### 1: Get Visual Studio Code
Expand All @@ -26,7 +29,7 @@ Install the .NET Core command line tools (CLI) by following the installation par
##### 3: Install C# Extension for VS Code
Open the command palette in VS Code (F1) and type "ext install C#" to trigger the installation of the extension. VS Code will show a message that the extension has been installed and it will restart.

If you have previously installed the C# extension, make sure that you have version 1.1.6 or newer. You can check this by opening the command palette (F1) and running 'Extensions: Show Installed Extensions'.
If you have previously installed the C# extension, make sure that you have version 1.2 or newer. You can check this by opening the command palette (F1) and running 'Extensions: Show Installed Extensions'.

##### 4: Wait for download of platform-specific files
The first time that C# code is opened in VS Code, the extension will download the platform-specific files needed for debugging and editing. Debugging and editor features will not work until these steps finish.
Expand All @@ -49,7 +52,7 @@ You can also find some example projects on https://github.com/aspnet/cli-samples
##### 2: Open the directory in VS Code
Go to File->Open and open the directory in Visual Studio Code. If this is the first time that the C# extension has been activated, it will now download additional platform-specific dependencies.

**Troubleshooting 'Error while installing .NET Core Debugger':** If the debugger is failing to download its platform-specific dependencies, first verify that you have the 1.0.0-preview1-002702 or newer build of the .NET CLI installed, and it is functioning. You can check this by starting a bash/command prompt and running 'dotnet --info'.
**Troubleshooting 'Error while installing .NET Core Debugger':** If the debugger is failing to download its platform-specific dependencies, first verify that you have the 1.0.0-preview2-003121 or newer build of the .NET CLI installed, and it is functioning. You can check this by starting a bash/command prompt and running 'dotnet --info'.

If the CLI is installed, here are a few additional suggestions:

Expand Down Expand Up @@ -111,7 +114,7 @@ You can optionally disable justMyCode by setting it to "false". You should disab
Just My Code is a set of features that makes it easier to focus on debugging your code by hiding some of the details of optimized libraries that you might be using, like the .NET Framework itself. The most important sub parts of this feature are --

* User-unhandled exceptions: automatically stop the debugger just before exceptions are about to be caught by the framework
* Just My Code stepping: when stepping, if framework code calls back to user code, automaticially stop.
* Just My Code stepping: when stepping, if framework code calls back to user code, automatically stop.

#####Source File Map
You can optionally configure a file by file mapping by providing map following this schema:
Expand All @@ -133,10 +136,22 @@ Environment variables may be passed to your program using this schema:
}

#####External console (terminal) window
The target process can optionally launch into a seperate console window. You will want this if your console app takes console input (ex: Console.ReadLine). This can be enabled with:
The target process can optionally launch into a separate console window. You will want this if your console app takes console input (ex: Console.ReadLine). This can be enabled with:

"externalConsole": true

##### Stepping into properties and operators
The debugger steps over properties and operators in managed code by default. In most cases, this provides a better debugging experience. To change this and enable stepping into properties or operators add:

"enableStepFiltering": false

#### Attach Support
The C# debugger supports attaching to processes. To do this, switch to the Debug tab, and open the configuration drop down.

![Debug launch configuration drop down](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/debug-launch-configurations.png)

Select the '.NET Core Attach' configuration. Clicking the play button (or pressing F5) will then try to attach. In launch.json, if `processId` is set to `"${command.pickProcess}"` this will provide UI to select which process to attach to.

#### Docker Support

Using Visual Studio Code and the C# extension it is also possible to debug your code running in a [Docker container](https://en.wikipedia.org/wiki/Docker_(software)). To do so, follow instructions to install and run [yo docker](https://github.com/Microsoft/generator-docker#generator-docker). This will add files to your project to build a container, and it will add a new debug launch configuration which will invoke a container build, and then debug your app in the container.
47 changes: 27 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ const vsce = require('vsce');
const debugUtil = require('./out/coreclr-debug/util.js');
const debugInstall = require('./out/coreclr-debug/install.js');
const fs_extra = require('fs-extra-promise');
const omnisharpDownload = require('./out/omnisharpDownload');
const omnisharp = require('./out/omnisharp/omnisharp');
const download = require('./out/omnisharp/download');
const platform = require('./out/platform');
const child_process = require('child_process');

const OmniSharpVersion = omnisharpDownload.OmniSharpVersion;
const Flavor = omnisharp.Flavor;
const Platform = platform.Platform;

/// used in offline packaging run so does not clean .vsix
function clean() {
Expand All @@ -31,9 +34,11 @@ gulp.task('clean', ['omnisharp:clean', 'debugger:clean', 'package:clean'], () =
});

/// Omnisharp Tasks
function installOmnisharp(omnisharpAssetName) {
const logFunction = (message) => { console.log(message); };
return omnisharpDownload.downloadOmnisharp(logFunction, omnisharpAssetName);
function installOmnisharp(omnisharps) {
const logger = (message) => { console.log(message); };
const promises = omnisharps.map((omni) => download.go(omni.flavor, omni.platform, logger));

return Promise.all(promises);
}

function cleanOmnisharp() {
Expand All @@ -45,8 +50,10 @@ gulp.task('omnisharp:clean', () => {
});

gulp.task('omnisharp:install', ['omnisharp:clean'], () => {
var asset = gulpUtil.env.asset || omnisharpDownload.getOmnisharpAssetName();
return installOmnisharp(asset);
const flavor = gulpUtil.env.flavor || Flavor.CoreCLR;
const platform = gulpUtil.env.platform || platform.getCurrentPlatform();

return installOmnisharp([{flavor, platform}]);
});

/// Debugger Tasks
Expand Down Expand Up @@ -97,11 +104,11 @@ function doPackageSync(packageName) {
}
}

function doOfflinePackage(runtimeId, omnisharpAsset, packageName) {
function doOfflinePackage(runtimeId, omnisharps, packageName) {
return clean().then(() => {
return installDebugger(runtimeId);
}).then(() => {
return installOmnisharp(omnisharpAsset);
return installOmnisharp(omnisharps);
}).then(() => {
doPackageSync(packageName + '-' + runtimeId + '.vsix');
});
Expand All @@ -122,21 +129,21 @@ gulp.task('package:offline', ['clean'], () => {
var packageName = name + '.' + version;

var packages = [];
packages.push({rid: 'win7-x64', omni: `omnisharp-${OmniSharpVersion}-win-x64-net451.zip`});
packages.push({rid: 'osx.10.11-x64', omni: `omnisharp-${OmniSharpVersion}-osx-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'centos.7-x64', omni: `omnisharp-${OmniSharpVersion}-centos-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'debian.8-x64', omni: `omnisharp-${OmniSharpVersion}-debian-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'fedora.23-x64', omni: `omnisharp-${OmniSharpVersion}-fedora-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'opensuse.13.2-x64', omni: `omnisharp-${OmniSharpVersion}-opensuse-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'rhel.7.2-x64', omni: `omnisharp-${OmniSharpVersion}-rhel-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'ubuntu.14.04-x64', omni: `omnisharp-${OmniSharpVersion}-ubuntu14-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'ubuntu.16.04-x64', omni: `omnisharp-${OmniSharpVersion}-ubuntu16-x64-netcoreapp1.0.tar.gz`});
packages.push({rid: 'win7-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.Windows}, {flavor: Flavor.Desktop, platform: Platform.Windows}]});
packages.push({rid: 'osx.10.11-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.OSX}]});
packages.push({rid: 'centos.7-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.CentOS}]});
packages.push({rid: 'debian.8-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.Debian}]});
packages.push({rid: 'fedora.23-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.Fedora}]});
packages.push({rid: 'opensuse.13.2-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.OpenSUSE}]});
packages.push({rid: 'rhel.7.2-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.RHEL}]});
packages.push({rid: 'ubuntu.14.04-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.Ubuntu14}]});
packages.push({rid: 'ubuntu.16.04-x64', omnisharps: [{flavor: Flavor.CoreCLR, platform: Platform.Ubuntu16}]});

var promise = Promise.resolve();

packages.forEach(pair => {
packages.forEach(data => {
promise = promise.then(() => {
return doOfflinePackage(pair.rid, pair.omni, packageName);
return doOfflinePackage(data.rid, data.omnisharps, packageName);
})
});

Expand Down
43 changes: 33 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "csharp",
"publisher": "ms-vscode",
"version": "1.2.2",
"version": "1.3.0",
"description": "C# for Visual Studio Code (powered by OmniSharp).",
"displayName": "C#",
"author": "Microsoft Corporation",
Expand All @@ -17,7 +17,7 @@
"Linters",
"Snippets"
],
"main": "./out/omnisharpMain",
"main": "./out/main",
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install && tsc"
},
Expand All @@ -39,11 +39,11 @@
"tslint": "^3.3.0",
"tslint-microsoft-contrib": "^2.0.0",
"typescript": "^1.7.3",
"vscode": "^0.11.3",
"vsce": "^1.3.0"
"vscode": "^0.11.13",
"vsce": "^1.7.0"
},
"engines": {
"vscode": "^0.10.10"
"vscode": "^1.3.0"
},
"activationEvents": [
"onLanguage:csharp",
Expand Down Expand Up @@ -144,7 +144,8 @@
"label": ".NET Core",
"enableBreakpointsFor": {
"languageIds": [
"csharp"
"csharp",
"razor"
]
},
"runtime": "node",
Expand Down Expand Up @@ -308,6 +309,11 @@
"description": "Optional flag to require current source code to match the pdb.",
"default": true
},
"enableStepFiltering": {
"type": "boolean",
"description": "Optional flag to enable stepping over Properties and Operators.",
"default": true
},
"logging": {
"type": "object",
"required": [],
Expand Down Expand Up @@ -497,9 +503,18 @@
"default": "The process name to attach to. If this is used, 'processId' should not be used."
},
"processId": {
"type": "integer",
"description": "The process id to attach to. If this is used, 'processName' should not be used.",
"default": 0
"anyOf": [
{
"type": "string",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": "${command.pickProcess}"
},
{
"type": "integer",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": 0
}
]
},
"sourceFileMap": {
"type": "object",
Expand All @@ -526,6 +541,11 @@
"description": "Optional flag to require current source code to match the pdb.",
"default": true
},
"enableStepFiltering": {
"type": "boolean",
"description": "Optional flag to enable stepping over Properties and Operators.",
"default": true
},
"logging": {
"type": "object",
"required": [],
Expand Down Expand Up @@ -604,13 +624,16 @@
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": 0
"processId": "${command.pickProcess}"
}
]
}
Expand Down
31 changes: 30 additions & 1 deletion snippets/csharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,5 +520,34 @@
"}"
],
"description": "While loop"
},

"constructor": {

"prefix": "ctor",
"body": [
"${1:public} ${2:ClassName} (${3:Parameters})",
"{",
" ${0}",
"}"
],
"description": "constructor"
},

"xUnit Test": {

"prefix": "fact",
"body": [
"[Fact]",
"public void ${1:TestName}()",
"{",
"//Given",
"",
"//When",
"",
"//Then",
"}${0}"
],
"description": "create xunit test method"
}
}
}
Loading

0 comments on commit a2e2142

Please sign in to comment.