Skip to content

Commit

Permalink
Merge pull request #1058 from DustinCampbell/upgrade-extension
Browse files Browse the repository at this point in the history
Migrates the extension to latest VS Code and TypeScript
  • Loading branch information
DustinCampbell authored Dec 20, 2016
2 parents efef734 + b9026a6 commit 9515f40
Show file tree
Hide file tree
Showing 24 changed files with 743 additions and 2,483 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
out
.omnisharp-*/
.debugger
.vscode-test

install.*

Expand Down
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
language: node_js

node_js:
- "5.1"
- "6"

env:
- CXX=g++-4.8
before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.9

install:
- npm install
- npm run compile
- npm install -g vsce
- vsce package

script:
- npm test --silent
- npm run test-syntax

deploy:
provider: releases
api_key:
Expand Down
25 changes: 17 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
],
"main": "./out/src/main",
"scripts": {
"compile": "node ./node_modules/vscode/bin/compile -p ./ && gulp tslint",
"watch": "node ./node_modules/vscode/bin/compile -watch -p ./",
"test": "mocha --timeout 15000 -u tdd ./out/test/*.tests.js ./out/test/**/*.tests.js",
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -p ./ && gulp tslint",
"watch": "tsc -watch -p ./",
"test": "node ./node_modules/vscode/bin/test",
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"dependencies": {
Expand All @@ -38,17 +40,24 @@
"yauzl": "^2.5.0"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/fs-extra-promise": "0.0.30",
"@types/mkdirp": "^0.3.29",
"@types/mocha": "^2.2.32",
"@types/node": "^6.0.40",
"@types/semver": "^5.3.30",
"@types/tmp": "0.0.32",
"chai": "^3.5.0",
"del": "^2.0.2",
"gulp": "^3.9.1",
"gulp-mocha": "^2.1.3",
"gulp-tslint": "^4.3.0",
"mocha": "^2.2.5",
"mocha": "^2.3.3",
"tslint": "^3.15.1",
"tslint-microsoft-contrib": "^2.0.12",
"typescript": "^2.0.3",
"vscode": "^0.11.13",
"vsce": "^1.7.0",
"chai": "^3.5.0",
"vscode": "^1.0.0",
"vscode-textmate": "^2.1.1"
},
"runtimeDependencies": [
Expand Down Expand Up @@ -288,7 +297,7 @@
}
],
"engines": {
"vscode": "^1.3.0"
"vscode": "^1.5.0"
},
"activationEvents": [
"onLanguage:csharp",
Expand Down Expand Up @@ -1131,4 +1140,4 @@
}
]
}
}
}
2 changes: 1 addition & 1 deletion src/coreclr-debug/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class CoreClrDebugUtil

public static existsSync(path: string) : boolean {
try {
fs.accessSync(path, fs.F_OK);
fs.accessSync(path, fs.constants.F_OK);
return true;
} catch (err) {
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {
Expand Down
28 changes: 17 additions & 11 deletions src/features/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {OmniSharpServer} from '../omnisharp/server';
import * as serverUtils from '../omnisharp/utils';
import {findLaunchTargets} from '../omnisharp/launcher';
import * as cp from 'child_process';
import * as fs from 'fs-extra-promise';
import * as fs from 'fs';
import * as path from 'path';
import * as protocol from '../omnisharp/protocol';
import * as vscode from 'vscode';
Expand Down Expand Up @@ -87,18 +87,24 @@ function projectsToCommands(projects: protocol.DotNetProject[]): Promise<Command
return projects.map(project => {
let projectDirectory = project.Path;

return fs.lstatAsync(projectDirectory).then(stats => {
if (stats.isFile()) {
projectDirectory = path.dirname(projectDirectory);
}
return new Promise<Command>((resolve, reject) => {
fs.lstat(projectDirectory, (err, stats) => {
if (err) {
return reject(err);
}

return {
label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
description: projectDirectory,
execute() {
return dotnetRestore(projectDirectory);
if (stats.isFile()) {
projectDirectory = path.dirname(projectDirectory);
}
};

resolve({
label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
description: projectDirectory,
execute() {
return dotnetRestore(projectDirectory);
}
});
});
});
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as fs from 'fs';
import * as https from 'https';
import { mkdirp } from 'mkdirp';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import * as tmp from 'tmp';
import { parse as parseUrl } from 'url';
Expand Down Expand Up @@ -226,15 +226,15 @@ function downloadFile(urlString: string, pkg: Package, logger: Logger, status: S
});

response.on('error', err => {
reject(new PackageError(`Reponse error: ${err.code || 'NONE'}`, pkg, err));
reject(new PackageError(`Reponse error: ${err.message || 'NONE'}`, pkg, err));
});

// Begin piping data from the response to the package file
response.pipe(tmpFile, { end: false });
});

request.on('error', error => {
reject(new PackageError(`Request error: ${error.code || 'NONE'}`, pkg, error));
request.on('error', err => {
reject(new PackageError(`Request error: ${err.message || 'NONE'}`, pkg, err));
});

// Execute the request
Expand Down
2 changes: 1 addition & 1 deletion src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class PlatformInformation {
throw new Error(`Unsupported platform: ${platform}`);
}

return Promise.all([architecturePromise, distributionPromise])
return Promise.all<any>([architecturePromise, distributionPromise])
.then(([arch, distro]) => {
return new PlatformInformation(platform, arch, distro);
});
Expand Down
2 changes: 1 addition & 1 deletion test/common.tests.ts → test/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { should } from 'chai';
import { buildPromiseChain } from '../src/common';

suite("Common", () => {
before(() => should);
suiteSetup(() => should());

test("buildPromiseChain produces a sequence of promises", () => {
let array: number[] = [];
Expand Down
2 changes: 1 addition & 1 deletion test/platform.tests.ts → test/platform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { should } from 'chai';
import { LinuxDistribution, PlatformInformation } from '../src/platform';

suite("Platform", () => {
before(() => should());
suiteSetup(() => should());

test("Retrieve correct information for Ubuntu 14.04", () => {
const dist = distro_ubuntu_14_04();
Expand Down
File renamed without changes.
Loading

0 comments on commit 9515f40

Please sign in to comment.