Skip to content

Commit 9515f40

Browse files
Merge pull request #1058 from DustinCampbell/upgrade-extension
Migrates the extension to latest VS Code and TypeScript
2 parents efef734 + b9026a6 commit 9515f40

24 files changed

+743
-2483
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules
33
out
44
.omnisharp-*/
55
.debugger
6+
.vscode-test
67

78
install.*
89

.travis.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
language: node_js
22

33
node_js:
4-
- "5.1"
4+
- "6"
55

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

913
addons:
1014
apt:
1115
sources:
1216
- ubuntu-toolchain-r-test
1317
packages:
14-
- g++-4.8
18+
- g++-4.9
1519

1620
install:
1721
- npm install
1822
- npm run compile
1923
- npm install -g vsce
2024
- vsce package
2125

26+
script:
27+
- npm test --silent
28+
- npm run test-syntax
29+
2230
deploy:
2331
provider: releases
2432
api_key:

package.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
],
2020
"main": "./out/src/main",
2121
"scripts": {
22-
"compile": "node ./node_modules/vscode/bin/compile -p ./ && gulp tslint",
23-
"watch": "node ./node_modules/vscode/bin/compile -watch -p ./",
24-
"test": "mocha --timeout 15000 -u tdd ./out/test/*.tests.js ./out/test/**/*.tests.js",
22+
"vscode:prepublish": "tsc -p ./",
23+
"compile": "tsc -p ./ && gulp tslint",
24+
"watch": "tsc -watch -p ./",
25+
"test": "node ./node_modules/vscode/bin/test",
26+
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
2527
"postinstall": "node ./node_modules/vscode/bin/install"
2628
},
2729
"dependencies": {
@@ -38,17 +40,24 @@
3840
"yauzl": "^2.5.0"
3941
},
4042
"devDependencies": {
43+
"@types/chai": "^3.4.34",
44+
"@types/fs-extra-promise": "0.0.30",
45+
"@types/mkdirp": "^0.3.29",
46+
"@types/mocha": "^2.2.32",
47+
"@types/node": "^6.0.40",
48+
"@types/semver": "^5.3.30",
49+
"@types/tmp": "0.0.32",
50+
"chai": "^3.5.0",
4151
"del": "^2.0.2",
4252
"gulp": "^3.9.1",
4353
"gulp-mocha": "^2.1.3",
4454
"gulp-tslint": "^4.3.0",
45-
"mocha": "^2.2.5",
55+
"mocha": "^2.3.3",
4656
"tslint": "^3.15.1",
4757
"tslint-microsoft-contrib": "^2.0.12",
4858
"typescript": "^2.0.3",
49-
"vscode": "^0.11.13",
5059
"vsce": "^1.7.0",
51-
"chai": "^3.5.0",
60+
"vscode": "^1.0.0",
5261
"vscode-textmate": "^2.1.1"
5362
},
5463
"runtimeDependencies": [
@@ -288,7 +297,7 @@
288297
}
289298
],
290299
"engines": {
291-
"vscode": "^1.3.0"
300+
"vscode": "^1.5.0"
292301
},
293302
"activationEvents": [
294303
"onLanguage:csharp",
@@ -1131,4 +1140,4 @@
11311140
}
11321141
]
11331142
}
1134-
}
1143+
}

src/coreclr-debug/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class CoreClrDebugUtil
138138

139139
public static existsSync(path: string) : boolean {
140140
try {
141-
fs.accessSync(path, fs.F_OK);
141+
fs.accessSync(path, fs.constants.F_OK);
142142
return true;
143143
} catch (err) {
144144
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {

src/features/commands.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {OmniSharpServer} from '../omnisharp/server';
99
import * as serverUtils from '../omnisharp/utils';
1010
import {findLaunchTargets} from '../omnisharp/launcher';
1111
import * as cp from 'child_process';
12-
import * as fs from 'fs-extra-promise';
12+
import * as fs from 'fs';
1313
import * as path from 'path';
1414
import * as protocol from '../omnisharp/protocol';
1515
import * as vscode from 'vscode';
@@ -87,18 +87,24 @@ function projectsToCommands(projects: protocol.DotNetProject[]): Promise<Command
8787
return projects.map(project => {
8888
let projectDirectory = project.Path;
8989

90-
return fs.lstatAsync(projectDirectory).then(stats => {
91-
if (stats.isFile()) {
92-
projectDirectory = path.dirname(projectDirectory);
93-
}
90+
return new Promise<Command>((resolve, reject) => {
91+
fs.lstat(projectDirectory, (err, stats) => {
92+
if (err) {
93+
return reject(err);
94+
}
9495

95-
return {
96-
label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
97-
description: projectDirectory,
98-
execute() {
99-
return dotnetRestore(projectDirectory);
96+
if (stats.isFile()) {
97+
projectDirectory = path.dirname(projectDirectory);
10098
}
101-
};
99+
100+
resolve({
101+
label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
102+
description: projectDirectory,
103+
execute() {
104+
return dotnetRestore(projectDirectory);
105+
}
106+
});
107+
});
102108
});
103109
});
104110
}

src/packages.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as fs from 'fs';
77
import * as https from 'https';
8-
import { mkdirp } from 'mkdirp';
8+
import * as mkdirp from 'mkdirp';
99
import * as path from 'path';
1010
import * as tmp from 'tmp';
1111
import { parse as parseUrl } from 'url';
@@ -226,15 +226,15 @@ function downloadFile(urlString: string, pkg: Package, logger: Logger, status: S
226226
});
227227

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

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

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

240240
// Execute the request

src/platform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class PlatformInformation {
160160
throw new Error(`Unsupported platform: ${platform}`);
161161
}
162162

163-
return Promise.all([architecturePromise, distributionPromise])
163+
return Promise.all<any>([architecturePromise, distributionPromise])
164164
.then(([arch, distro]) => {
165165
return new PlatformInformation(platform, arch, distro);
166166
});

test/common.tests.ts renamed to test/common.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { should } from 'chai';
77
import { buildPromiseChain } from '../src/common';
88

99
suite("Common", () => {
10-
before(() => should);
10+
suiteSetup(() => should());
1111

1212
test("buildPromiseChain produces a sequence of promises", () => {
1313
let array: number[] = [];

test/platform.tests.ts renamed to test/platform.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { should } from 'chai';
77
import { LinuxDistribution, PlatformInformation } from '../src/platform';
88

99
suite("Platform", () => {
10-
before(() => should());
10+
suiteSetup(() => should());
1111

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

0 commit comments

Comments
 (0)