Skip to content

Commit db8b0af

Browse files
Migrates the extension to latest VS Code and TypeScript
This change updates the extension and several dependencies to the latest VS Code and TypeScript per the instructions at https://code.visualstudio.com/upgrades/v1_6#_extension-authoring.
1 parent fe153eb commit db8b0af

File tree

15 files changed

+46
-1795
lines changed

15 files changed

+46
-1795
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22

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

66
env:
77
- CXX=g++-4.8

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
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 ./",
22+
"vscode:prepublish": "tsc -p ./",
23+
"compile": "tsc -p ./ && gulp tslint",
24+
"watch": "tsc -watch -p ./",
2425
"test": "mocha --timeout 15000 -u tdd ./out/test/*.tests.js ./out/test/**/*.tests.js",
2526
"postinstall": "node ./node_modules/vscode/bin/install"
2627
},
@@ -38,17 +39,24 @@
3839
"yauzl": "^2.5.0"
3940
},
4041
"devDependencies": {
42+
"@types/chai": "^3.4.34",
43+
"@types/fs-extra-promise": "0.0.30",
44+
"@types/mkdirp": "^0.3.29",
45+
"@types/mocha": "^2.2.32",
46+
"@types/node": "^6.0.40",
47+
"@types/semver": "^5.3.30",
48+
"@types/tmp": "0.0.32",
49+
"chai": "^3.5.0",
4150
"del": "^2.0.2",
4251
"gulp": "^3.9.1",
4352
"gulp-mocha": "^2.1.3",
4453
"gulp-tslint": "^4.3.0",
45-
"mocha": "^2.2.5",
54+
"mocha": "^2.3.3",
4655
"tslint": "^3.15.1",
4756
"tslint-microsoft-contrib": "^2.0.12",
4857
"typescript": "^2.0.3",
49-
"vscode": "^0.11.13",
5058
"vsce": "^1.7.0",
51-
"chai": "^3.5.0",
59+
"vscode": "^1.0.0",
5260
"vscode-textmate": "^2.1.1"
5361
},
5462
"runtimeDependencies": [
@@ -288,7 +296,7 @@
288296
}
289297
],
290298
"engines": {
291-
"vscode": "^1.3.0"
299+
"vscode": "^1.5.0"
292300
},
293301
"activationEvents": [
294302
"onLanguage:csharp",
@@ -1126,4 +1134,4 @@
11261134
}
11271135
]
11281136
}
1129-
}
1137+
}

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
});

tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "es6",
44
"module": "commonjs",
55
"outDir": "out",
6-
"noLib": true,
6+
"lib": [
7+
"es6"
8+
],
79
"sourceMap": true,
810
"rootDir": "."
911
},
1012
"exclude": [
11-
"node_modules"
13+
"node_modules",
14+
".vscode-test"
1215
]
1316
}

0 commit comments

Comments
 (0)