Use @types/node in extensions (#19692)

Switches builtin extensions to use @types/node for node definitions. Fixes a few errors that show up as a result of updating to a more modern version of node.d.ts
This commit is contained in:
Matt Bierner 2017-02-01 15:20:17 -08:00 committed by GitHub
parent c4f02ee14a
commit cda3584a99
18 changed files with 95 additions and 2368 deletions

View file

@ -63,5 +63,8 @@
"url": "vscode://schemas/extensions"
}
]
},
"devDependencies": {
"@types/node": "^7.0.4"
}
}

View file

@ -4,4 +4,4 @@
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>

View file

@ -6,7 +6,8 @@
"vscode": "^1.4.0"
},
"categories": [
"Languages", "Other"
"Languages",
"Other"
],
"activationEvents": [
"onLanguage:typescript"
@ -31,5 +32,8 @@
"url": "vscode://schemas/icon-theme"
}
]
},
"devDependencies": {
"@types/node": "^7.0.4"
}
}

View file

@ -4,4 +4,4 @@
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>

View file

@ -423,5 +423,8 @@
},
"dependencies": {
"vscode-nls": "^2.0.1"
},
"devDependencies": {
"@types/node": "^7.0.4"
}
}
}

View file

@ -65,7 +65,7 @@ function findSpecificGit(path: string): Promise<IGit> {
return new Promise<IGit>((c, e) => {
const buffers: Buffer[] = [];
const child = cp.spawn(path, ['--version']);
child.stdout.on('data', b => buffers.push(b));
child.stdout.on('data', (b: Buffer) => buffers.push(b));
child.on('error', e);
child.on('exit', code => code ? e(new Error('Not found')) : c({ path, version: parseVersion(Buffer.concat(buffers).toString('utf8').trim()) }));
});
@ -82,7 +82,7 @@ function findGitDarwin(): Promise<IGit> {
function getVersion(path: string) {
// make sure git executes
cp.exec('git --version', (err, stdout) => {
cp.exec('git --version', (err, stdout: Buffer) => {
if (err) {
return e('git not found');
}

View file

@ -5,4 +5,4 @@
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/vs/vscode.proposed.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>

2313
extensions/node.d.ts vendored

File diff suppressed because it is too large Load diff

View file

@ -2,38 +2,59 @@
"name": "php",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "0.10.x" },
"activationEvents": ["onLanguage:php"],
"engines": {
"vscode": "0.10.x"
},
"activationEvents": [
"onLanguage:php"
],
"main": "./out/phpMain",
"dependencies": {
"vscode-nls": "^1.0.4"
},
"contributes": {
"languages": [{
"id": "php",
"extensions": [ ".php", ".php4", ".php5", ".phtml", ".ctp" ],
"aliases": [ "PHP", "php" ],
"mimetypes": ["application/x-php"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "php",
"scopeName": "text.html.php",
"path": "./syntaxes/php.tmLanguage.json",
"embeddedLanguages": {
"text.html": "html",
"source.php": "php",
"source.sql": "sql",
"text.xml": "xml",
"source.js": "javascript",
"source.json": "json",
"source.css": "css"
"languages": [
{
"id": "php",
"extensions": [
".php",
".php4",
".php5",
".phtml",
".ctp"
],
"aliases": [
"PHP",
"php"
],
"mimetypes": [
"application/x-php"
],
"configuration": "./language-configuration.json"
}
}],
"snippets": [{
"language": "php",
"path": "./snippets/php.json"
}],
],
"grammars": [
{
"language": "php",
"scopeName": "text.html.php",
"path": "./syntaxes/php.tmLanguage.json",
"embeddedLanguages": {
"text.html": "html",
"source.php": "php",
"source.sql": "sql",
"text.xml": "xml",
"source.js": "javascript",
"source.json": "json",
"source.css": "css"
}
}
],
"snippets": [
{
"language": "php",
"path": "./snippets/php.json"
}
],
"configuration": {
"title": "%configuration.title%",
"type": "object",
@ -50,13 +71,19 @@
"description": "%configuration.validate.enable%"
},
"php.validate.executablePath": {
"type": ["string", "null"],
"type": [
"string",
"null"
],
"default": null,
"description": "%configuration.validate.executablePath%"
},
"php.validate.run": {
"type": "string",
"enum": ["onSave", "onType"],
"enum": [
"onSave",
"onType"
],
"default": "onSave",
"description": "%configuration.validate.run%"
}
@ -73,5 +100,8 @@
"compile": "gulp compile-extension:php",
"watch": "gulp watch-extension:php",
"update-grammar": "node ../../build/npm/update-grammar.js atom/language-php grammars/php.cson ./syntaxes/php.tmLanguage.json"
},
"devDependencies": {
"@types/node": "^7.0.4"
}
}

View file

@ -4,4 +4,4 @@
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>

View file

@ -39,7 +39,8 @@
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-api-tests ./tsconfig.json"
},
"devDependencies": {
"@types/node": "^7.0.4",
"typescript": "^1.6.2",
"vscode": "1.0.1"
}
}
}

View file

@ -63,7 +63,7 @@ suite('commands namespace tests', () => {
args = arguments;
});
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
return window.showTextDocument(doc).then(editor => {
return commands.executeCommand('t1', 12345, commands);
}).then(() => {
@ -121,7 +121,7 @@ suite('commands namespace tests', () => {
});
test('api-command: vscode.open', function () {
let uri = Uri.file(join(workspace.rootPath, './image.png'));
let uri = Uri.file(join(workspace.rootPath || '', './image.png'));
let a = commands.executeCommand('vscode.open', uri).then(() => assert.ok(true), () => assert.ok(false));
let b = commands.executeCommand('vscode.open', uri, ViewColumn.Two).then(() => assert.ok(true), () => assert.ok(false));
let c = commands.executeCommand('vscode.open').then(() => assert.ok(false), () => assert.ok(true));

View file

@ -69,7 +69,7 @@ suite('languages namespace tests', () => {
test('completions with document filters', function (done) {
let ran = false;
let uri = Uri.file(join(workspace.rootPath, './bower.json'));
let uri = Uri.file(join(workspace.rootPath || '', './bower.json'));
let jsonDocumentFilter = [{ language: 'json', pattern: '**/package.json' }, { language: 'json', pattern: '**/bower.json' }, { language: 'json', pattern: '**/.bower.json' }];

View file

@ -5,5 +5,4 @@
/// <reference path="../../../../src/vs/vscode.d.ts" />
/// <reference path='../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../extensions/declares.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>

View file

@ -15,7 +15,7 @@ suite('window namespace tests', () => {
teardown(cleanUp);
test('editor, active text editor', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
return window.showTextDocument(doc).then((editor) => {
const active = window.activeTextEditor;
assert.ok(active);
@ -31,7 +31,7 @@ suite('window namespace tests', () => {
test('editor, assign and check view columns', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
let p1 = window.showTextDocument(doc, ViewColumn.One).then(editor => {
assert.equal(editor.viewColumn, ViewColumn.One);
});
@ -52,7 +52,7 @@ suite('window namespace tests', () => {
eventCounter += 1;
});
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
return window.showTextDocument(doc, ViewColumn.One).then(editor => {
assert.equal(eventCounter, 1);
return doc;
@ -111,8 +111,8 @@ suite('window namespace tests', () => {
});
test('issue #5362 - Incorrect TextEditor passed by onDidChangeTextEditorSelection', (done) => {
const file10Path = join(workspace.rootPath, './10linefile.ts');
const file30Path = join(workspace.rootPath, './30linefile.ts');
const file10Path = join(workspace.rootPath || '', './10linefile.ts');
const file30Path = join(workspace.rootPath || '', './30linefile.ts');
let finished = false;
let failOncePlease = (err: Error) => {
@ -291,7 +291,7 @@ suite('window namespace tests', () => {
});
test('editor, selection change kind', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
return new Promise((resolve, reject) => {

View file

@ -60,7 +60,7 @@ suite('workspace-namespace', () => {
test('openTextDocument', () => {
let len = workspace.textDocuments.length;
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return workspace.openTextDocument(join(workspace.rootPath || '', './far.js')).then(doc => {
assert.ok(doc);
assert.equal(workspace.textDocuments.length, len + 1);
});
@ -79,7 +79,7 @@ suite('workspace-namespace', () => {
return; // TODO@Joh this test fails on windows
}
return workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath, './newfile.txt'))).then(doc => {
return workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath || '', './newfile.txt'))).then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
assert.ok(doc.isDirty);
});
@ -101,7 +101,7 @@ suite('workspace-namespace', () => {
});
test('openTextDocument, untitled closes on save', function (done) {
const path = join(workspace.rootPath, './newfile.txt');
const path = join(workspace.rootPath || '', './newfile.txt');
return workspace.openTextDocument(Uri.parse('untitled:' + path)).then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
@ -118,7 +118,7 @@ suite('workspace-namespace', () => {
d0.dispose();
return deleteFile(Uri.file(join(workspace.rootPath, './newfile.txt'))).then(() => done(null));
return deleteFile(Uri.file(join(workspace.rootPath || '', './newfile.txt'))).then(() => done(null));
});
});
@ -409,7 +409,7 @@ suite('workspace-namespace', () => {
test('applyEdit', () => {
return workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath, './new2.txt'))).then(doc => {
return workspace.openTextDocument(Uri.parse('untitled:' + join(workspace.rootPath || '', './new2.txt'))).then(doc => {
let edit = new WorkspaceEdit();
edit.insert(doc.uri, new Position(0, 0), new Array(1000).join('Hello World'));
return workspace.applyEdit(edit);

View file

@ -13,6 +13,7 @@
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"@types/node": "^7.0.4",
"typescript": "^1.6.2",
"vscode": "1.0.1"
}

View file

@ -4,5 +4,4 @@
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../extensions/declares.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../node_modules/@types/node/index.d.ts'/>