Merge branch 'Microsoft/master' into update-css-intellisense

# Conflicts:
#	src/vs/languages/html/common/htmlTags.ts
This commit is contained in:
David Storey 2015-12-08 17:03:17 -08:00
parent db6f0f960e
commit 23db8835f5
504 changed files with 30211 additions and 27525 deletions

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Tab indentation
[*]
indent_style = tab
indent_size = 4
# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
[{.travis.yml,npm-shrinkwrap.json,package.json}]
indent_style = space
indent_size = 2

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
npm-debug.log
Thumbs.db
node_modules/
.build/
out/
out-build/
out-editor/

View file

@ -26,12 +26,16 @@ before_install:
- npm config set python `which python`
- npm install -g gulp
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9";
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
install:
- ./scripts/npm.sh install
- gulp electron compile
script:
- gulp hygiene
- gulp electron
- gulp compile
- ./test/run.sh

View file

@ -9,6 +9,7 @@
"search.exclude": {
"**/node_modules/**": true,
"**/bower_components": true,
".build/**": true,
"out*/**": true,
"extensions/**/out/**": true
}

View file

@ -1,196 +1,196 @@
// Listing in here platform dependencies that come in at build time
[{
"name": "atom-brightray",
"repositoryURL": "https://github.com/atom/brightray",
"license": "MIT",
"isProd": true
},
{
"name": "chromium",
"version": "45.0.2454.85",
"repositoryURL": "http://www.chromium.org/Home",
"licenseDetail": [
"BSD License",
"",
"Copyright 2014 The Chromium Authors. All rights reserved.",
"",
"Redistribution and use in source and binary forms, with or without modification,",
"are permitted provided that the following conditions are met:",
"",
" * Redistributions of source code must retain the above copyright notice, this",
" list of conditions and the following disclaimer.",
"",
" * Redistributions in binary form must reproduce the above copyright notice,",
" this list of conditions and the following disclaimer in the documentation",
" and/or other materials provided with the distribution.",
"",
" * Neither the name Google Inc. nor the names of its contributors may be used to",
" endorse or promote products derived from this software without specific",
" prior written permission.",
"",
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND",
"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED",
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE",
"DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR",
"ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES",
"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;",
"LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON",
"ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS",
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
],
"isProd": true
},
{
"name": "libchromiumcontent",
"version": "45.0.2454.85 ",
"license": "MIT",
"repositoryURL": "https://github.com/atom/libchromiumcontent",
"isProd": true
},
{
"name": "nodejs",
"version": "4.1.1",
"repositoryURL": "https://github.com/nodejs/node",
"isProd": true
},
{
"name": "electron",
"version": "0.34.1",
"license": "MIT",
"repositoryURL": "https://github.com/atom/electron",
"isProd": true
},
{
"name": "inno setup",
"version": "5.5.6",
"repositoryURL": "https://github.com/jrsoftware/issrc",
"isProd": true
},
// ----------------------------------------------------------
// The following definitions are here for the sole purpose of
// defining licenses for dependencies where licensing cannot
// be inferred by tooling:
{
// Reason: LICENSE file missing in repo
// SOURCE: https://github.com/isaacs/core-util-is/blob/master/lib/util.js
"name":"core-util-is",
"isLicense": true,
"licenseDetail": [
"Copyright Joyent, Inc. and other Node contributors.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a",
"copy of this software and associated documentation files (the",
"\"Software\"), to deal in the Software without restriction, including",
"without limitation the rights to use, copy, modify, merge, publish,",
"distribute, sublicense, and/or sell copies of the Software, and to permit",
"persons to whom the Software is furnished to do so, subject to the",
"following conditions:",
"",
"The above copyright notice and this permission notice shall be included",
"in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS",
"OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN",
"NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,",
"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR",
"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE",
"USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
// Reason: vscode-textmate is not public yet
// TODO: Remove once vscode-textmate visibility is made public
"name": "vscode-textmate",
"isLicense": true,
"licenseDetail": [
"The MIT License (MIT)",
"",
"Copyright (c) Microsoft Corporation",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy",
"of this software and associated documentation files (the \"Software\"), to deal",
"in the Software without restriction, including without limitation the rights",
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
"copies of the Software, and to permit persons to whom the Software is",
"furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all",
"copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
"SOFTWARE."
]
},
{
// Reason: LICENSE file missing in repo
"name": "winreg",
"isLicense": true,
"licenseDetail": [
"Copyright (c) Paul Bottin",
"",
"The BSD License",
"",
"Redistribution and use in source and binary forms, with or without",
"modification, are permitted provided that the following conditions",
"are met:",
"",
"1. Redistributions of source code must retain the above copyright",
" notice, this list of conditions and the following disclaimer.",
"",
"2. Redistributions in binary form must reproduce the above copyright",
" notice, this list of conditions and the following disclaimer in the",
" documentation and/or other materials provided with the distribution.",
"",
"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND",
"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS",
"BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR",
"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF",
"SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR",
"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,",
"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE",
"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN",
"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
]
},
{
// Reason: LICENSE file doesn't have Copyright statement
"name": "readdirp",
"isLicense": true,
"licenseDetail": [
"This software is released under the MIT license:",
"",
"Copyright (c) Thorsten Lorenz",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of",
"this software and associated documentation files (the \"Software\"), to deal in",
"the Software without restriction, including without limitation the rights to",
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of",
"the Software, and to permit persons to whom the Software is furnished to do so,",
"subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all",
"copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS",
"FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR",
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER",
"IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN",
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
}
]
// Listing in here platform dependencies that come in at build time
[{
"name": "atom-brightray",
"repositoryURL": "https://github.com/atom/brightray",
"license": "MIT",
"isProd": true
},
{
"name": "chromium",
"version": "45.0.2454.85",
"repositoryURL": "http://www.chromium.org/Home",
"licenseDetail": [
"BSD License",
"",
"Copyright 2014 The Chromium Authors. All rights reserved.",
"",
"Redistribution and use in source and binary forms, with or without modification,",
"are permitted provided that the following conditions are met:",
"",
" * Redistributions of source code must retain the above copyright notice, this",
" list of conditions and the following disclaimer.",
"",
" * Redistributions in binary form must reproduce the above copyright notice,",
" this list of conditions and the following disclaimer in the documentation",
" and/or other materials provided with the distribution.",
"",
" * Neither the name Google Inc. nor the names of its contributors may be used to",
" endorse or promote products derived from this software without specific",
" prior written permission.",
"",
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND",
"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED",
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE",
"DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR",
"ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES",
"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;",
"LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON",
"ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS",
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
],
"isProd": true
},
{
"name": "libchromiumcontent",
"version": "45.0.2454.85 ",
"license": "MIT",
"repositoryURL": "https://github.com/atom/libchromiumcontent",
"isProd": true
},
{
"name": "nodejs",
"version": "4.1.1",
"repositoryURL": "https://github.com/nodejs/node",
"isProd": true
},
{
"name": "electron",
"version": "0.34.5",
"license": "MIT",
"repositoryURL": "https://github.com/atom/electron",
"isProd": true
},
{
"name": "inno setup",
"version": "5.5.6",
"repositoryURL": "https://github.com/jrsoftware/issrc",
"isProd": true
},
// ----------------------------------------------------------
// The following definitions are here for the sole purpose of
// defining licenses for dependencies where licensing cannot
// be inferred by tooling:
{
// Reason: LICENSE file missing in repo
// SOURCE: https://github.com/isaacs/core-util-is/blob/master/lib/util.js
"name":"core-util-is",
"isLicense": true,
"licenseDetail": [
"Copyright Joyent, Inc. and other Node contributors.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a",
"copy of this software and associated documentation files (the",
"\"Software\"), to deal in the Software without restriction, including",
"without limitation the rights to use, copy, modify, merge, publish,",
"distribute, sublicense, and/or sell copies of the Software, and to permit",
"persons to whom the Software is furnished to do so, subject to the",
"following conditions:",
"",
"The above copyright notice and this permission notice shall be included",
"in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS",
"OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN",
"NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,",
"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR",
"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE",
"USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
// Reason: vscode-textmate is not public yet
// TODO: Remove once vscode-textmate visibility is made public
"name": "vscode-textmate",
"isLicense": true,
"licenseDetail": [
"The MIT License (MIT)",
"",
"Copyright (c) Microsoft Corporation",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy",
"of this software and associated documentation files (the \"Software\"), to deal",
"in the Software without restriction, including without limitation the rights",
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
"copies of the Software, and to permit persons to whom the Software is",
"furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all",
"copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
"SOFTWARE."
]
},
{
// Reason: LICENSE file missing in repo
"name": "winreg",
"isLicense": true,
"licenseDetail": [
"Copyright (c) Paul Bottin",
"",
"The BSD License",
"",
"Redistribution and use in source and binary forms, with or without",
"modification, are permitted provided that the following conditions",
"are met:",
"",
"1. Redistributions of source code must retain the above copyright",
" notice, this list of conditions and the following disclaimer.",
"",
"2. Redistributions in binary form must reproduce the above copyright",
" notice, this list of conditions and the following disclaimer in the",
" documentation and/or other materials provided with the distribution.",
"",
"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND",
"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS",
"BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR",
"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF",
"SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR",
"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,",
"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE",
"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN",
"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
]
},
{
// Reason: LICENSE file doesn't have Copyright statement
"name": "readdirp",
"isLicense": true,
"licenseDetail": [
"This software is released under the MIT license:",
"",
"Copyright (c) Thorsten Lorenz",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of",
"this software and associated documentation files (the \"Software\"), to deal in",
"the Software without restriction, including without limitation the rights to",
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of",
"the Software, and to permit persons to whom the Software is furnished to do so,",
"subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all",
"copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS",
"FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR",
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER",
"IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN",
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
}
]

View file

@ -1,6 +1,6 @@
# Visual Studio Code - Open Source
[![Build Status](https://travis-ci.org/Microsoft/vscode.svg?branch=master)](https://travis-ci.org/Microsoft/vscode)
[![Build Status](https://travis-ci.org/Microsoft/vscode.svg?branch=master)](https://travis-ci.org/Microsoft/vscode) [![Build status](https://ci.appveyor.com/api/projects/status/vuhlhg80tj3e2a0l?svg=true)](https://ci.appveyor.com/project/VSCode/vscode)
[VS Code](http://code.visualstudio.com) is a new type of tool that combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. Code provides comprehensive editing and debugging support, an extensibility model, and lightweight integration with existing tools.
@ -28,4 +28,4 @@ Many of the core components and extensions to Code live in their own repositorie
For a complete list, please see the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our wiki.
## License
[MIT](LICENSE.txt)
[MIT](LICENSE.txt)

14
appveyor.yml Normal file
View file

@ -0,0 +1,14 @@
environment:
ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1
install:
- ps: Install-Product node 4.1.1 x64
- npm install -g gulp mocha
build_script:
- .\scripts\npm.bat install --force
- gulp electron
- gulp compile
test_script:
- mocha

View file

@ -14,7 +14,7 @@ var util = require('./lib/util');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
var commit = util.getVersion(root);
// Build

152
build/gulpfile.hygiene.js Normal file
View file

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var filter = require('gulp-filter');
var es = require('event-stream');
var path = require('path');
var all = [
'build/**/*',
'extensions/**/*',
'scripts/**/*',
'src/**/*',
'test/**/*'
];
var eolFilter = [
'**',
'!extensions/**/out/**',
'!**/node_modules/**',
'!**/fixtures/**',
'!**/*.{svg,exe,png,scpt,bat,cur,ttf,woff,eot}',
];
var indentationFilter = [
'**',
'!**/lib/**',
'!**/*.d.ts',
'!extensions/typescript/server/**',
'!test/assert.js',
'!**/package.json',
'!**/npm-shrinkwrap.json',
'!**/octicons/**',
'!**/vs/languages/sass/test/common/example.scss',
'!**/vs/languages/less/common/parser/less.grammar.txt',
'!**/vs/languages/css/common/buildscripts/css-schema.xml',
'!**/vs/languages/markdown/common/raw.marked.js',
'!**/vs/base/common/winjs.base.raw.js',
'!**/vs/base/node/terminateProcess.sh',
'!**/vs/base/node/terminateProcess.sh',
'!**/vs/text.js',
'!**/vs/nls.js',
'!**/vs/css.js',
'!**/vs/loader.js',
'!extensions/**/snippets/**',
'!extensions/**/syntaxes/**',
'!extensions/**/themes/**',
];
var copyrightFilterList = [
'**',
'!**/*.json',
'!**/*.html',
'!**/test/**',
'!**/*.md',
'!**/*.sh',
'!**/*.txt',
'!src/vs/editor/standalone-languages/swift.ts',
];
var copyrightHeader = [
'/*---------------------------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Licensed under the MIT License. See License.txt in the project root for license information.',
' *--------------------------------------------------------------------------------------------*/'
].join('\n');
var hygiene = exports.hygiene = function (some) {
var errorCount = 0;
var eol = es.through(function (file) {
if (/\r\n?/g.test(file.contents.toString('utf8'))) {
console.error(file.relative + ': Bad EOL found');
errorCount++;
}
this.emit('data', file);
});
var indentation = es.through(function (file) {
file.contents
.toString('utf8')
.split(/\r\n|\r|\n/)
.forEach(function(line, i) {
if (/^\s*$/.test(line)) {
// empty or whitespace lines are OK
} else if (/^[\t]*[^\s]/.test(line)) {
// good indent
} else if (/^[\t]* \*/.test(line)) {
// block comment using an extra space
} else {
console.error(file.relative + '(' + (i + 1) + ',1): Bad whitespace indentation');
errorCount++;
}
});
this.emit('data', file);
});
var copyrights = es.through(function (file) {
if (file.contents.toString('utf8').indexOf(copyrightHeader) !== 0) {
console.error(file.relative + ': Missing or bad copyright statement');
errorCount++;
}
this.emit('data', file);
});
return gulp.src(some || all, { base: '.' })
.pipe(filter(function (f) { return !f.stat.isDirectory(); }))
.pipe(filter(eolFilter))
.pipe(eol)
.pipe(filter(indentationFilter))
.pipe(indentation)
.pipe(filter(copyrightFilterList))
.pipe(copyrights)
.pipe(es.through(null, function () {
if (errorCount > 0) {
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
} else {
this.emit('end');
}
}));
};
gulp.task('hygiene', function () {
return hygiene();
});
// this allows us to run this as a git pre-commit hook
if (require.main === module) {
var cp = require('child_process');
cp.exec('git diff --cached --name-only', function (err, out) {
if (err) {
console.error();
console.error(err);
process.exit(1);
}
var some = out
.split(/\r?\n/)
.filter(function (l) { return !!l; });
hygiene(some).on('error', function (err) {
console.error();
console.error(err);
process.exit(1);
});
});
}

View file

@ -25,7 +25,8 @@ var util = require('./lib/util');
var buildfile = require('../src/buildfile');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
var build = path.join(root, '.build');
var commit = util.getVersion(root);
var baseModules = [
'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window',
@ -34,11 +35,15 @@ var baseModules = [
'https', 'https-proxy-agent', 'iconv-lite', 'ipc', 'menu', 'menu-item', 'net',
'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver',
'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'web-frame', 'winreg',
'yauzl'
'yauzl', 'native-keymap'
];
// Build
var builtInExtensions = {
'jrieken.vscode-omnisharp': '0.1.0',
};
var vscodeEntryPoints = _.flatten([
buildfile.entrypoint('vs/workbench/workbench.main'),
buildfile.base,
@ -112,7 +117,7 @@ var config = {
gulp.task('electron', function () {
// Force windows to use ia32
var arch = (process.platform === 'win32' ? 'ia32' : process.arch);
return electron.dest(path.join(path.dirname(root), 'Electron-Build'), _.extend({}, config, { arch: arch }));
return electron.dest(path.join(build, 'electron'), _.extend({}, config, { arch: arch }));
});
function mixinProduct() {
@ -161,12 +166,7 @@ function packageTask(platform, arch, opts) {
'extensions/**',
'!extensions/*/src/**',
'!extensions/*/out/**/test/**',
'!extensions/typescript/bin/**',
'!extensions/csharp-o/node_modules/del/**',
'!extensions/csharp-o/node_modules/gulp/**',
'!extensions/csharp-o/node_modules/gulp-decompress/**',
'!extensions/csharp-o/node_modules/gulp-download/**',
'!extensions/csharp-o/node_modules/typescript/**'
'!extensions/typescript/bin/**'
], { base: '.' });
var pluginHostSourceMap = gulp.src(out + '/vs/workbench/node/pluginHostProcess.js.map', { base: '.' })
@ -182,8 +182,9 @@ function packageTask(platform, arch, opts) {
var license = gulp.src(['Credits_*', 'LICENSE.txt', 'ThirdPartyNotices.txt'], { base: '.' });
var api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
var depsSrc = _.flatten(Object.keys(packagejson.dependencies)
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }));
var depsSrc = _.flatten(Object.keys(packagejson.dependencies).concat(Object.keys(packagejson.optionalDependencies))
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; })
);
var deps = gulp.src(depsSrc, { base: '.', dot: true })
.pipe(util.cleanNodeModule('fsevents', ['binding.gyp', 'fsevents.cc', 'build/**', 'src/**', 'test/**'], true))
@ -197,6 +198,11 @@ function packageTask(platform, arch, opts) {
resources = es.merge(resources, gulp.src(product.icons.application.png, { base: '.' }));
}
var extraExtensions = util.downloadExtensions(builtInExtensions)
.pipe(rename(function (p) {
p.dirname = path.posix.join('extensions', p.dirname);
}));
var all = es.merge(
api,
packageJson,
@ -204,6 +210,7 @@ function packageTask(platform, arch, opts) {
license,
sources,
deps,
extraExtensions,
resources
).pipe(util.skipDirectories());

View file

@ -1,36 +0,0 @@
var es = require('event-stream');
var fs = require('fs');
var path = require('path');
var copyright = [
'/*---------------------------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Licensed under the MIT License. See License.txt in the project root for license information.',
' *--------------------------------------------------------------------------------------------*/'
].join('\n');
exports.copyrights = function () {
return es.mapSync(function (file) {
if (file.contents) {
var contents = file.contents.toString('utf8');
if (contents.indexOf(copyright) !== 0) {
throw new Error('File ' + file.path + ' does not contain copyright statement.');
}
}
});
};
exports.insertCopyrights = function() {
return es.mapSync(function (file) {
if (file.contents) {
var contents = file.contents.toString('utf8');
if (contents.indexOf(copyright) !== 0) {
contents = copyright + '\n\n' + contents;
fs.writeFileSync(file.path, contents, 'utf8');
}
}
});
}

View file

@ -1,60 +0,0 @@
var es = require('event-stream');
var path = require('path');
module.exports = function (opts) {
return es.mapSync(function (file) {
if (file.stat.isDirectory()) {
return file;
}
var contents = file.contents.toString('utf8');
if (opts.complain) {
if (contents.indexOf('\r\n') >= 0) {
console.log(file.path + ' uses \\r\\n');
}
if (opts.whitespace) {
var lines = contents.split(/\r\n|\r|\n/);
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (line.length === 0) {
// empty lines are OK
continue;
}
if (/^[\t]*[^\s]/.test(line)) {
// good indent
continue;
} else if (/^[\t]* \*/.test(line)) {
// block comment using an extra space
continue;
} else if (/^[\t]+$/.test(line)) {
// empty line
continue;
} else {
console.log(file.path + '(' + (i + 1) + ',1): Mixed whitespace indentation');
}
}
}
} else {
var lines = contents.split(/\r\n|\r|\n/);
if (opts.whitespace) {
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
line = line.replace(/^\ {28}/, '\t\t\t\t\t\t\t');
line = line.replace(/^\ {24}/, '\t\t\t\t\t\t');
line = line.replace(/^\ {20}/, '\t\t\t\t\t');
line = line.replace(/^\ {16}/, '\t\t\t\t');
line = line.replace(/^\ {12}/, '\t\t\t');
line = line.replace(/^\ {8}/, '\t\t');
line = line.replace(/^\ {4}/, '\t');
lines[i] = line;
}
}
file.contents = new Buffer(lines.join('\n'), 'utf8');
}
return file;
});
};

View file

@ -10,6 +10,7 @@ var _ = require('underscore');
var path = require('path');
var fs = require('fs');
var rimraf = require('rimraf');
var git = require('./git');
var NoCancellationToken = {
isCancellationRequested: function () {
@ -275,4 +276,14 @@ exports.downloadExtensions = function(extensions) {
});
return es.merge(streams);
};
exports.getVersion = function (root) {
var version = process.env['BUILD_SOURCEVERSION'];
if (!version || !/^[0-9a-f]{40}$/i.test(version)) {
version = git.getVersion(root);
}
return version;
};

13
build/npm/preinstall.js Normal file
View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var win = "Please run '.\\scripts\\npm.bat install' instead."
var nix = "Please run './scripts/npm.sh install' instead."
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/atom-shell') {
console.error("You can't use plain npm to install Code's dependencies.");
console.error(/^win/.test(process.platform) ? win : nix);
process.exit(1);
}

View file

@ -1 +0,0 @@
bin

View file

@ -1,29 +0,0 @@
[
{
"name": "Omnisharp-roslyn",
"repositoryURL": "https://github.com/OmniSharp/omnisharp-roslyn",
"version": "1.5.5",
"license": "MIT",
"isProd": true
},
{
"name": "ScriptCS",
"repositoryURL": "https://github.com/scriptcs/scriptcs",
"version": "0.16.0",
"license": "Apache2",
"licenseDetail": [
"Copyright 2013 Glenn Block, Justin Rusbatch, Filip Wojcieszyn",
"",
"Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file ",
"except in compliance with the License. You may obtain a copy of the License at",
"",
"http://www.apache.org/licenses/LICENSE-2.0",
"",
"Unless required by applicable law or agreed to in writing, software distributed under the ",
"License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ",
"either express or implied. See the License for the specific language governing permissions ",
"and limitations under the License."
],
"isProd": true
}
]

View file

@ -1,93 +0,0 @@
var gulp = require('gulp');
var decompress = require('gulp-decompress');
var es = require('event-stream');
var GitHub = require('github-releases');
var tmp = require('tmp');
var vfs = require('vinyl-fs');
var del = require('del');
var fs = require('fs');
var path = require('path');
tmp.setGracefulCleanup();
function downloadOmnisharp(version) {
var result = es.through();
function onError(err) {
result.emit('error', err);
}
var repo = new GitHub({
repo: 'OmniSharp/omnisharp-roslyn',
token: process.env['GITHUB_TOKEN']
});
repo.getReleases({ tag_name: version }, function (err, releases) {
if (err) { return onError(err); }
if (!releases.length) { return onError(new Error('Release not found')); }
if (!releases[0].assets.length) { return onError(new Error('Assets not found')); }
repo.downloadAsset(releases[0].assets[0], function (err, istream) {
if (err) { return onError(err); }
tmp.file(function (err, tmpPath, fd, cleanupCallback) {
if (err) { return onError(err); }
var ostream = fs.createWriteStream(null, { fd: fd });
ostream.once('error', onError);
istream.once('error', onError);
ostream.once('finish', function () {
vfs.src(tmpPath).pipe(result);
});
istream.pipe(ostream);
});
});
});
return result;
}
gulp.task('omnisharp:clean', function () {
return del('bin');
});
gulp.task('omnisharp:fetch', ['omnisharp:clean'], function () {
return downloadOmnisharp('v1.5.6')
.pipe(decompress({strip: 1}))
.pipe(gulp.dest('bin'));
});
gulp.task('omnisharp:fixscripts', ['omnisharp:fetch'], function () {
var _fixes = Object.create(null);
_fixes['./bin/omnisharp.cmd'] = '@"%~dp0packages\\dnx-clr-win-x86.1.0.0-beta4\\bin\\dnx.exe" "%~dp0packages\\OmniSharp\\1.0.0\\root" run %*';
_fixes['./bin/omnisharp'] = '#!/bin/bash\n\
SOURCE="${BASH_SOURCE[0]}"\n\
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink\n\
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"\n\
SOURCE="$(readlink "$SOURCE")"\n\
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located\n\
done\n\
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"\n\
export SET DNX_APPBASE="$DIR/packages/OmniSharp/1.0.0/root"\n\
export PATH=/usr/local/bin:/Library/Frameworks/Mono.framework/Commands:$PATH # this is required for the users of the Homebrew Mono package\n\
exec "$DIR/packages/dnx-mono.1.0.0-beta4/bin/dnx" "$DNX_APPBASE" run "$@"\n\
\n';
var promises = Object.keys(_fixes).map(function (key) {
return new Promise(function(resolve, reject) {
fs.writeFile(path.join(__dirname, key), _fixes[key], function (err) {
if (err) {
reject(err);
} else {
resolve();
}
})
});
});
return Promise.all(promises)
});
gulp.task('omnisharp', ['omnisharp:fixscripts']);

View file

@ -1,102 +0,0 @@
{
"name": "csharp-o",
"version": "0.1.0",
"publisher": "vscode",
"engines": {
"node": "^4.0.0",
"vscode": "*"
},
"activationEvents": [
"onLanguage:csharp",
"onCommand:o.restart",
"onCommand:o.pickProjectAndStart",
"onCommand:o.restore",
"onCommand:o.execute",
"onCommand:o.showOutput",
"onCommand:o.execute",
"onCommand:o.execute-last-command"
],
"main": "./out/omnisharpMain",
"scripts": {
"postinstall": "node ./node_modules/gulp/bin/gulp.js omnisharp",
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../gulpfile.plugins.js compile-plugin:csharp-o ./tsconfig.json"
},
"dependencies": {
"run-in-terminal": "*",
"semver": "*"
},
"devDependencies": {
"del": "^2.0.2",
"event-stream": "^3.3.2",
"github-releases": "^0.3.0",
"gulp": "^3.8.9",
"gulp-decompress": "^1.2.0",
"tmp": "0.0.28",
"vinyl-fs": "^2.2.1"
},
"extensionDependencies": [
"vscode.csharp"
],
"contributes": {
"commands": [
{
"command": "o.restart",
"title": "Restart OmniSharp",
"category": "OmniSharp"
},
{
"command": "o.pickProjectAndStart",
"title": "Select Project",
"category": "OmniSharp"
},
{
"command": "o.restore",
"title": "Restore Packages",
"category": "dnx"
},
{
"command": "o.execute",
"title": "Run Command",
"category": "dnx"
}
],
"keybindings": [
{
"command": "o.showOutput",
"key": "Ctrl+L L",
"mac": "Cmd+L L"
},
{
"command": "o.execute",
"key": "Ctrl+L Shift+R",
"mac": "Cmd+L Shift+R"
},
{
"command": "o.execute-last-command",
"key": "Ctrl+L R",
"mac": "Cmd+L R"
},
{
"key": "shift+0",
"command": "^acceptSelectedSuggestion",
"when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey"
},
{
"key": "shift+9",
"command": "^acceptSelectedSuggestion",
"when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey"
},
{
"key": ".",
"command": "^acceptSelectedSuggestion",
"when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey"
}
],
"snippets": [
{
"language": "csharp",
"path": "./snippets/csharp.json"
}
]
}
}

View file

@ -1,524 +0,0 @@
{
"Attribute using recommended pattern": {
"prefix": "attribute",
"body": [
"[System.AttributeUsage(System.AttributeTargets.${All}, Inherited = ${false}, AllowMultiple = ${true})]",
"sealed class ${My}Attribute : System.Attribute",
"{",
" // See the attribute guidelines at",
" // http://go.microsoft.com/fwlink/?LinkId=85236",
" readonly string positionalString;",
" ",
" // This is a positional argument",
" public ${My}Attribute (string positionalString)",
" {",
" this.positionalString = positionalString;",
" ",
" // TODO: Implement code here",
" ${throw new System.NotImplementedException();}",
" }",
" ",
" public string PositionalString",
" {",
" get { return positionalString; }",
" }",
" ",
" // This is a named argument",
" public int NamedInt { get; set; }",
"}"
],
"description": "Attribute using recommended pattern"
},
"Checked block": {
"prefix": "checked",
"body": [
"checked",
"{",
" $0",
"}"
],
"description": "Checked block"
},
"Class": {
"prefix": "class",
"body": [
"class ${Name}",
"{",
" $0",
"}"
],
"description": "Class"
},
"Console.WriteLine": {
"prefix": "cw",
"body": [
"System.Console.WriteLine($0);"
],
"description": "Console.WriteLine"
},
"do...while loop": {
"prefix": "do",
"body": [
"do",
"{",
" $0",
"} while (${true});"
],
"description": "do...while loop"
},
"Else statement": {
"prefix": "else",
"body": [
"else",
"{",
" $0",
"}"
],
"description": "Else statement"
},
"Enum": {
"prefix": "enum",
"body": [
"enum ${Name}",
"{",
" $0",
"}"
],
"description": "Enum"
},
"Implementing Equals() according to guidelines": {
"prefix": "equals",
"body": [
"// override object.Equals",
"public override bool Equals (object obj)",
"{",
" //",
" // See the full list of guidelines at",
" // http://go.microsoft.com/fwlink/?LinkID=85237",
" // and also the guidance for operator== at",
" // http://go.microsoft.com/fwlink/?LinkId=85238",
" //",
" ",
" if (obj == null || GetType() != obj.GetType())",
" {",
" return false;",
" }",
" ",
" // TODO: write your implementation of Equals() here",
" ${1:throw new System.NotImplementedException();}",
" return base.Equals (obj);",
"}",
"",
"// override object.GetHashCode",
"public override int GetHashCode()",
"{",
" // TODO: write your implementation of GetHashCode() here",
" ${2:throw new System.NotImplementedException();}",
" return base.GetHashCode();",
"}"
],
"description": "Implementing Equals() according to guidelines"
},
"Exception": {
"prefix": "exception",
"body": [
"[System.Serializable]",
"public class ${My}Exception : ${System.Exception}",
"{",
" public ${My}Exception() { }",
" public ${My}Exception( string message ) : base( message ) { }",
" public ${My}Exception( string message, System.Exception inner ) : base( message, inner ) { }",
" protected ${My}Exception(",
" System.Runtime.Serialization.SerializationInfo info,",
" System.Runtime.Serialization.StreamingContext context ) : base( info, context ) { }",
"}"
],
"description": "Exception"
},
"Foreach statement": {
"prefix": "foreach",
"body": [
"foreach (${var} ${item} in ${collection})",
"{",
" $0",
"}"
],
"description": "Foreach statement"
},
"Reverse for loop": {
"prefix": "forr",
"body": [
"for (int ${i} = ${length} - 1; ${i} >= 0 ; ${i}--)",
"{",
" $0",
"}"
],
"description": "Reverse for loop"
},
"for loop": {
"prefix": "for",
"body": [
"for (int ${i} = 0; ${i} < ${length}; ${i}++)",
"{",
" $0",
"}"
],
"description": "for loop"
},
"if statement": {
"prefix": "if",
"body": [
"if (${true})",
"{",
" $0",
"}"
],
"description": "if statement"
},
"Indexer": {
"prefix": "indexer",
"body": [
"${public} ${object} this[${int} index]",
"{",
" get { $0 }",
" set { $1 }",
"}"
],
"description": "Indexer"
},
"Interface": {
"prefix": "interface",
"body": [
"interface I${Name}",
"{",
" $0",
"}"
],
"description": "Interface"
},
"Safely invoking an event": {
"prefix": "invoke",
"body": [
"${EventHandler} temp = ${MyEvent};",
"if (temp != null)",
"{",
" temp($0);",
"}"
],
"description": "Safely invoking an event"
},
"Simple iterator": {
"prefix": "iterator",
"body": [
"public System.Collections.Generic.IEnumerator<${ElementType}> GetEnumerator()",
"{",
" $0throw new System.NotImplementedException();",
" yield return default(${ElementType});",
"}"
],
"description": "Simple iterator"
},
"Named iterator/indexer pair using a nested class": {
"prefix": "iterindex",
"body": [
"public ${Name}Iterator ${Name}",
"{",
" get",
" {",
" return new ${Name}Iterator(this);",
" }",
"}",
"",
"public class ${Name}Iterator",
"{",
" readonly ${ClassName} outer;",
" ",
" internal ${Name}Iterator(${ClassName} outer)",
" {",
" this.outer = outer;",
" }",
" ",
" // TODO: provide an appropriate implementation here",
" public int Length { get { return 1; } }",
" ",
" public ${ElementType} this[int index]",
" {",
" get",
" {",
" //",
" // TODO: implement indexer here",
" //",
" // you have full access to ${ClassName} privates",
" //",
" ${throw new System.NotImplementedException();}",
" return default(${ElementType});",
" }",
" }",
" ",
" public System.Collections.Generic.IEnumerator<${ElementType}> GetEnumerator()",
" {",
" for (int i = 0; i < this.Length; i++)",
" {",
" yield return this[i];",
" }",
" }",
"}"
],
"description": "Named iterator/indexer pair using a nested class"
},
"Lock statement": {
"prefix": "lock",
"body": [
"lock (${this})",
"{",
" $0",
"}"
],
"description": "Lock statement"
},
"MessageBox.Show": {
"prefix": "mbox",
"body": [
"System.Windows.Forms.MessageBox.Show(\"${Text}\");$0"
],
"description": "MessageBox.Show"
},
"Namespace": {
"prefix": "namespace",
"body": [
"namespace ${Name}",
"{",
" $0",
"}"
],
"description": "Namespace"
},
"#if": {
"prefix": "ifd",
"body": [
"#if ${true}",
" $0",
"#endif"
],
"description": "#if"
},
"#region": {
"prefix": "region",
"body": [
"#region ${Name}",
" $0",
"#endregion"
],
"description": "#region"
},
"Property and backing field": {
"prefix": "propfull",
"body": [
"private ${int} ${myVar};",
"public ${int} ${MyProperty}",
"{",
" get { return ${myVar};}",
" set { ${myVar} = value;}",
"}",
"$0"
],
"description": "Property and backing field"
},
"propg": {
"prefix": "propg",
"body": [
"public ${int} ${MyProperty} { get; private set; }$0"
],
"description": "An automatically implemented property with a 'get' accessor and a private 'set' accessor. C# 3.0 or higher"
},
"prop": {
"prefix": "prop",
"body": [
"public ${int} ${MyProperty} { get; set; }$0"
],
"description": "An automatically implemented property. C# 3.0 or higher"
},
"sim": {
"prefix": "sim",
"body": [
"static int Main(string[] args)",
"{",
" $0",
" return 0;",
"}"
],
"description": "int Main()"
},
"Struct": {
"prefix": "struct",
"body": [
"struct ${Name}",
"{",
" $0",
"}"
],
"description": "Struct"
},
"svm": {
"prefix": "svm",
"body": [
"static void Main(string[] args)",
"{",
" $0",
"}"
],
"description": "void Main()"
},
"Switch statement": {
"prefix": "switch",
"body": [
"switch (${switch_on})",
"{",
" $0",
" default:",
"}"
],
"description": "Switch statement"
},
"Try finally": {
"prefix": "tryf",
"body": [
"try",
"{",
" ${_}",
"}",
"finally",
"{",
" $0",
"}"
],
"description": "Try finally"
},
"Try catch": {
"prefix": "try",
"body": [
"try",
"{",
" ${_}",
"}",
"catch (${System.Exception})",
"{",
" $0",
" throw;",
"}"
],
"description": "Try catch"
},
"Unchecked block": {
"prefix": "unchecked",
"body": [
"unchecked",
"{",
" $0",
"}"
],
"description": "Unchecked block"
},
"Unsafe statement": {
"prefix": "unsafe",
"body": [
"unsafe",
"{",
" $0",
"}"
],
"description": "Unsafe statement"
},
"Using statement": {
"prefix": "using",
"body": [
"using(${resource})",
"{",
" $0",
"}"
],
"description": "Using statement"
},
"While loop": {
"prefix": "while",
"body": [
"while (${true})",
"{",
" $0",
"}"
],
"description": "While loop"
}
}

View file

@ -1,26 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {OmnisharpServer} from '../omnisharpServer';
import {Disposable} from 'vscode';
export default class AbstractProvider {
protected _server: OmnisharpServer;
protected _disposables: Disposable[];
constructor(server: OmnisharpServer) {
this._server = server;
this._disposables = [];
}
dispose() {
while (this._disposables.length) {
this._disposables.pop().dispose();
}
}
}

View file

@ -1,62 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Disposable, Uri, workspace} from 'vscode';
import {OmnisharpServer} from '../omnisharpServer';
import * as proto from '../protocol';
function forwardDocumentChanges(server: OmnisharpServer): Disposable {
return workspace.onDidChangeTextDocument(event => {
let {document} = event;
if (document.isUntitled || document.languageId !== 'csharp') {
return;
}
if (!server.isRunning()) {
return;
}
server.makeRequest(proto.UpdateBuffer, <proto.Request>{
Buffer: document.getText(),
Filename: document.fileName
}).catch(err => {
console.error(err);
return err;
});
});
}
function forwardFileChanges(server: OmnisharpServer): Disposable {
function onFileSystemEvent(uri: Uri): void {
if (!server.isRunning()) {
return;
}
let req = { Filename: uri.fsPath };
server.makeRequest<boolean>(proto.FilesChanged, [req]).catch(err => {
console.warn('[o] failed to forward file change event for ' + uri.fsPath, err);
return err;
});
}
const watcher = workspace.createFileSystemWatcher('**/*.*');
let d1 = watcher.onDidCreate(onFileSystemEvent);
let d2 = watcher.onDidChange(onFileSystemEvent);
let d3 = watcher.onDidDelete(onFileSystemEvent);
return Disposable.from(watcher, d1, d2, d3);
}
export default function forwardChanges(server: OmnisharpServer): Disposable {
// combine file watching and text document watching
return Disposable.from(
forwardDocumentChanges(server),
forwardFileChanges(server));
}

View file

@ -1,98 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {CodeActionProvider, CodeActionContext, Command, CancellationToken, TextDocument, WorkspaceEdit, TextEdit, Range, Uri, workspace, commands} from 'vscode';
import {OmnisharpServer} from '../omnisharpServer';
import AbstractProvider from './abstractProvider';
import {TextChange, V2} from '../protocol';
import {toRange2} from '../typeConvertion';
export default class OmnisharpCodeActionProvider extends AbstractProvider implements CodeActionProvider {
private _disabled: boolean;
private _commandId: string;
constructor(server: OmnisharpServer) {
super(server);
this._commandId = 'omnisharp.runCodeAction';
this._updateEnablement();
let d1 = workspace.onDidChangeConfiguration(this._updateEnablement, this);
let d2 = commands.registerCommand(this._commandId, this._runCodeAction, this);
this._disposables.push(d1, d2);
}
private _updateEnablement(): void {
let value = workspace.getConfiguration().get('csharp.disableCodeActions', false);
this._disabled = value;
}
public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): Promise<Command[]> {
if (this._disabled) {
return;
}
let req: V2.GetCodeActionsRequest = {
Filename: document.fileName,
Selection: OmnisharpCodeActionProvider._asRange(range)
}
return this._server.makeRequest<V2.GetCodeActionsResponse>(V2.GetCodeActions, req, token).then(response => {
return response.CodeActions.map(ca => {
return {
title: ca.Name,
command: this._commandId,
arguments: [ca.Identifier, document, range]
};
});
}, (error) => {
return Promise.reject('Problem invoking \'GetCodeActions\' on OmniSharp server: ' + error);
});
}
private _runCodeAction(id: string, document: TextDocument, range: Range): Promise<any> {
let req: V2.RunCodeActionRequest = {
Filename: document.fileName,
Selection: OmnisharpCodeActionProvider._asRange(range),
Identifier: id,
WantsTextChanges: true
};
return this._server.makeRequest<V2.RunCodeActionResponse>(V2.RunCodeAction, req).then(response => {
if (response && Array.isArray(response.Changes)) {
let edit = new WorkspaceEdit();
for (let change of response.Changes) {
let uri = Uri.file(change.FileName);
let edits: TextEdit[] = [];
for (let textChange of change.Changes) {
edits.push(TextEdit.replace(toRange2(textChange), textChange.NewText));
}
edit.set(uri, edits);
}
return workspace.applyEdit(edit);
}
}, (error) => {
return Promise.reject('Problem invoking \'RunCodeAction\' on OmniSharp server: ' + error);
});
}
private static _asRange(range: Range): V2.Range {
let {start, end} = range;
return {
Start: { Line: start.line + 1, Column: start.character + 1 },
End: { Line: end.line + 1, Column: end.character + 1 }
};
}
}

View file

@ -1,83 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {CancellationToken, CodeLens, SymbolKind, Range, Uri, TextDocument, CodeLensProvider, Position} from 'vscode';
import {createRequest, toRange, toLocation} from '../typeConvertion';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
class OmniSharpCodeLens extends CodeLens {
fileName: string;
constructor(fileName: string, range: Range) {
super(range);
this.fileName = fileName;
}
}
export default class OmniSharpCodeLensProvider extends AbstractSupport implements CodeLensProvider {
private static filteredSymbolNames: { [name: string]: boolean } = {
'Equals': true,
'Finalize': true,
'GetHashCode': true,
'ToString': true
};
provideCodeLenses(document: TextDocument, token: CancellationToken): CodeLens[] | Thenable<CodeLens[]> {
return this._server.makeRequest<proto.CurrentFileMembersAsTreeResponse>(proto.CurrentFileMembersAsTree, {
Filename: document.fileName
}, token).then(tree => {
var ret: CodeLens[] = [];
tree.TopLevelTypeDefinitions.forEach(node => OmniSharpCodeLensProvider._convertQuickFix(ret, document.fileName, node));
return ret;
});
}
private static _convertQuickFix(bucket: CodeLens[], fileName:string, node: proto.Node): void {
if (node.Kind === 'MethodDeclaration' && OmniSharpCodeLensProvider.filteredSymbolNames[node.Location.Text]) {
return;
}
let lens = new OmniSharpCodeLens(fileName, toRange(node.Location));
bucket.push(lens);
for (let child of node.ChildNodes) {
OmniSharpCodeLensProvider._convertQuickFix(bucket, fileName, child);
}
}
resolveCodeLens(codeLens: CodeLens, token: CancellationToken): Thenable<CodeLens> {
if (codeLens instanceof OmniSharpCodeLens) {
let req = <proto.FindUsagesRequest>{
Filename: codeLens.fileName,
Line: codeLens.range.start.line + 1,
Column: codeLens.range.start.character + 1,
OnlyThisFile: false,
ExcludeDefinition: true
};
return this._server.makeRequest<proto.QuickFixResponse>(proto.FindUsages, req, token).then(res => {
if (!res || !Array.isArray(res.QuickFixes)) {
return;
}
let len = res.QuickFixes.length;
codeLens.command = {
title: len === 1 ? '1 reference' : `${len} references`,
command: 'editor.action.showReferences',
arguments: [Uri.file(req.Filename), codeLens.range.start, res.QuickFixes.map(toLocation)]
};
return codeLens;
});
}
}
}

View file

@ -1,171 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as proto from '../protocol';
import {OmnisharpServer} from '../omnisharpServer';
import {Disposable, ViewColumn, commands, window} from 'vscode';
import {join, dirname, basename} from 'path';
import findLaunchTargets from '../launchTargetFinder';
import {runInTerminal} from 'run-in-terminal';
const isWin = /^win/.test(process.platform);
export default function registerCommands(server: OmnisharpServer) {
let d1 = commands.registerCommand('o.restart', () => server.restart());
let d2 = commands.registerCommand('o.pickProjectAndStart', () => pickProjectAndStart(server));
let d3 = commands.registerCommand('o.restore', () => dnxRestoreForAll(server));
let d4 = commands.registerCommand('o.execute', () => dnxExecuteCommand(server));
let d5 = commands.registerCommand('o.execute-last-command', () => dnxExecuteLastCommand(server));
let d6 = commands.registerCommand('o.showOutput', () => server.getChannel().show(ViewColumn.Three));
return Disposable.from(d1, d2, d3, d4, d5, d6);
}
function pickProjectAndStart(server: OmnisharpServer) {
return findLaunchTargets().then(targets => {
let currentPath = server.getSolutionPathOrFolder();
if (currentPath) {
for (let target of targets) {
if (target.target.fsPath === currentPath) {
target.label = `\u2713 ${target.label}`;
}
}
}
return window.showQuickPick(targets, {
matchOnDescription: true,
placeHolder: `Select 1 of ${targets.length} projects`
}).then(target => {
if (target) {
return server.restart(target.target.fsPath);
}
});
});
}
interface Command {
label: string;
description: string;
execute(): Thenable<any>;
}
let lastCommand: Command;
function dnxExecuteLastCommand(server: OmnisharpServer) {
if (lastCommand) {
lastCommand.execute();
} else {
dnxExecuteCommand(server);
}
}
function dnxExecuteCommand(server: OmnisharpServer) {
if (!server.isRunning()) {
return Promise.reject('OmniSharp server is not running.');
}
return server.makeRequest<proto.WorkspaceInformationResponse>(proto.Projects).then(info => {
let commands: Command[] = [];
info.Dnx.Projects.forEach(project => {
Object.keys(project.Commands).forEach(key => {
commands.push({
label: `dnx ${key} - (${project.Name || basename(project.Path)})`,
description: dirname(project.Path),
execute() {
lastCommand = this;
let command = join(info.Dnx.RuntimePath, 'bin/dnx');
let args = [key];
// dnx-beta[1-6] needs a leading dot, like 'dnx . run'
if (/-beta[1-6]/.test(info.Dnx.RuntimePath)) {
args.unshift('.');
}
if (isWin) {
command += '.exe';
}
return runInTerminal(command, args, {
cwd: dirname(project.Path),
env: {
// KRE_COMPILATION_SERVER_PORT: workspace.DesignTimeHostPort
}
});
}
});
});
});
return window.showQuickPick(commands).then(command => {
if (command) {
return command.execute();
}
});
});
}
export function dnxRestoreForAll(server: OmnisharpServer) {
if (!server.isRunning()) {
return Promise.reject('OmniSharp server is not running.');
}
return server.makeRequest<proto.WorkspaceInformationResponse>(proto.Projects).then(info => {
let commands:Command[] = [];
info.Dnx.Projects.forEach(project => {
commands.push({
label: `dnu restore - (${project.Name || basename(project.Path)})`,
description: dirname(project.Path),
execute() {
let command = join(info.Dnx.RuntimePath, 'bin/dnu');
if (isWin) {
command += '.cmd';
}
return runInTerminal(command, ['restore'], {
cwd: dirname(project.Path)
});
}
});
});
return window.showQuickPick(commands).then(command => {
if(command) {
return command.execute();
}
});
});
}
export function dnxRestoreForProject(server: OmnisharpServer, fileName: string) {
return server.makeRequest<proto.WorkspaceInformationResponse>(proto.Projects).then((info):Promise<any> => {
for(let project of info.Dnx.Projects) {
if (project.Path === fileName) {
let command = join(info.Dnx.RuntimePath, 'bin/dnu');
if (isWin) {
command += '.cmd';
}
return runInTerminal(command, ['restore'], {
cwd: dirname(project.Path)
});
}
}
return Promise.reject(`Failed to execute restore, try to run 'dnu restore' manually for ${fileName}.`)
});
}

View file

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {plain} from './documentation';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
import {createRequest} from '../typeConvertion';
import {CompletionItemProvider, CompletionItem, CompletionItemKind, Uri, CancellationToken, TextDocument, Range, Position} from 'vscode';
export default class OmniSharpCompletionItemProvider extends AbstractSupport implements CompletionItemProvider {
public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise<CompletionItem[]> {
let wordToComplete = '';
let range = document.getWordRangeAtPosition(position);
if (range) {
wordToComplete = document.getText(new Range(range.start, position));
}
let req = createRequest<proto.AutoCompleteRequest>(document, position);
req.WordToComplete = wordToComplete;
req.WantDocumentationForEveryCompletionResult = true;
req.WantKind = true;
return this._server.makeRequest<proto.AutoCompleteResponse[]>(proto.AutoComplete, req).then(values => {
if (!values) {
return;
}
let result: CompletionItem[] = [];
let completions: { [c: string]: CompletionItem[] } = Object.create(null);
// transform AutoCompleteResponse to CompletionItem and
// group by code snippet
for (let value of values) {
let completion = new CompletionItem(value.CompletionText.replace(/\(|\)|<|>/g, ''));
completion.detail = value.DisplayText;
completion.documentation = plain(value.Description);
completion.kind = _kinds[value.Kind] || CompletionItemKind.Property;
let array = completions[completion.label];
if (!array) {
completions[completion.label] = [completion];
} else {
array.push(completion);
}
}
// per suggestion group, select on and indicate overloads
for (let key in completions) {
let suggestion = completions[key][0],
overloadCount = completions[key].length - 1;
if (overloadCount === 0) {
// remove non overloaded items
delete completions[key];
} else {
// indicate that there is more
suggestion.detail = `${suggestion.detail} (+ ${overloadCount} overload(s))`;
}
result.push(suggestion);
}
return result;
});
}
}
var _kinds: { [kind: string]: CompletionItemKind; } = Object.create(null);
_kinds['Variable'] = CompletionItemKind.Variable;
_kinds['Struct'] = CompletionItemKind.Interface;
_kinds['Interface'] = CompletionItemKind.Interface;
_kinds['Enum'] = CompletionItemKind.Enum;
_kinds['EnumMember'] = CompletionItemKind.Property;
_kinds['Property'] = CompletionItemKind.Property;
_kinds['Class'] = CompletionItemKind.Class;
_kinds['Field'] = CompletionItemKind.Field;
_kinds['EventField'] = CompletionItemKind.File;
_kinds['Method'] = CompletionItemKind.Method;

View file

@ -1,25 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {createRequest, toLocation} from '../typeConvertion';
import {Uri, TextDocument, Position, Location, CancellationToken, DefinitionProvider} from 'vscode';
export default class CSharpDefinitionProvider extends AbstractSupport implements DefinitionProvider {
public provideDefinition(document: TextDocument, position: Position, token: CancellationToken): Promise<Location> {
let req = createRequest(document, position);
return this._server.makeRequest<Protocol.ResourceLocation>(Protocol.GoToDefinition, req, token).then(value => {
if (value && value.FileName) {
return toLocation(value);
}
});
}
}

View file

@ -1,232 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {OmnisharpServer} from '../omnisharpServer';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
import {createRequest, toRange} from '../typeConvertion';
import {Disposable, Uri, CancellationTokenSource, TextDocument, TextDocumentChangeEvent, Range, Diagnostic, DiagnosticSeverity, Location, workspace, languages} from 'vscode';
export class Advisor {
private _disposable: Disposable;
private _server: OmnisharpServer;
private _packageRestoreCounter: number = 0;
private _projectSourceFileCounts: { [path: string]: number } = Object.create(null);
constructor(server: OmnisharpServer) {
this._server = server;
let d1 = server.onProjectChange(this._onProjectChange, this);
let d2 = server.onBeforePackageRestore(this._onBeforePackageRestore, this);
let d3 = server.onPackageRestore(this._onPackageRestore, this);
this._disposable = Disposable.from(d1, d2, d3);
}
public dispose() {
this._disposable.dispose();
}
public shouldValidateFiles(): boolean {
return this._isServerStarted()
&& !this._isRestoringPackages();
}
public shouldValidateProject(): boolean {
return this._isServerStarted()
&& !this._isRestoringPackages()
&& !this._isHugeProject();
}
private _onProjectChange(info: proto.ProjectInformationResponse): void {
if (info.DnxProject && info.DnxProject.SourceFiles) {
this._projectSourceFileCounts[info.DnxProject.Path] = info.DnxProject.SourceFiles.length;
}
if (info.MsBuildProject && info.MsBuildProject.SourceFiles) {
this._projectSourceFileCounts[info.MsBuildProject.Path] = info.MsBuildProject.SourceFiles.length;
}
}
private _onBeforePackageRestore(): void {
this._packageRestoreCounter += 1;
}
private _onPackageRestore(): void {
this._packageRestoreCounter -= 1;
}
private _isServerStarted(): boolean {
return this._server.isRunning();
}
private _isRestoringPackages(): boolean {
return this._packageRestoreCounter > 0;
}
private _isHugeProject(): boolean {
var sourceFileCount = 0;
for (var key in this._projectSourceFileCounts) {
sourceFileCount += this._projectSourceFileCounts[key];
if (sourceFileCount > 1000) {
return true;
}
}
return false;
}
}
export default function reportDiagnostics(server: OmnisharpServer, advisor: Advisor): Disposable {
return new DiagnosticsProvider(server, advisor);
}
class DiagnosticsProvider extends AbstractSupport {
private _validationAdvisor: Advisor;
private _disposable: Disposable;
private _documentValidations: { [uri: string]: CancellationTokenSource } = Object.create(null);
private _projectValidation: CancellationTokenSource;
private _diagnostics: vscode.DiagnosticCollection;
constructor(server: OmnisharpServer, validationAdvisor: Advisor) {
super(server);
this._validationAdvisor = validationAdvisor;
this._diagnostics = languages.createDiagnosticCollection('omnisharp');
let d1 = this._server.onPackageRestore(this._validateProject, this);
let d2 = this._server.onProjectChange(this._validateProject, this);
let d4 = workspace.onDidOpenTextDocument(event => this._onDocumentAddOrChange(event), this);
let d3 = workspace.onDidChangeTextDocument(event => this._onDocumentAddOrChange(event.document), this);
let d5 = workspace.onDidCloseTextDocument(this._onDocumentRemove, this);
this._disposable = Disposable.from(this._diagnostics, d1, d2, d3, d4, d5);
}
public dispose(): void {
if (this._projectValidation) {
this._projectValidation.dispose();
}
for (let key in this._documentValidations) {
this._documentValidations[key].dispose();
}
this._disposable.dispose();
}
private _onDocumentAddOrChange(document: TextDocument): void {
if (document.languageId === 'csharp' && document.uri.scheme === 'file') {
this._validateDocument(document);
this._validateProject();
}
}
private _onDocumentRemove(document: TextDocument) {
let key = document.uri.toString();
let didChange = false;
if (this._diagnostics[key]) {
didChange = true;
this._diagnostics[key].dispose();
delete this._diagnostics[key];
}
if (this._documentValidations[key]) {
didChange = true;
this._documentValidations[key].cancel();
delete this._documentValidations[key];
}
if (didChange) {
this._validateProject();
}
}
private _validateDocument(document: TextDocument): void {
if (!this._validationAdvisor.shouldValidateFiles()) {
return;
}
let key = document.uri.toString();
if (this._documentValidations[key]) {
this._documentValidations[key].cancel();
}
let source = new CancellationTokenSource();
let handle = setTimeout(() => {
let req: proto.Request = { Filename: document.fileName };
this._server.makeRequest<proto.QuickFixResponse>(proto.CodeCheck, req, source.token).then(value => {
// (re)set new diagnostics for this document
let diagnostics = value.QuickFixes.map(DiagnosticsProvider._asDiagnostic);
this._diagnostics.set(document.uri, diagnostics);
});
}, 750);
source.token.onCancellationRequested(() => clearTimeout(handle));
this._documentValidations[key] = source;
}
private _validateProject(): void {
if (!this._validationAdvisor.shouldValidateProject()) {
return;
}
if (this._projectValidation) {
this._projectValidation.cancel();
}
this._projectValidation = new CancellationTokenSource();
let handle = setTimeout(() => {
this._server.makeRequest<proto.QuickFixResponse>(proto.CodeCheck, {}, this._projectValidation.token).then(value => {
let quickFixes = value.QuickFixes.sort((a, b) => a.FileName.localeCompare(b.FileName));
let entries: [Uri, Diagnostic[]][] = [];
let lastEntry: [Uri, Diagnostic[]];
for (let quickFix of quickFixes) {
let diag = DiagnosticsProvider._asDiagnostic(quickFix);
let uri = Uri.file(quickFix.FileName);
if (lastEntry && lastEntry[0].toString() === uri.toString()) {
lastEntry[1].push(diag);
} else {
lastEntry = [uri, [diag]];
entries.push(lastEntry);
}
}
// replace all entries
this._diagnostics.set(entries);
});
}, 3000);
// clear timeout on cancellation
this._projectValidation.token.onCancellationRequested(() => {
clearTimeout(handle);
});
}
// --- data converter
private static _asDiagnostic(quickFix: proto.QuickFix): Diagnostic {
let severity = DiagnosticsProvider._asDiagnosticSeverity(quickFix.LogLevel);
let message = `${quickFix.Text} [${quickFix.Projects.map(n => DiagnosticsProvider._asProjectLabel(n)).join(', ') }]`;
return new Diagnostic(toRange(quickFix), message, severity);
}
private static _asDiagnosticSeverity(logLevel: string): DiagnosticSeverity {
switch (logLevel.toLowerCase()) {
case 'hidden':
case 'warning':
case 'warn':
return DiagnosticSeverity.Warning;
default:
return DiagnosticSeverity.Error;
}
}
private static _asProjectLabel(projectName: string): string {
var idx = projectName.indexOf('+');
return projectName.substr(idx + 1);
}
}

View file

@ -1,31 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
import {createRequest, toRange} from '../typeConvertion';
import {DocumentHighlightProvider, DocumentHighlight, DocumentHighlightKind, Uri, CancellationToken, TextDocument, Position, Range} from 'vscode';
export default class OmnisharpDocumentHighlightProvider extends AbstractSupport implements DocumentHighlightProvider {
public provideDocumentHighlights(resource: TextDocument, position: Position, token: CancellationToken): Promise<DocumentHighlight[]> {
let req = createRequest<proto.FindUsagesRequest>(resource, position);
req.OnlyThisFile = true;
req.ExcludeDefinition = false;
return this._server.makeRequest<proto.QuickFixResponse>(proto.FindUsages, req, token).then(res => {
if (res && Array.isArray(res.QuickFixes)) {
return res.QuickFixes.map(OmnisharpDocumentHighlightProvider._asDocumentHighlight);
}
});
}
private static _asDocumentHighlight(quickFix: proto.QuickFix): DocumentHighlight {
return new DocumentHighlight(toRange(quickFix), DocumentHighlightKind.Read);
}
}

View file

@ -1,28 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {toDocumentSymbol} from '../typeConvertion';
import {DocumentSymbolProvider, SymbolInformation, SymbolKind, Uri, TextDocument, Range, CancellationToken} from 'vscode';
export default class OmnisharpDocumentSymbolProvider extends AbstractSupport implements DocumentSymbolProvider {
public provideDocumentSymbols(document: TextDocument, token: CancellationToken): Promise<SymbolInformation[]> {
return this._server.makeRequest<Protocol.CurrentFileMembersAsTreeResponse>(Protocol.CurrentFileMembersAsTree, {Filename: document.fileName}, token).then(tree => {
var ret: SymbolInformation[] = [];
for (let node of tree.TopLevelTypeDefinitions) {
toDocumentSymbol(ret, node);
}
return ret;
});
}
}

View file

@ -1,52 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
import {Uri, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, FormattingOptions, CancellationToken, TextEdit, TextDocument, Range, Position} from 'vscode';
export default class FormattingSupport extends AbstractSupport implements DocumentRangeFormattingEditProvider {
public provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): Promise<TextEdit[]> {
let request = <proto.FormatRangeRequest>{
Filename: document.fileName,
Line: range.start.line + 1,
Column: range.start.character + 1,
EndLine: range.end.line + 1,
EndColumn: range.end.character + 1
};
return this._server.makeRequest<proto.FormatRangeResponse>(proto.FormatRange, request, token).then(res => {
if (res && Array.isArray(res.Changes)) {
return res.Changes.map(FormattingSupport._asEditOptionation);
}
});
}
public provideOnTypeFormattingEdits(document: TextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): Promise<TextEdit[]> {
let request = <proto.FormatAfterKeystrokeRequest> {
Filename: document.fileName,
Line: position.line + 1,
Column: position.character + 1,
Character: ch
};
return this._server.makeRequest<proto.FormatRangeResponse>(proto.FormatAfterKeystroke, request, token).then(res => {
if (res && Array.isArray(res.Changes)) {
return res.Changes.map(FormattingSupport._asEditOptionation);
}
});
}
private static _asEditOptionation(change: proto.TextChange): TextEdit {
return new TextEdit(
new Range(change.StartLine - 1, change.StartColumn - 1, change.EndLine - 1, change.EndColumn - 1),
change.NewText);
}
}

View file

@ -1,28 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {plain} from './documentation';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {createRequest} from '../typeConvertion';
import {HoverProvider, Hover, TextDocument, CancellationToken, Range, Position} from 'vscode';
export default class OmniSharpHoverProvider extends AbstractSupport implements HoverProvider {
public provideHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover> {
let req = createRequest<Protocol.TypeLookupRequest>(document, position);
req.IncludeDocumentation = true;
return this._server.makeRequest<Protocol.TypeLookupResponse>(Protocol.TypeLookup, req, token).then(value => {
if (value && value.Type) {
let contents = [plain(value.Documentation), { language: 'csharp', value: value.Type }];
return new Hover(contents);
}
});
}
}

View file

@ -1,259 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import {OmnisharpServer} from '../omnisharpServer';
import {dnxRestoreForProject} from './commands';
import {basename} from 'path';
import * as proto from '../protocol';
export default function reportStatus(server: OmnisharpServer) {
return vscode.Disposable.from(
reportServerStatus(server),
forwardOutput(server),
reportDocumentStatus(server));
}
// --- document status
let defaultSelector: vscode.DocumentSelector = [
'csharp', // c#-files OR
{ pattern: '**/project.json' }, // project.json-files OR
{ pattern: '**/*.sln' }, // any solution file OR
{ pattern: '**/*.csproj' } // an csproj file
];
class Status {
selector: vscode.DocumentSelector;
text: string;
command: string;
color: string;
constructor(selector: vscode.DocumentSelector) {
this.selector = selector;
}
}
export function reportDocumentStatus(server: OmnisharpServer): vscode.Disposable {
let disposables: vscode.Disposable[] = [];
let entry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, Number.MIN_VALUE);
let defaultStatus = new Status(defaultSelector);
let projectStatus: Status;
function render() {
if (!vscode.window.activeTextEditor) {
entry.hide();
return;
}
let document = vscode.window.activeTextEditor.document;
let status: Status;
if (projectStatus && vscode.languages.match(projectStatus.selector, document)) {
status = projectStatus;
} else if (defaultStatus.text && vscode.languages.match(defaultStatus.selector, document)) {
status = defaultStatus;
}
if (status) {
entry.text = status.text;
entry.command = status.command;
entry.color = status.color;
entry.show();
return;
}
entry.hide();
}
disposables.push(vscode.window.onDidChangeActiveTextEditor(render));
disposables.push(server.onServerError(err => {
defaultStatus.text = '$(flame) Error starting OmniSharp';
defaultStatus.command = 'o.showOutput';
defaultStatus.color = '';
render();
}));
disposables.push(server.onMultipleLaunchTargets(targets => {
defaultStatus.text = '$(flame) Select project';
defaultStatus.command = 'o.pickProjectAndStart';
defaultStatus.color = 'rgb(90, 218, 90)';
render();
}));
disposables.push(server.onBeforeServerStart(path => {
defaultStatus.text = '$(flame) Starting...';
defaultStatus.command = 'o.showOutput';
defaultStatus.color = '';
render();
}));
disposables.push(server.onServerStop(() => {
projectStatus = undefined;
defaultStatus.text = undefined;
}));
disposables.push(server.onServerStart(path => {
defaultStatus.text = '$(flame) Running';
defaultStatus.command = 'o.pickProjectAndStart';
defaultStatus.color = '';
render();
function updateProjectInfo() {
server.makeRequest<proto.WorkspaceInformationResponse>(proto.Projects).then(info => {
let fileNames: vscode.DocumentSelector[] = [];
let label: string;
// show sln-file if applicable
if (info.MSBuild.SolutionPath) {
label = basename(info.MSBuild.SolutionPath)//workspace.getRelativePath(info.MSBuild.SolutionPath);
fileNames.push({ pattern: info.MSBuild.SolutionPath });
for (let project of info.MSBuild.Projects) {
fileNames.push({ pattern: project.Path });
for (let sourceFile of project.SourceFiles) {
fileNames.push({ pattern: sourceFile });
}
}
}
// show dnx projects if applicable
let count = 0;
for (let project of info.Dnx.Projects) {
count += 1;
fileNames.push({ pattern: project.Path });
for (let sourceFile of project.SourceFiles) {
fileNames.push({ pattern: sourceFile });
}
}
if (label) {
// we already have a message from a sln-file
} else if (count === 1) {
label = basename(info.Dnx.Projects[0].Path)//workspace.getRelativePath(info.Dnx.Projects[0].Path);
} else {
label = `${count} projects`;
}
// set project info
projectStatus = new Status(fileNames);
projectStatus.text = '$(flame) ' + label;
projectStatus.command = 'o.pickProjectAndStart';
// default is to change project
defaultStatus.text = '$(flame) Switch projects';
defaultStatus.command = 'o.pickProjectAndStart';
render();
});
}
disposables.push(server.onProjectAdded(updateProjectInfo));
disposables.push(server.onProjectChange(updateProjectInfo));
disposables.push(server.onProjectRemoved(updateProjectInfo));
}));
return vscode.Disposable.from(...disposables);
}
// ---- server status
export function reportServerStatus(server: OmnisharpServer): vscode.Disposable{
function appendLine(value: string = '') {
server.getChannel().appendLine(value);
}
let d0 = server.onServerError(err => {
appendLine('[ERROR] ' + err);
});
let d1 = server.onError(message => {
if (message.FileName) {
appendLine(`${message.FileName}(${message.Line},${message.Column})`);
}
appendLine(message.Text);
appendLine();
showMessageSoon();
});
let d2 = server.onMsBuildProjectDiagnostics(message => {
function asErrorMessage(message: proto.MSBuildDiagnosticsMessage) {
let value = `${message.FileName}(${message.StartLine},${message.StartColumn}): Error: ${message.Text}`;
appendLine(value);
}
function asWarningMessage(message: proto.MSBuildDiagnosticsMessage) {
let value = `${message.FileName}(${message.StartLine},${message.StartColumn}): Warning: ${message.Text}`;
appendLine(value);
}
if (message.Errors.length > 0 || message.Warnings.length > 0) {
appendLine(message.FileName);
message.Errors.forEach(error => asErrorMessage);
message.Warnings.forEach(warning => asWarningMessage);
appendLine();
showMessageSoon();
}
});
let d3 = server.onUnresolvedDependencies(message => {
let info = `There are unresolved dependencies from '${vscode.workspace.asRelativePath(message.FileName) }'. Please execute the restore command to continue.`;
return vscode.window.showInformationMessage(info, 'Restore').then(value => {
if (value) {
dnxRestoreForProject(server, message.FileName);
}
});
});
return vscode.Disposable.from(d0, d1, d2, d3);
}
// show user message
let _messageHandle: number;
function showMessageSoon() {
clearTimeout(_messageHandle);
_messageHandle = setTimeout(function() {
let message = "Some projects have trouble loading. Please review the output for more details.";
vscode.window.showWarningMessage(message, { title: "Show Output", command: 'o.showOutput' }).then(value => {
if (value) {
vscode.commands.executeCommand(value.command);
}
});
}, 1500);
}
// --- mirror output in channel
function forwardOutput(server: OmnisharpServer) {
const logChannel = server.getChannel();
const timing200Pattern = /^\[INFORMATION:OmniSharp.Middleware.LoggingMiddleware\] \/\w+: 200 \d+ms/;
function forward(message: string) {
// strip stuff like: /codecheck: 200 339ms
if(!timing200Pattern.test(message)) {
logChannel.append(message);
}
}
return vscode.Disposable.from(
server.onStdout(forward),
server.onStderr(forward));
}

View file

@ -1,27 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {createRequest, toLocation} from '../typeConvertion';
import {ReferenceProvider, Location, Range, TextDocument, Uri, CancellationToken, Position} from 'vscode';
export default class OmnisharpReferenceProvider extends AbstractSupport implements ReferenceProvider {
public provideReferences(document: TextDocument, position: Position, options: { includeDeclaration: boolean;}, token: CancellationToken): Promise<Location[]> {
let req = createRequest<Protocol.FindUsagesRequest>(document, position);
req.OnlyThisFile = false;
req.ExcludeDefinition = false;
return this._server.makeRequest<Protocol.QuickFixResponse>(Protocol.FindUsages, req, token).then(res => {
if (res && Array.isArray(res.QuickFixes)) {
return res.QuickFixes.map(toLocation);
}
});
}
}

View file

@ -1,40 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as proto from '../protocol';
import {createRequest, toRange} from '../typeConvertion';
import {RenameProvider, TextEdit, WorkspaceEdit, TextDocument, Uri, CancellationToken, Position, Range} from 'vscode';
export default class OmnisharpRenameProvider extends AbstractSupport implements RenameProvider {
public provideRenameEdits(document: TextDocument, position: Position, newName: string, token: CancellationToken): Promise<WorkspaceEdit> {
let request = createRequest<proto.RenameRequest>(document, position);
request.WantsTextChanges = true,
request.RenameTo = newName;
return this._server.makeRequest<proto.RenameResponse>(proto.Rename, request, token).then(response => {
if (!response) {
return;
}
const edit = new WorkspaceEdit();
response.Changes.forEach(change => {
const uri = Uri.file(change.FileName);
change.Changes.forEach(change => {
edit.replace(uri,
new Range(change.StartLine - 1, change.StartColumn - 1, change.EndLine - 1, change.EndColumn - 1),
change.NewText);
});
});
return edit;
});
}
}

View file

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {createRequest} from '../typeConvertion';
import {SignatureHelpProvider, SignatureHelp, SignatureInformation, ParameterInformation, Uri, CancellationToken, TextDocument, Position} from 'vscode';
export default class OmniSharpSignatureHelpProvider extends AbstractSupport implements SignatureHelpProvider {
public provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): Promise<SignatureHelp> {
let req = createRequest(document, position);
return this._server.makeRequest<Protocol.SignatureHelp>(Protocol.SignatureHelp, req, token).then(res => {
let ret = new SignatureHelp();
ret.activeSignature = res.ActiveSignature;
ret.activeParameter = res.ActiveParameter;
for(let signature of res.Signatures) {
let signatureInfo = new SignatureInformation(signature.Label, signature.Documentation);
ret.signatures.push(signatureInfo);
for (let parameter of signature.Parameters) {
let parameterInfo = new ParameterInformation(
parameter.Label,
parameter.Documentation);
signatureInfo.parameters.push(parameterInfo);
}
}
return ret;
});
}
}

View file

@ -1,45 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AbstractSupport from './abstractProvider';
import * as Protocol from '../protocol';
import {createRequest, toRange} from '../typeConvertion';
import {CancellationToken, Uri, Range, WorkspaceSymbolProvider, SymbolInformation, SymbolKind} from 'vscode';
export default class OmnisharpWorkspaceSymbolProvider extends AbstractSupport implements WorkspaceSymbolProvider {
public provideWorkspaceSymbols(search: string, token: CancellationToken): Promise<SymbolInformation[]> {
return this._server.makeRequest<Protocol.FindSymbolsResponse>(Protocol.FindSymbols, <Protocol.FindSymbolsRequest> {
Filter: search,
Filename: ''
}, token).then(res => {
if (res && Array.isArray(res.QuickFixes)) {
return res.QuickFixes.map(OmnisharpWorkspaceSymbolProvider._asSymbolInformation);
}
});
}
private static _asSymbolInformation(symbolInfo: Protocol.SymbolLocation): SymbolInformation {
return new SymbolInformation(symbolInfo.Text, OmnisharpWorkspaceSymbolProvider._toKind(symbolInfo),
toRange(symbolInfo),
Uri.file(symbolInfo.FileName));
}
private static _toKind(symbolInfo: Protocol.SymbolLocation): SymbolKind {
switch (symbolInfo.Kind) {
case 'Method':
return SymbolKind.Method;
case 'Field':
case 'Property':
return SymbolKind.Field;
}
return SymbolKind.Class;
}
}

View file

@ -1,82 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as paths from 'path';
import {EventEmitter} from 'events';
import {Uri, workspace} from 'vscode';
export interface LaunchTarget {
label: string;
description: string;
directory: Uri;
resource: Uri;
target: Uri;
}
export default function getLaunchTargets(): Thenable<LaunchTarget[]> {
return workspace.findFiles('{**/*.sln,**/*.csproj,**/project.json}', '{**/node_modules/**,**/.git/**,**/bower_components/**}', 100).then(resources => {
return select(resources, Uri.file(workspace.rootPath));
});
}
function select(resources: Uri[], root: Uri): LaunchTarget[] {
if (!Array.isArray(resources)) {
return [];
}
var targets: LaunchTarget[] = [],
hasCsProjFiles = false,
hasProjectJson = false,
hasProjectJsonAtRoot = false;
hasCsProjFiles = resources
.some(resource => /\.csproj$/.test(resource.fsPath));
resources.forEach(resource => {
// sln files
if (hasCsProjFiles && /\.sln$/.test(resource.fsPath)) {
targets.push({
label: paths.basename(resource.fsPath),
description: workspace.asRelativePath(paths.dirname(resource.fsPath)),
resource,
target: resource,
directory: Uri.file(paths.dirname(resource.fsPath))
});
}
// project.json files
if (/project.json$/.test(resource.fsPath)) {
var dirname = paths.dirname(resource.fsPath);
hasProjectJson = true;
hasProjectJsonAtRoot = hasProjectJsonAtRoot || dirname === root.fsPath;
targets.push({
label: paths.basename(resource.fsPath),
description: workspace.asRelativePath(paths.dirname(resource.fsPath)),
resource,
target: Uri.file(dirname),
directory: Uri.file(dirname)
});
}
});
if (hasProjectJson && !hasProjectJsonAtRoot) {
targets.push({
label: paths.basename(root.fsPath),
description: '',
resource: root,
target: root,
directory: root
});
}
return targets.sort((a, b) => a.directory.fsPath.localeCompare(b.directory.fsPath));
}

View file

@ -1,82 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import DefinitionProvider from './features/definitionProvider';
import CodeLensProvider from './features/codeLensProvider';
import DocumentHighlightProvider from './features/documentHighlightProvider';
import DocumentSymbolProvider from './features/documentSymbolProvider';
import CodeActionProvider from './features/codeActionProvider';
import ReferenceProvider from './features/referenceProvider';
import HoverProvider from './features/hoverProvider';
import RenameProvider from './features/renameProvider';
import FormatProvider from './features/formattingEditProvider';
import CompletionItemProvider from './features/completionItemProvider';
import WorkspaceSymbolProvider from './features/workspaceSymbolProvider';
import reportDiagnostics,{Advisor} from './features/diagnosticsProvider';
import SignatureHelpProvider from './features/signatureHelpProvider';
import registerCommands from './features/commands';
import {StdioOmnisharpServer} from './omnisharpServer';
import forwardChanges from './features/changeForwarding';
import reportStatus from './features/omnisharpStatus';
import findLaunchTargets from './launchTargetFinder';
import {Disposable, ExtensionContext, languages, extensions} from 'vscode';
export function activate(context: ExtensionContext): any {
const _selector: vscode.DocumentSelector = {
language: 'csharp',
scheme: 'file' // only files from disk
};
const server = new StdioOmnisharpServer();
let advisor = new Advisor(server);
let disposables: Disposable[] = [];
let localDisposables: Disposable[] = [];
disposables.push(server.onServerStart(() => {
// register language feature provider on start
localDisposables.push(languages.registerDefinitionProvider(_selector, new DefinitionProvider(server)));
localDisposables.push(languages.registerCodeLensProvider(_selector, new CodeLensProvider(server)));
localDisposables.push(languages.registerDocumentHighlightProvider(_selector, new DocumentHighlightProvider(server)));
localDisposables.push(languages.registerDocumentSymbolProvider(_selector, new DocumentSymbolProvider(server)));
localDisposables.push(languages.registerReferenceProvider(_selector, new ReferenceProvider(server)));
localDisposables.push(languages.registerHoverProvider(_selector, new HoverProvider(server)));
localDisposables.push(languages.registerRenameProvider(_selector, new RenameProvider(server)));
localDisposables.push(languages.registerDocumentRangeFormattingEditProvider(_selector, new FormatProvider(server)));
localDisposables.push(languages.registerOnTypeFormattingEditProvider(_selector, new FormatProvider(server), '}', ';'));
localDisposables.push(languages.registerCompletionItemProvider(_selector, new CompletionItemProvider(server), '.', '<'));
localDisposables.push(languages.registerWorkspaceSymbolProvider(new WorkspaceSymbolProvider(server)));
localDisposables.push(languages.registerSignatureHelpProvider(_selector, new SignatureHelpProvider(server), '(', ','));
let codeActionProvider = new CodeActionProvider(server);
localDisposables.push(codeActionProvider);
localDisposables.push(languages.registerCodeActionsProvider(_selector, codeActionProvider));
localDisposables.push(reportDiagnostics(server, advisor));
localDisposables.push(forwardChanges(server));
}));
disposables.push(server.onServerStop(() => {
// remove language feature providers on stop
Disposable.from(...localDisposables).dispose();
}));
disposables.push(registerCommands(server));
disposables.push(reportStatus(server));
// read and store last solution or folder path
server.autoStart(context.workspaceState.get<string>('lastSolutionPathOrFolder'));
server.onBeforeServerStart(path => context.workspaceState.update('lastSolutionPathOrFolder', path));
// stop server on deactivate
disposables.push(new Disposable(() => {
advisor.dispose();
server.stop();
}));
context.subscriptions.push(...disposables);
}

View file

@ -1,507 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {EventEmitter} from 'events';
import {ChildProcess, exec} from 'child_process';
import {request} from 'http';
import {dirname} from 'path';
import {ReadLine, createInterface} from 'readline';
import omnisharpLauncher from './omnisharpServerLauncher';
import {Disposable, CancellationToken, OutputChannel, workspace, window} from 'vscode';
import {ErrorMessage, UnresolvedDependenciesMessage, MSBuildProjectDiagnostics, ProjectInformationResponse} from './protocol';
import getLaunchTargets, {LaunchTarget} from './launchTargetFinder';
enum ServerState {
Starting,
Started,
Stopped
}
interface Request {
path: string;
data?: any;
onSuccess: Function;
onError: Function;
_enqueued: number;
}
export abstract class OmnisharpServer {
private _eventBus = new EventEmitter();
private _start: Promise<void>;
private _state: ServerState = ServerState.Stopped;
private _solutionPath: string;
private _queue: Request[] = [];
private _isProcessingQueue = false;
private _channel: OutputChannel;
protected _serverProcess: ChildProcess;
protected _extraArgv: string[];
constructor() {
this._extraArgv = [];
this._channel = window.createOutputChannel('OmniSharp Log');
}
public isRunning(): boolean {
return this._state === ServerState.Started;
}
private _getState(): ServerState {
return this._state;
}
private _setState(value: ServerState) : void {
if (typeof value !== 'undefined' && value !== this._state) {
this._state = value;
this._fireEvent('stateChanged', this._state);
}
}
public getSolutionPathOrFolder(): string {
return this._solutionPath;
}
public getChannel(): vscode.OutputChannel {
return this._channel;
}
public onStdout(listener: (e: string) => any, thisArg?: any) {
return this._addListener('stdout', listener, thisArg);
}
public onStderr(listener: (e: string) => any, thisArg?: any) {
return this._addListener('stderr', listener, thisArg);
}
public onError(listener: (e: ErrorMessage) => any, thisArg?: any) {
return this._addListener('Error', listener, thisArg);
}
public onServerError(listener: (err: any) => any, thisArg?: any) {
return this._addListener('ServerError', listener, thisArg);
}
public onUnresolvedDependencies(listener: (e: UnresolvedDependenciesMessage) => any, thisArg?:any) {
return this._addListener('UnresolvedDependencies', listener, thisArg);
}
public onBeforePackageRestore(listener: () => any, thisArg?: any) {
return this._addListener('PackageRestoreStarted', listener, thisArg);
}
public onPackageRestore(listener: () => any, thisArg?: any) {
return this._addListener('PackageRestoreFinished', listener, thisArg);
}
public onProjectChange(listener: (e: ProjectInformationResponse) => any, thisArg?: any) {
return this._addListener('ProjectChanged', listener, thisArg);
}
public onProjectAdded(listener: (e: ProjectInformationResponse) => any, thisArg?: any) {
return this._addListener('ProjectAdded', listener, thisArg);
}
public onProjectRemoved(listener: (e: ProjectInformationResponse) => any, thisArg?: any) {
return this._addListener('ProjectRemoved', listener, thisArg);
}
public onMsBuildProjectDiagnostics(listener: (e: MSBuildProjectDiagnostics) => any, thisArg?: any) {
return this._addListener('MsBuildProjectDiagnostics', listener, thisArg);
}
public onBeforeServerStart(listener: (e:string) => any) {
return this._addListener('BeforeServerStart', listener);
}
public onServerStart(listener: (e: string) => any) {
return this._addListener('ServerStart', listener);
}
public onServerStop(listener: () => any) {
return this._addListener('ServerStop', listener);
}
public onMultipleLaunchTargets(listener: (targets: LaunchTarget[]) => any, thisArg?: any) {
return this._addListener('server:MultipleLaunchTargets', listener, thisArg);
}
public onOmnisharpStart(listener: () => any) {
return this._addListener('started', listener);
}
private _addListener(event: string, listener: (e: any) => any, thisArg?: any): Disposable {
listener = thisArg ? listener.bind(thisArg) : listener;
this._eventBus.addListener(event, listener);
return new Disposable(() => this._eventBus.removeListener(event, listener));
}
protected _fireEvent(event: string, args: any): void {
this._eventBus.emit(event, args);
}
public start(solutionPath: string): Promise<void> {
if (!this._start) {
this._start = this._doStart(solutionPath);
}
return this._start;
}
private _doStart(solutionPath: string): Promise<void> {
this._setState(ServerState.Starting);
this._solutionPath = solutionPath;
var cwd = dirname(solutionPath),
argv = ['-s', solutionPath, '--hostPID', process.pid.toString(), 'dnx:enablePackageRestore=false'].concat(this._extraArgv);
this._fireEvent('stdout', `[INFO] Starting OmniSharp at '${solutionPath}'...\n`);
this._fireEvent('BeforeServerStart', solutionPath);
return omnisharpLauncher(cwd, argv).then(value => {
this._serverProcess = value.process;
this._fireEvent('stdout', `[INFO] Started OmniSharp from '${value.command}' with process id ${value.process.pid}...\n`);
return this._doConnect();
}).then(_ => {
this._fireEvent('ServerStart', solutionPath);
this._setState(ServerState.Started);
this._processQueue();
}, err => {
this._fireEvent('ServerError', err);
throw err;
});
}
protected abstract _doConnect(): Promise<OmnisharpServer>;
public stop(): Promise<void> {
var ret: Promise<OmnisharpServer>;
if (!this._serverProcess) {
// nothing to kill
ret = Promise.resolve(undefined);
} else if (/^win/.test(process.platform)) {
// when killing a process in windows its child
// processes are *not* killed but become root
// processes. Therefore we use TASKKILL.EXE
ret = new Promise<OmnisharpServer>((resolve, reject) => {
var killer = exec(`taskkill /F /T /PID ${this._serverProcess.pid}`, function (err, stdout, stderr) {
if (err) {
return reject(err);
}
});
killer.on('exit', resolve);
killer.on('error', reject);
});
} else {
this._serverProcess.kill('SIGTERM');
ret = Promise.resolve(undefined);
}
return ret.then(_ => {
this._start = null;
this._serverProcess = null;
this._setState(ServerState.Stopped);
this._fireEvent('ServerStop', this);
return;
});
}
public restart(solutionPath: string = this._solutionPath): Promise<void> {
if (solutionPath) {
return this.stop().then(() => {
this.start(solutionPath)
});
}
}
public autoStart(preferredPath:string): Thenable<void> {
return getLaunchTargets().then(targets => {
if (targets.length === 0) {
return new Promise<void>((resolve, reject) => {
// 1st watch for files
let watcher = workspace.createFileSystemWatcher('{**/*.sln,**/project.json}', false, true, true);
watcher.onDidCreate(uri => {
watcher.dispose();
resolve();
});
}).then(() => {
// 2nd try again
return this.autoStart(preferredPath);
});
}
if (targets.length > 1) {
for (let target of targets) {
if (target.target.fsPath === preferredPath) {
// start preferred path
return this.restart(preferredPath);
}
}
this._fireEvent('server:MultipleLaunchTargets', targets);
return Promise.reject<void>(undefined);
}
// just start
return this.restart(targets[0].target.fsPath);
});
}
public makeRequest<R>(path: string, data?: any, token?: CancellationToken): Promise<R> {
if (this._getState() !== ServerState.Started) {
return Promise.reject<R>('server has been stopped or not started');
}
let request: Request;
let promise = new Promise<any>((resolve, reject) => {
request = {
path,
data,
onSuccess: resolve,
onError: reject,
_enqueued: Date.now()
};
this._queue.push(request);
// this._statOnRequestStart(request);
if (this._getState() === ServerState.Started && !this._isProcessingQueue) {
this._processQueue();
}
});
if (token) {
token.onCancellationRequested(() => {
let idx = this._queue.indexOf(request);
if (idx !== -1) {
this._queue.splice(idx, 1);
let err = new Error('Canceled');
err.message = 'Canceled';
request.onError(err);
}
});
}
return promise;
}
private _processQueue(): void {
if (this._queue.length === 0) {
// nothing to do
this._isProcessingQueue = false;
return;
}
// signal that we are working on it
this._isProcessingQueue = true;
// send next request and recurse when done
var thisRequest = this._queue.shift();
this._makeNextRequest(thisRequest.path, thisRequest.data).then(value => {
thisRequest.onSuccess(value);
this._processQueue();
// this._statOnRequestEnd(thisRequest, true);
}, err => {
thisRequest.onError(err);
this._processQueue();
// this._statOnRequestEnd(thisRequest, false);
}).catch(err => {
console.error(err);
this._processQueue();
});
}
protected abstract _makeNextRequest(path: string, data: any): Promise<any>;
// private _statOnRequestStart(request: Request): void {
// console.log(`[DEBUG] *enqueuing* request '${request.path}' (queue size is ${this._queue.length})\n`);
// }
// private _statOnRequestEnd(request: Request, successfully: boolean): void {
// var duration = Date.now() - request._enqueued,
// state = successfully ? 'successfully' : 'with errors';
// console.log(`[DEBUG] request '${request.path}' finished *${state}* after ${duration}ms\n`);
// }
}
namespace WireProtocol {
export interface Packet {
Type: string;
Seq: number;
}
export interface RequestPacket extends Packet {
Command: string;
Arguments: any;
}
export interface ResponsePacket extends Packet {
Command: string;
Request_seq: number;
Running: boolean;
Success: boolean;
Message: string;
Body: any;
}
export interface EventPacket extends Packet {
Event: string;
Body: any;
}
}
export class StdioOmnisharpServer extends OmnisharpServer {
private static _seqPool = 1;
private static StartupTimeout = 1000 * 60;
private static ResponsePacketTimeout = 1000 * 60 * 15; // helps debugging
private _rl: ReadLine;
private _activeRequest: { [seq: number]: { onSuccess: Function; onError: Function; } } = Object.create(null);
private _callOnStop: Function[] = [];
constructor() {
super();
// extra argv
this._extraArgv.push('--stdio');
}
public stop(): Promise<void> {
while (this._callOnStop.length) {
this._callOnStop.pop()();
}
return super.stop();
}
protected _doConnect(): Promise<OmnisharpServer> {
this._serverProcess.stderr.on('data', (data: any) => this._fireEvent('stderr', String(data)));
this._rl = createInterface({
input: this._serverProcess.stdout,
output: this._serverProcess.stdin,
terminal: false
});
var p = new Promise<OmnisharpServer>((resolve, reject) => {
var listener: Disposable;
// timeout logic
var handle = setTimeout(() => {
listener && listener.dispose();
reject(new Error('Failed to start OmniSharp'));
}, StdioOmnisharpServer.StartupTimeout);
// handle started-event
listener = this.onOmnisharpStart(() => {
listener && listener.dispose();
clearTimeout(handle);
resolve(this);
});
});
this._startListening();
return p;
}
private _startListening(): void {
var onLineReceived = (line: string) => {
if (line[0] !== '{') {
this._fireEvent('stdout', `${line}\n`);
return;
}
var packet: WireProtocol.Packet;
try {
packet = JSON.parse(line);
} catch (e) {
// not json
return;
}
if (!packet.Type) {
// bogous packet
return;
}
switch (packet.Type) {
case 'response':
this._handleResponsePacket(<WireProtocol.ResponsePacket> packet);
break;
case 'event':
this._handleEventPacket(<WireProtocol.EventPacket> packet);
break;
default:
console.warn('unknown packet: ', packet);
break;
}
};
this._rl.addListener('line', onLineReceived);
this._callOnStop.push(() => this._rl.removeListener('line', onLineReceived));
}
private _handleResponsePacket(packet: WireProtocol.ResponsePacket): void {
var requestSeq = packet.Request_seq,
entry = this._activeRequest[requestSeq];
if (!entry) {
console.warn('Received a response WITHOUT a request', packet);
return;
}
delete this._activeRequest[requestSeq];
if (packet.Success) {
entry.onSuccess(packet.Body);
} else {
entry.onError(packet.Message || packet.Body);
}
}
private _handleEventPacket(packet: WireProtocol.EventPacket): void {
if (packet.Event === 'log') {
// handle log events
var entry = <{ LogLevel: string; Name: string; Message: string; }> packet.Body;
this._fireEvent('stdout', `[${entry.LogLevel}:${entry.Name}] ${entry.Message}\n`);
return;
} else {
// fwd all other events
this._fireEvent(packet.Event, packet.Body);
}
}
protected _makeNextRequest(path: string, data: any): Promise<any> {
var thisRequestPacket: WireProtocol.RequestPacket = {
Type: 'request',
Seq: StdioOmnisharpServer._seqPool++,
Command: path,
Arguments: data
};
return new Promise<any>((c, e) => {
this._activeRequest[thisRequestPacket.Seq] = {
onSuccess: c,
onError: e
};
this._serverProcess.stdin.write(JSON.stringify(thisRequestPacket) + '\n');
});
}
}

View file

@ -1,161 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {exists as fileExists} from 'fs';
import {spawn, ChildProcess} from 'child_process';
import {workspace} from 'vscode';
import {satisfies} from 'semver';
import {join} from 'path';
var omnisharpEnv = 'OMNISHARP';
var isWindows = /^win/.test(process.platform);
export default function launch(cwd: string, args: string[]):Promise < { process: ChildProcess, command: string } > {
return new Promise((resolve, reject) => {
try {
(isWindows ? launchWindows(cwd, args) : launchNix(cwd, args)).then(value => {
// async error - when target not not ENEOT
value.process.on('error', reject);
// success after a short freeing event loop
setTimeout(function () {
resolve(value);
}, 0);
}, err => {
reject(err);
});
} catch (err) {
reject(err);
}
});
}
function launchWindows(cwd: string, args: string[]): Promise<{ process: ChildProcess, command: string }> {
return getOmnisharpPath().then(command => {
args = args.slice(0);
args.unshift(command);
args = [[
'/s',
'/c',
'"' + args.map(arg => /^[^"].* .*[^"]/.test(arg) ? `"${arg}"` : arg).join(' ') + '"'
].join(' ')];
let process = spawn('cmd', args, <any>{
windowsVerbatimArguments: true,
detached: false,
// env: details.env,
cwd: cwd
});
return {
process,
command
};
});
}
function launchNix(cwd: string, args: string[]): Promise<{ process: ChildProcess, command: string }>{
return new Promise((resolve, reject) => {
hasMono('>=4.0.1').then(hasIt => {
if (!hasIt) {
reject(new Error('Cannot start Omnisharp because Mono version >=4.0.1 is required. See http://go.microsoft.com/fwlink/?linkID=534832#_20001'));
} else {
resolve();
}
});
}).then(_ => {
return getOmnisharpPath();
}).then(command => {
let process = spawn(command, args, {
detached: false,
// env: details.env,
cwd
});
return {
process,
command
}
});
}
function getOmnisharpPath(): Promise<string> {
let pathCandidate: string;
let config = workspace.getConfiguration();
if (config.has('csharp.omnisharp')) {
// form config
pathCandidate = config.get<string>('csharp.omnisharp');
} else if (typeof process.env[omnisharpEnv] === 'string') {
// form enviroment variable
console.warn('[deprecated] use workspace or user settings with "csharp.omnisharp":"/path/to/omnisharp"');
pathCandidate = process.env[omnisharpEnv];
} else {
// bundled version of Omnisharp
pathCandidate = join(__dirname, '../bin/omnisharp')
if (isWindows) {
pathCandidate += '.cmd';
}
}
return new Promise<string>((resolve, reject) => {
fileExists(pathCandidate, localExists => {
if (localExists) {
resolve(pathCandidate);
} else {
reject('OmniSharp does not exist at location: ' + pathCandidate);
}
});
});
}
const versionRegexp = /(\d+\.\d+\.\d+)/;
export function hasMono(range?: string): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
let childprocess: ChildProcess;
try {
childprocess = spawn('mono', ['--version']);
} catch (e) {
return resolve(false);
}
childprocess.on('error', function (err: any) {
resolve(false);
});
let stdout = '';
childprocess.stdout.on('data', (data: NodeBuffer) => {
stdout += data.toString();
});
childprocess.stdout.on('close', () => {
let match = versionRegexp.exec(stdout),
ret: boolean;
if (!match) {
ret = false;
} else if (!range) {
ret = true;
} else {
ret = satisfies(match[1], range);
}
resolve(ret);
});
});
}

View file

@ -1,416 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export var GoToDefinition = '/gotoDefinition';
export var CodeCheck = '/codecheck';
export var AutoComplete = '/autocomplete';
export var CurrentFileMembersAsTree = '/currentfilemembersastree';
export var TypeLookup = '/typelookup';
export var AddToProject = '/addtoproject';
export var RemoveFromProject = '/removefromproject';
export var FindUsages = '/findusages';
export var FindSymbols = '/findsymbols';
export var CodeFormat = '/codeformat';
export var GetCodeActions = '/getcodeactions';
export var RunCodeAction = '/runcodeaction';
export var FormatAfterKeystroke = '/formatAfterKeystroke';
export var FormatRange = '/formatRange';
export var UpdateBuffer = '/updatebuffer';
export var ChangeBuffer = '/changebuffer';
export var Projects = '/projects';
export var Rename = '/rename';
export var FilesChanged = '/filesChanged';
export var SignatureHelp = '/signatureHelp';
export interface Request {
Filename: string;
Line?: number;
Column?: number;
Buffer?: string;
}
export interface ChangeBufferRequest {
FileName: string;
StartLine: number;
StartColumn: number;
EndLine: number;
EndColumn: number;
NewText: string;
}
export interface AddToProjectRequest extends Request {
//?
}
export interface RemoveFromProjectRequest extends Request {
//?
}
export interface FindUsagesRequest extends Request {
// MaxWidth: number; ?
OnlyThisFile: boolean;
ExcludeDefinition: boolean;
}
export interface FindSymbolsRequest extends Request {
Filter: string;
}
export interface FormatRequest extends Request {
ExpandTab: boolean;
}
export interface CodeActionRequest extends Request {
CodeAction: number;
WantsTextChanges?: boolean;
SelectionStartColumn?: number;
SelectionStartLine?: number;
SelectionEndColumn?: number;
SelectionEndLine?: number;
}
export interface FormatResponse {
Buffer: string;
}
export interface TextChange {
NewText: string;
StartLine: number;
StartColumn: number;
EndLine: number;
EndColumn: number;
}
export interface FormatAfterKeystrokeRequest extends Request {
Character: string;
}
export interface FormatRangeRequest extends Request {
EndLine: number;
EndColumn: number;
}
export interface FormatRangeResponse {
Changes: TextChange[];
}
export interface ResourceLocation {
FileName: string;
Line: number;
Column: number;
}
export interface Error {
Message: string;
Line: number;
Column: number;
EndLine: number;
EndColumn: number;
FileName: string;
}
export interface ErrorResponse {
Errors: Error[];
}
export interface QuickFix {
LogLevel: string;
FileName: string;
Line: number;
Column: number;
EndLine: number;
EndColumn: number;
Text: string;
Projects: string[];
}
export interface SymbolLocation extends QuickFix {
Kind: string;
}
export interface QuickFixResponse {
QuickFixes: QuickFix[];
}
export interface FindSymbolsResponse {
QuickFixes: SymbolLocation[];
}
export interface TypeLookupRequest extends Request {
IncludeDocumentation: boolean;
}
export interface TypeLookupResponse {
Type: string;
Documentation: string;
}
export interface RunCodeActionResponse {
Text: string;
Changes: TextChange[];
}
export interface GetCodeActionsResponse {
CodeActions: string[];
}
export interface Node {
ChildNodes: Node[];
Location: QuickFix;
Kind: string;
}
export interface CurrentFileMembersAsTreeResponse {
TopLevelTypeDefinitions: Node[];
}
export interface AutoCompleteRequest extends Request {
WordToComplete: string;
WantDocumentationForEveryCompletionResult?: boolean;
WantImportableTypes?: boolean;
WantMethodHeader?: boolean;
WantSnippet?: boolean;
WantReturnType?: boolean;
WantKind?: boolean;
}
export interface AutoCompleteResponse {
CompletionText: string;
Description: string;
DisplayText: string;
RequiredNamespaceImport: string;
MethodHeader: string;
ReturnType: string;
Snippet: string;
Kind: string;
}
export interface ProjectInformationResponse {
MsBuildProject: MSBuildProject;
DnxProject: DnxProject;
}
export interface WorkspaceInformationResponse {
MSBuild: MsBuildWorkspaceInformation;
Dnx: DnxWorkspaceInformation;
ScriptCs: ScriptCsContext;
}
export interface MsBuildWorkspaceInformation {
SolutionPath: string;
Projects: MSBuildProject[];
}
export interface ScriptCsContext {
CsxFiles: { [n: string]: string };
References: { [n: string]: string };
Usings: { [n: string]: string };
ScriptPacks: { [n: string]: string };
Path: string;
}
export interface MSBuildProject {
ProjectGuid: string;
Path: string;
AssemblyName: string;
TargetPath: string;
TargetFramework: string;
SourceFiles: string[];
}
export interface DnxWorkspaceInformation {
RuntimePath: string;
DesignTimeHostPort: number;
Projects: DnxProject[];
}
export interface DnxProject {
Path: string;
Name: string;
Commands: { [name: string]: string; };
Configurations: string[];
ProjectSearchPaths: string[];
Frameworks: DnxFramework[];
GlobalJsonPath: string;
SourceFiles: string[];
}
export interface DnxFramework {
Name: string;
FriendlyName: string;
ShortName: string;
}
export interface RenameRequest extends Request {
RenameTo: string;
WantsTextChanges?: boolean;
}
export interface ModifiedFileResponse {
FileName: string;
Buffer: string;
Changes: TextChange[];
}
export interface RenameResponse {
Changes: ModifiedFileResponse[];
}
export interface SignatureHelp {
Signatures: SignatureHelpItem[];
ActiveSignature: number;
ActiveParameter: number;
}
export interface SignatureHelpItem {
Name: string;
Label: string;
Documentation: string;
Parameters: SignatureHelpParameter[];
}
export interface SignatureHelpParameter {
Name: string;
Label: string;
Documentation: string;
}
export interface MSBuildProjectDiagnostics {
FileName: string;
Warnings: MSBuildDiagnosticsMessage[];
Errors: MSBuildDiagnosticsMessage[];
}
export interface MSBuildDiagnosticsMessage {
LogLevel: string;
FileName: string;
Text: string;
StartLine: number;
StartColumn: number;
EndLine: number;
EndColumn: number;
}
export interface ErrorMessage {
Text: string;
FileName: string;
Line: number;
Column: number;
}
export interface PackageRestoreMessage {
FileName: string;
Succeeded: boolean;
}
export interface UnresolvedDependenciesMessage {
FileName: string;
UnresolvedDependencies: PackageDependency[];
}
export interface PackageDependency {
Name: string;
Version: string;
}
export namespace V2 {
export var GetCodeActions = '/v2/getcodeactions';
export var RunCodeAction = '/v2/runcodeaction';
export interface Point {
Line: number;
Column: number;
}
export interface Range {
Start: Point;
End: Point;
}
export interface GetCodeActionsRequest extends Request {
Selection: Range
}
export interface OmniSharpCodeAction {
Identifier: string;
Name: string;
}
export interface GetCodeActionsResponse {
CodeActions: OmniSharpCodeAction[];
}
export interface RunCodeActionRequest extends Request {
Identifier: string;
Selection: Range;
WantsTextChanges: boolean;
}
export interface RunCodeActionResponse {
Changes: ModifiedFileResponse[];
}
export interface MSBuildProjectDiagnostics {
FileName: string;
Warnings: MSBuildDiagnosticsMessage[];
Errors: MSBuildDiagnosticsMessage[];
}
export interface MSBuildDiagnosticsMessage {
LogLevel: string;
FileName: string;
Text: string;
StartLine: number;
StartColumn: number;
EndLine: number;
EndColumn: number;
}
export interface ErrorMessage {
Text: string;
FileName: string;
Line: number;
Column: number;
}
export interface PackageRestoreMessage {
FileName: string;
Succeeded: boolean;
}
export interface UnresolvedDependenciesMessage {
FileName: string;
UnresolvedDependencies: PackageDependency[];
}
export interface PackageDependency {
Name: string;
Version: string;
}
}

View file

@ -1,72 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as proto from './protocol';
import * as vscode from 'vscode';
export function toLocation(location: proto.ResourceLocation): vscode.Location {
let {FileName, Line, Column} = location;
return new vscode.Location(vscode.Uri.file(FileName), new vscode.Position(Line - 1, Column - 1));
}
export function toRange(rangeLike: { Line: number; Column: number; EndLine: number; EndColumn: number;}): vscode.Range {
let {Line, Column, EndLine, EndColumn} = rangeLike;
return new vscode.Range(Line - 1, Column - 1, EndLine - 1, EndColumn - 1);
}
export function toRange2(rangeLike: { StartLine: number; StartColumn: number; EndLine: number; EndColumn: number;}): vscode.Range {
let {StartLine, StartColumn, EndLine, EndColumn} = rangeLike;
return new vscode.Range(StartLine - 1, StartColumn - 1, EndLine - 1, EndColumn - 1);
}
export function createRequest<T extends proto.Request>(document: vscode.TextDocument, where: vscode.Position | vscode.Range, includeBuffer:boolean = false): T {
let Line: number, Column: number;
if (where instanceof vscode.Position) {
Line = where.line + 1;
Column = where.character + 1;
} else if(where instanceof vscode.Range) {
Line = where.start.line + 1;
Column = where.start.character + 1
}
let request: proto.Request = {
Filename: document.fileName,
Buffer: includeBuffer ? document.getText() : undefined,
Line,
Column
};
return <T>request;
}
export function toDocumentSymbol(bucket: vscode.SymbolInformation[], node: proto.Node, containerLabel?: string): void {
let ret = new vscode.SymbolInformation(node.Location.Text, kinds[node.Kind],
toRange(node.Location),
undefined, containerLabel);
if (node.ChildNodes) {
for (let child of node.ChildNodes) {
toDocumentSymbol(bucket, child, ret.name)
}
}
bucket.push(ret);
}
var kinds: { [kind: string]: vscode.SymbolKind; } = Object.create(null);
kinds['NamespaceDeclaration'] = vscode.SymbolKind.Namespace;
kinds['ClassDeclaration'] = vscode.SymbolKind.Class;
kinds['FieldDeclaration'] = vscode.SymbolKind.Field;
kinds['PropertyDeclaration'] = vscode.SymbolKind.Property;
kinds['EventFieldDeclaration'] = vscode.SymbolKind.Property;
kinds['MethodDeclaration'] = vscode.SymbolKind.Method;
kinds['EnumDeclaration'] = vscode.SymbolKind.Enum;
kinds['StructDeclaration'] = vscode.SymbolKind.Enum;
kinds['EnumMemberDeclaration'] = vscode.SymbolKind.Property;
kinds['InterfaceDeclaration'] = vscode.SymbolKind.Interface;
kinds['VariableDeclaration'] = vscode.SymbolKind.Variable;

View file

@ -1,69 +0,0 @@
declare class Client {
public context: any;
public config: any;
public trackEvent(eventName: string, properties: {[key: string]: string}, measures?: {[key: string]: number}): void;
}
declare class ApplicationInsights {
static client: Client;
/**
* Initializes a client with the given instrumentation key, if this is not specified, the value will be
* read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
* @returns {ApplicationInsights/Client} a new client
*/
static getClient(instrumentationKey?: string): Client;
/**
* Initializes the default client of the client and sets the default configuration
* @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be
* read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
* @returns {ApplicationInsights} this class
*/
static setup(instrumentationKey?: string): typeof ApplicationInsights;
/**
* Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected
* @returns {ApplicationInsights} this class
*/
static start(): typeof ApplicationInsights;
/**
* Sets the state of console tracking (enabled by default)
* @param value if true console activity will be sent to Application Insights
* @returns {ApplicationInsights} this class
*/
static setAutoCollectConsole(value: boolean): typeof ApplicationInsights;
/**
* Sets the state of exception tracking (enabled by default)
* @param value if true uncaught exceptions will be sent to Application Insights
* @returns {ApplicationInsights} this class
*/
static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights;
/**
* Sets the state of performance tracking (enabled by default)
* @param value if true performance counters will be collected every second and sent to Application Insights
* @returns {ApplicationInsights} this class
*/
static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights;
/**
* Sets the state of request tracking (enabled by default)
* @param value if true requests will be sent to Application Insights
* @returns {ApplicationInsights} this class
*/
static setAutoCollectRequests(value: boolean): typeof ApplicationInsights;
/**
* Sets the state of enabling offline mode to cache event when client is offline (disabled by default)
* @param value if true events that happen while client is offline will be cahced on disk,
* client will retry to send events when back online
* @returns {ApplicationInsights} this class
*/
public static setOfflineMode(value: boolean): typeof ApplicationInsights;
/**
* Enables verbose debug logging
* @returns {ApplicationInsights} this class
*/
static enableVerboseLogging(): typeof ApplicationInsights;
}
declare module 'applicationinsights' {
export = ApplicationInsights;
}

View file

@ -1,125 +0,0 @@
// Type definitions for semver v2.2.1
// Project: https://github.com/isaacs/node-semver
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module SemVerModule {
/**
* Return the parsed version, or null if it's not valid.
*/
function valid(v: string, loose?: boolean): string;
/**
* Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
*/
function inc(v: string, release: string, loose?: boolean): string;
// Comparison
/**
* v1 > v2
*/
function gt(v1: string, v2: string, loose?: boolean): boolean;
/**
* v1 >= v2
*/
function gte(v1: string, v2: string, loose?: boolean): boolean;
/**
* v1 < v2
*/
function lt(v1: string, v2: string, loose?: boolean): boolean;
/**
* v1 <= v2
*/
function lte(v1: string, v2: string, loose?: boolean): boolean;
/**
* v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
*/
function eq(v1: string, v2: string, loose?: boolean): boolean;
/**
* v1 != v2 The opposite of eq.
*/
function neq(v1: string, v2: string, loose?: boolean): boolean;
/**
* Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided.
*/
function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean;
/**
* Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort().
*/
function compare(v1: string, v2: string, loose?: boolean): number;
/**
* The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
*/
function rcompare(v1: string, v2: string, loose?: boolean): number;
// Ranges
/**
* Return the valid range or null if it's not valid
*/
function validRange(range: string, loose?: boolean): string;
/**
* Return true if the version satisfies the range.
*/
function satisfies(version: string, range: string, loose?: boolean): boolean;
/**
* Return the highest version in the list that satisfies the range, or null if none of them do.
*/
function maxSatisfying(versions: string[], range: string, loose?: boolean): string;
/**
* Return true if version is greater than all the versions possible in the range.
*/
function gtr(version: string, range: string, loose?: boolean): boolean;
/**
* Return true if version is less than all the versions possible in the range.
*/
function ltr(version: string, range: string, loose?: boolean): boolean;
/**
* Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.)
*/
function outside(version: string, range: string, hilo: string, loose?: boolean): boolean;
class SemVerBase {
raw: string;
loose: boolean;
format(): string;
inspect(): string;
toString(): string;
}
class SemVer extends SemVerBase {
constructor(version: string, loose?: boolean);
major: number;
minor: number;
patch: number;
version: string;
build: string[];
prerelease: string[];
compare(other:SemVer): number;
compareMain(other:SemVer): number;
comparePre(other:SemVer): number;
inc(release: string): SemVer;
}
class Comparator extends SemVerBase {
constructor(comp: string, loose?: boolean);
semver: SemVer;
operator: string;
value: boolean;
parse(comp: string): void;
test(version:SemVer): boolean;
}
class Range extends SemVerBase {
constructor(range: string, loose?: boolean);
set: Comparator[][];
parseRange(range: string): Comparator[];
test(version: SemVer): boolean;
}
}
declare module "semver" {
export = SemVerModule;
}

View file

@ -1,12 +0,0 @@
{
"compilerOptions": {
"noLib": true,
"target": "ES5",
"module": "commonjs",
"outDir": "out",
"sourceMap": true
},
"exclude": [
"node_modules"
]
}

View file

@ -1,13 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare function run(): void;
declare function suite(name: string, fn: (err?)=>void);
declare function test(name: string, fn: (done?: (err?)=>void)=>void);
declare function suiteSetup(fn: (done?: (err?)=>void)=>void);
declare function suiteTeardown(fn: (done?: (err?)=>void)=>void);
declare function setup(fn: (done?: (err?)=>void)=>void);
declare function teardown(fn: (done?: (err?)=>void)=>void);

View file

@ -14,5 +14,15 @@
"border: ${width} ${border-style} ${color};$0"
],
"description": "[width] [border-style] [color]"
},
"gradient": {
"prefix": "gradient",
"body": [
"background-image: -moz-linear-gradient(top, ${start-color}, ${end-color});",
"background-image: -webkit-gradient(linear, left top, left bottom, from(${start-color}), to(${end-color}));",
"background-image: -webkit-linear-gradient(top, ${start-color}, ${end-color});",
"background-image: linear-gradient(top, ${start-color}, ${end-color});"
],
"description": "Set the 'background-image' property to a linear gradient"
}
}
}

View file

@ -96,7 +96,7 @@
"patterns": [
{
"name": "comment.block.fsharp",
"begin": "(\\(\\*)",
"begin": "(\\(\\*(?!\\)))",
"end": "(\\*\\))",
"beginCaptures": {
"1": {

View file

@ -0,0 +1,22 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "textmate/html.tmbundle",
"version": "0.0.0",
"license": "TextMate Bundle License",
"repositoryURL": "https://github.com/textmate/html.tmbundle",
"licenseDetail": [
"Copyright (c) textmate-html.tmbundle project authors",
"",
"If not otherwise specified (see below), files in this repository fall under the following license:",
"",
"Permission to copy, use, modify, sell and distribute this",
"software is granted. This software is provided \"as is\" without",
"express or implied warranty, and with no claim as to its",
"suitability for any purpose.",
"",
"An exception is made for files in readable text which contain their own license information,",
"or files where an accompanying file exists (in the same directory) with a \"-license\" suffix added",
"to the base-name name of the original file, and an extension of txt, html, or similar. For example",
"\"tidy\" is accompanied by \"tidy-license.txt\"."
]
}]

View file

@ -2,5 +2,19 @@
"name": "html",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" }
"engines": { "vscode": "*" },
"contributes": {
"languages": [{
"id": "html",
"extensions": [ ".html", ".htm", ".shtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm" ],
"aliases": [ "HTML", "htm", "html", "xhtml" ],
"mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template"]
}],
"grammars": [{
/* "language": "html", not yet enabled*/
"scopeName": "text.html.basic",
"path": "./syntaxes/HTML.plist"
}]
}
}

View file

@ -0,0 +1,855 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>html</string>
<string>htm</string>
<string>shtml</string>
<string>xhtml</string>
<string>inc</string>
<string>tmpl</string>
<string>tpl</string>
</array>
<key>firstLineMatch</key>
<string>&lt;(?i:(!DOCTYPE\s*)?html)</string>
<key>injections</key>
<dict>
<key>R:text.html - comment.block</key>
<dict>
<key>comment</key>
<string>Use R: to ensure this matches after any other injections.</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>&lt;</string>
<key>name</key>
<string>invalid.illegal.bad-angle-bracket.html</string>
</dict>
</array>
</dict>
</dict>
<key>keyEquivalent</key>
<string>^~H</string>
<key>name</key>
<string>HTML</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(&lt;)([a-zA-Z0-9:]++)(?=[^&gt;]*&gt;&lt;/\2&gt;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.html</string>
</dict>
</dict>
<key>end</key>
<string>(&gt;(&lt;)/)(\2)(&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>meta.scope.between-tag-pair.html</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.tag.html</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
</dict>
<key>name</key>
<string>meta.tag.any.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(&lt;\?)(xml)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.xml.html</string>
</dict>
</dict>
<key>end</key>
<string>(\?&gt;)</string>
<key>name</key>
<string>meta.tag.preprocessor.xml.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-generic-attribute</string>
</dict>
<dict>
<key>include</key>
<string>#string-double-quoted</string>
</dict>
<dict>
<key>include</key>
<string>#string-single-quoted</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>&lt;!--</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.html</string>
</dict>
</dict>
<key>end</key>
<string>--\s*&gt;</string>
<key>name</key>
<string>comment.block.html</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>--</string>
<key>name</key>
<string>invalid.illegal.bad-comments-or-CDATA.html</string>
</dict>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>&lt;!</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
</dict>
<key>end</key>
<string>&gt;</string>
<key>name</key>
<string>meta.tag.sgml.html</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?i:DOCTYPE)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.tag.doctype.html</string>
</dict>
</dict>
<key>end</key>
<string>(?=&gt;)</string>
<key>name</key>
<string>meta.tag.sgml.doctype.html</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>"[^"&gt;]*"</string>
<key>name</key>
<string>string.quoted.double.doctype.identifiers-and-DTDs.html</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\[CDATA\[</string>
<key>end</key>
<string>]](?=&gt;)</string>
<key>name</key>
<string>constant.other.inline-data.html</string>
</dict>
<dict>
<key>match</key>
<string>(\s*)(?!--|&gt;)\S(\s*)</string>
<key>name</key>
<string>invalid.illegal.bad-comments-or-CDATA.html</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>begin</key>
<string>(?:^\s+)?(&lt;)((?i:style))\b(?![^&gt;]*/&gt;)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.style.html</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
</dict>
<key>end</key>
<string>(&lt;/)((?i:style))(&gt;)(?:\s*\n)?</string>
<key>name</key>
<string>source.css.embedded.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
<dict>
<key>begin</key>
<string>(&gt;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
</dict>
<key>end</key>
<string>(?=&lt;/(?i:style))</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>source.css</string>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)(?![^&gt;]*(?i:type.?=.?text/((?!javascript).*)))</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.script.html</string>
</dict>
</dict>
<key>end</key>
<string>(?&lt;=&lt;/(script|SCRIPT))(&gt;)(?:\s*\n)?</string>
<key>endCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
</dict>
<key>name</key>
<string>source.js.embedded.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;!&lt;/(?:script|SCRIPT))(&gt;)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.script.html</string>
</dict>
</dict>
<key>end</key>
<string>(&lt;/)((?i:script))</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.js</string>
</dict>
</dict>
<key>match</key>
<string>(//).*?((?=&lt;/script)|$\n?)</string>
<key>name</key>
<string>comment.line.double-slash.js</string>
</dict>
<dict>
<key>begin</key>
<string>/\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.js</string>
</dict>
</dict>
<key>end</key>
<string>\*/|(?=&lt;/script)</string>
<key>name</key>
<string>comment.block.js</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(&lt;/?)((?i:body|head|html)\b)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.structure.any.html</string>
</dict>
</dict>
<key>end</key>
<string>(&gt;)</string>
<key>name</key>
<string>meta.tag.structure.any.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(&lt;/?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)\b)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.block.any.html</string>
</dict>
</dict>
<key>end</key>
<string>(&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.html</string>
</dict>
</dict>
<key>name</key>
<string>meta.tag.block.any.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(&lt;/?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\b)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.inline.any.html</string>
</dict>
</dict>
<key>end</key>
<string>((?: ?/)?&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.html</string>
</dict>
</dict>
<key>name</key>
<string>meta.tag.inline.any.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(&lt;/?)([a-zA-Z0-9:]+)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.other.html</string>
</dict>
</dict>
<key>end</key>
<string>(&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.html</string>
</dict>
</dict>
<key>name</key>
<string>meta.tag.other.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
<dict>
<key>match</key>
<string>&lt;&gt;</string>
<key>name</key>
<string>invalid.illegal.incomplete.html</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>embedded-code</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#smarty</string>
</dict>
<dict>
<key>include</key>
<string>#python</string>
</dict>
</array>
</dict>
<key>entities</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.html</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.html</string>
</dict>
</dict>
<key>match</key>
<string>(&amp;)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)</string>
<key>name</key>
<string>constant.character.entity.html</string>
</dict>
<dict>
<key>match</key>
<string>&amp;</string>
<key>name</key>
<string>invalid.illegal.bad-ampersand.html</string>
</dict>
</array>
</dict>
<key>python</key>
<dict>
<key>begin</key>
<string>(?:^\s*)&lt;\?python(?!.*\?&gt;)</string>
<key>end</key>
<string>\?&gt;(?:\s*$\n)?</string>
<key>name</key>
<string>source.python.embedded.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.python</string>
</dict>
</array>
</dict>
<key>smarty</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(\{(literal)\})</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>source.smarty.embedded.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.function.built-in.smarty</string>
</dict>
</dict>
<key>end</key>
<string>(\{/(literal)\})</string>
</dict>
<dict>
<key>begin</key>
<string>{{|{</string>
<key>disabled</key>
<integer>1</integer>
<key>end</key>
<string>}}|}</string>
<key>name</key>
<string>source.smarty.embedded.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.smarty</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>string-double-quoted</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.html</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.html</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<key>string-single-quoted</key>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.html</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.html</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<key>tag-generic-attribute</key>
<dict>
<key>match</key>
<string>(?&lt;=[^=])\b([a-zA-Z0-9:-]+)</string>
<key>name</key>
<string>entity.other.attribute-name.html</string>
</dict>
<key>tag-id-attribute</key>
<dict>
<key>begin</key>
<string>\b(id)\b\s*(=)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.other.attribute-name.id.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.separator.key-value.html</string>
</dict>
</dict>
<key>end</key>
<string>(?!\G)(?&lt;='|"|[^\s&lt;&gt;/])</string>
<key>name</key>
<string>meta.attribute-with-value.id.html</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.html</string>
</dict>
</dict>
<key>contentName</key>
<string>meta.toc-list.id.html</string>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.html</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.html</string>
</dict>
</dict>
<key>contentName</key>
<string>meta.toc-list.id.html</string>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.html</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.html</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>meta.toc-list.id.html</string>
</dict>
</dict>
<key>match</key>
<string>(?&lt;==)(?:[^\s&lt;&gt;/'"]|/(?!&gt;))+</string>
<key>name</key>
<string>string.unquoted.html</string>
</dict>
</array>
</dict>
<key>tag-stuff</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-id-attribute</string>
</dict>
<dict>
<key>include</key>
<string>#tag-generic-attribute</string>
</dict>
<dict>
<key>include</key>
<string>#string-double-quoted</string>
</dict>
<dict>
<key>include</key>
<string>#string-single-quoted</string>
</dict>
<dict>
<key>include</key>
<string>#embedded-code</string>
</dict>
<dict>
<key>include</key>
<string>#unquoted-attribute</string>
</dict>
</array>
</dict>
<key>unquoted-attribute</key>
<dict>
<key>match</key>
<string>(?&lt;==)(?:[^\s&lt;&gt;/'"]|/(?!&gt;))+</string>
<key>name</key>
<string>string.unquoted.html</string>
</dict>
</dict>
<key>scopeName</key>
<string>text.html.basic</string>
<key>uuid</key>
<string>17994EC8-6B1D-11D9-AC3A-000D93589AF6</string>
</dict>
</plist>

View file

@ -1,11 +1,11 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "typescript-sublime-plugin",
"version": "0.1.8",
"name": "Microsoft/TypeScript-TmLanguage",
"version": "0.0.1",
"license": "Apache2",
"repositoryURL": "https://github.com/Microsoft/TypeScript-Sublime-Plugin",
"description": "The file syntaxes/JavaScriptReact.tmLanguage was derived from the TypeScript-Sublime-Plugin https://github.com/Microsoft/TypeScript-Sublime-Plugin.",
"repositoryURL": "https://github.com/Microsoft/TypeScript-TmLanguage",
"description": "The files syntaxes/JavaScriptReact.tmLanguage & syntaxes/JavaScript.tmLanguage were derived from TypeScript-TmLanguage https://github.com/Microsoft/TypeScript-TmLanguage.",
"licenseDetail": [
// Reason: LICENSE file does not include Copyright statement
"Copyright (c) Microsoft Corporation. All rights reserved.",

View file

@ -0,0 +1,11 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
]
}

View file

@ -7,9 +7,9 @@
"languages": [{
"id": "javascriptreact",
"aliases": ["JavaScript React","jsx"],
"extensions": [".jsx"]
},
{
"extensions": [".jsx"],
"configuration": "./javascript.configuration.json"
},{
"id": "javascript",
"aliases": ["JavaScript", "javascript", "js"],
"extensions": [".js", ".es6"],
@ -26,6 +26,7 @@
"scopeName": "source.js",
"path": "./syntaxes/JavaScript.tmLanguage"
},{
// referenced by other grammars
"scopeName": "source.js.regexp",
"path": "./syntaxes/Regular Expressions (JavaScript).tmLanguage"
}],

File diff suppressed because it is too large Load diff

View file

@ -3,3 +3,10 @@ The JavaScriptReact.tmLanguage bundle is derived from the TypeScriptReact.tmLang
Changes:
- fileTypes -> .jsx
- scopeName -> scope.jsx
The JavaScript-ts.tmLanguage bundle is derived from the TypeScriptReact.tmLanguage.
Changes:
- all occurences of .ts -> .js
- fileTypes -> .js
- scopeName -> scope.js

View file

@ -0,0 +1,7 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "Benvie/JavaScriptNext.tmLanguage",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/Benvie/JavaScriptNext.tmLanguage"
}]

View file

@ -0,0 +1,19 @@
{
"name": "json",
"version": "0.1.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
"contributes": {
"languages": [{
"id": "json",
"aliases": ["JSON", "json"],
"extensions": [".json", ".bowerrc", ".jshintrc", ".jscsrc", ".eslintrc"],
"mimetypes": ["application/json"]
}],
"grammars": [{
"language": "json",
"scopeName": "source.json",
"path": "./syntaxes/JSON.tmLanguage"
}]
}
}

View file

@ -0,0 +1,387 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>json</string>
<string>sublime-settings</string>
<string>sublime-menu</string>
<string>sublime-keymap</string>
<string>sublime-mousemap</string>
<string>sublime-theme</string>
<string>sublime-build</string>
<string>sublime-project</string>
<string>sublime-completions</string>
</array>
<key>foldingStartMarker</key>
<string>(?x) # turn on extended mode
^ # a line beginning with
\s* # some optional space
[{\[] # the start of an object or array
(?! # but not followed by
.* # whatever
[}\]] # and the close of an object or array
,? # an optional comma
\s* # some optional space
$ # at the end of the line
)
| # ...or...
[{\[] # the start of an object or array
\s* # some optional space
$ # at the end of the line</string>
<key>foldingStopMarker</key>
<string>(?x) # turn on extended mode
^ # a line beginning with
\s* # some optional space
[}\]] # and the close of an object or array</string>
<key>keyEquivalent</key>
<string>^~J</string>
<key>name</key>
<string>JSON (Javascript Next)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#value</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>array</key>
<dict>
<key>begin</key>
<string>\[</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.array.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>\]</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.array.end.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.array.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#value</string>
</dict>
<dict>
<key>match</key>
<string>,</string>
<key>name</key>
<string>punctuation.separator.array.json</string>
</dict>
<dict>
<key>match</key>
<string>[^\s\]]</string>
<key>name</key>
<string>invalid.illegal.expected-array-separator.json</string>
</dict>
</array>
</dict>
<key>comments</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>/\*\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.documentation.json</string>
</dict>
<dict>
<key>begin</key>
<string>/\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.json</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.json</string>
</dict>
</dict>
<key>match</key>
<string>(//).*$\n?</string>
<key>name</key>
<string>comment.line.double-slash.js</string>
</dict>
</array>
</dict>
<key>constant</key>
<dict>
<key>match</key>
<string>\b(?:true|false|null)\b</string>
<key>name</key>
<string>constant.language.json</string>
</dict>
<key>number</key>
<dict>
<key>match</key>
<string>(?x) # turn on extended mode
-? # an optional minus
(?:
0 # a zero
| # ...or...
[1-9] # a 1-9 character
\d* # followed by zero or more digits
)
(?:
(?:
\. # a period
\d+ # followed by one or more digits
)?
(?:
[eE] # an e character
[+-]? # followed by an option +/-
\d+ # followed by one or more digits
)? # make exponent optional
)? # make decimal portion optional</string>
<key>name</key>
<string>constant.numeric.json</string>
</dict>
<key>object</key>
<dict>
<key>begin</key>
<string>\{</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.dictionary.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.dictionary.end.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.dictionary.json</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>the JSON object key</string>
<key>include</key>
<string>#objectkey</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>begin</key>
<string>:</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.separator.dictionary.key-value.json</string>
</dict>
</dict>
<key>end</key>
<string>(,)|(?=\})</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.dictionary.pair.json</string>
</dict>
</dict>
<key>name</key>
<string>meta.structure.dictionary.value.json</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>the JSON object value</string>
<key>include</key>
<string>#value</string>
</dict>
<dict>
<key>match</key>
<string>[^\s,]</string>
<key>name</key>
<string>invalid.illegal.expected-dictionary-separator.json</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>[^\s\}]</string>
<key>name</key>
<string>invalid.illegal.expected-dictionary-separator.json</string>
</dict>
</array>
</dict>
<key>string</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.json</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#stringcontent</string>
</dict>
</array>
</dict>
<key>objectkey</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.support.type.property-name.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.support.type.property-name.end.json</string>
</dict>
</dict>
<key>name</key>
<string>support.type.property-name.json</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#stringcontent</string>
</dict>
</array>
</dict>
<key>stringcontent</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?x) # turn on extended mode
\\ # a literal backslash
(?: # ...followed by...
["\\/bfnrt] # one of these characters
| # ...or...
u # a u
[0-9a-fA-F]{4}) # and four hex digits</string>
<key>name</key>
<string>constant.character.escape.json</string>
</dict>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>invalid.illegal.unrecognized-string-escape.json</string>
</dict>
</array>
</dict>
<key>value</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#constant</string>
</dict>
<dict>
<key>include</key>
<string>#number</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#array</string>
</dict>
<dict>
<key>include</key>
<string>#object</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.json</string>
<key>uuid</key>
<string>8f97457b-516e-48ce-83c7-08ae12fb327a</string>
</dict>
</plist>

View file

@ -243,7 +243,7 @@
</dict>
<dict>
<key>match</key>
<string>\b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in)\b</string>
<string>\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|function|local|in)\b</string>
<key>name</key>
<string>keyword.control.lua</string>
</dict>

View file

@ -1,6 +1,6 @@
{
"account": "monacobuild",
"container": "debuggers",
"zip": "757615d/mono-debug.zip",
"zip": "090c7d9/mono-debug.zip",
"output": ""
}

View file

@ -1,6 +1,6 @@
{
"account": "monacobuild",
"container": "debuggers",
"zip": "a7f6203/node-debug.zip",
"zip": "32575e3/node-debug.zip",
"output": ""
}

View file

@ -21,6 +21,11 @@
"title": "PHP Configuration options",
"type": "object",
"properties": {
"php.validate.enable": {
"type": "boolean",
"default": true,
"description": "Whether php validation is enabled or not."
},
"php.validate.executablePath": {
"type": "string",
"default": null,

View file

@ -61,7 +61,17 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
while (match = variableMatch.exec(text)) {
var word = match[0];
if (!added[word]) {
result.push(createNewProposal(CompletionItemKind.Variable, name, null));
added[word] = true;
result.push(createNewProposal(CompletionItemKind.Variable, word, null));
}
}
var functionMatch = /function\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/g;
var match : RegExpExecArray = null;
while (match = functionMatch.exec(text)) {
var word = match[1];
if (!added[word]) {
added[word] = true;
result.push(createNewProposal(CompletionItemKind.Function, word, null));
}
}
return Promise.resolve(result);

View file

@ -84,6 +84,7 @@ export default class PHPValidationProvider {
private static BufferArgs: string[] = ['-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off'];
private static FileArgs: string[] = ['-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off', '-f'];
private validationEnabled: boolean;
private executable: string;
private trigger: RunTrigger;
private executableNotFound: boolean;
@ -94,6 +95,7 @@ export default class PHPValidationProvider {
constructor() {
this.executable = null;
this.validationEnabled = true;
this.trigger = RunTrigger.onSave;
this.executableNotFound = false;
}
@ -109,9 +111,6 @@ export default class PHPValidationProvider {
this.diagnosticCollection.delete(textDocument.uri);
delete this.delayers[textDocument.uri.toString()];
}, null, subscriptions);
// Validate all open php documents
vscode.workspace.textDocuments.forEach(this.triggerValidate, this);
}
public dispose(): void {
@ -123,6 +122,7 @@ export default class PHPValidationProvider {
let section = vscode.workspace.getConfiguration('php');
let oldExecutable = this.executable;
if (section) {
this.validationEnabled = section.get<boolean>('validate.enable', true);
this.executable = section.get<string>('validate.executablePath', null);
this.trigger = RunTrigger.from(section.get<string>('validate.run', RunTrigger.strings.onSave));
}
@ -133,26 +133,29 @@ export default class PHPValidationProvider {
if (this.documentListener) {
this.documentListener.dispose();
}
if (this.trigger === RunTrigger.onType) {
this.documentListener = vscode.workspace.onDidChangeTextDocument((e) => {
this.triggerValidate(e.document);
});
} else {
this.documentListener = vscode.workspace.onDidSaveTextDocument(this.triggerValidate, this);
this.diagnosticCollection.clear();
if (this.validationEnabled) {
if (this.trigger === RunTrigger.onType) {
this.documentListener = vscode.workspace.onDidChangeTextDocument((e) => {
this.triggerValidate(e.document);
});
} else {
this.documentListener = vscode.workspace.onDidSaveTextDocument(this.triggerValidate, this);
}
// Configuration has changed. Reevaluate all documents.
vscode.workspace.textDocuments.forEach(this.triggerValidate, this);
}
// Configuration has changed. Reevaluate all documents.
vscode.workspace.textDocuments.forEach(this.triggerValidate, this);
}
private triggerValidate(textDocument: vscode.TextDocument): void {
if (textDocument.languageId !== 'php' || this.executableNotFound) {
if (textDocument.languageId !== 'php' || this.executableNotFound || !this.validationEnabled) {
return;
}
let key = textDocument.uri.toString();
let delayer = this.delayers[key];
if (!delayer) {
delayer = new ThrottledDelayer<void>(this.trigger === RunTrigger.onType ? 250 : 0);
this.delayers[key];
this.delayers[key] = delayer;
}
delayer.trigger(() => this.doValidate(textDocument) );
}

View file

@ -1,5 +1,5 @@
import assert = require('assert');
import {CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Range, Position, Uri} from 'vscode';
import {CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Range, Position, Uri, workspace, window} from 'vscode';
import PHPCompletionItemProvider from '../features/completionItemProvider';
import HoverProvider from '../features/hoverProvider';
import SignatureHelpProvider from '../features/signatureHelpProvider';
@ -7,14 +7,19 @@ import SignatureHelpProvider from '../features/signatureHelpProvider';
var phpCompletionProvider = new PHPCompletionItemProvider();
var testSuggestionsFor = function(value:string, stringBefore:string):Promise<CompletionItem[]> {
var uri = new Uri();
var doc = new TextDocument(uri, value.split('\n'), '\n', 'php', 1, false);
var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0;
var position = new Position(0, idx);
return phpCompletionProvider.provideCompletionItems(doc, position, null);
var testSuggestionsFor = function(value:string, stringBefore:string):Thenable<CompletionItem[]> {
return workspace.openTextDocument(Uri.parse("untitled:/foo/new.js")).then(document => {
return window.showTextDocument(document).then(textEditor => {
return textEditor.edit(editBuilder => {
var lastLineLength = document.lineAt(document.lineCount - 1).text.length;
editBuilder.replace(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(textEditor.document.lineCount - 1, lastLineLength)), value);
}).then(() => {
var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0;
var position = new Position(0, idx);
return phpCompletionProvider.provideCompletionItems(document, position, null);
})
})
});
};
var assertSuggestion= function(completions:CompletionItem[], label:string, kind: CompletionItemKind) {
@ -25,9 +30,9 @@ var assertSuggestion= function(completions:CompletionItem[], label:string, kind:
assert.equal(entries[0].kind, kind);
};
suite("Extension Tests", () => {
suite("PHP", () => {
test("Something 1", (testDone:(err?:any) => void) => {
test("Intellisense", (testDone:(err?:any) => void) => {
Promise.all([
testSuggestionsFor('<?php ', 'php ').then(completions => {
assertSuggestion(completions, '__CLASS__', CompletionItemKind.Field);

View file

@ -6,7 +6,7 @@
"contributes": {
"languages": [{
"id": "python",
"extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi" ],
"extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gn", ".gyp", ".gypi" ],
"aliases": [ "Python", "py" ],
"firstLine": "^#!/.*\\bpython[0-9.-]*\\b",
"configuration": "./python.configuration.json"
@ -20,4 +20,4 @@
"path": "./syntaxes/Regular Expressions (Python).tmLanguage"
}]
}
}
}

View file

@ -7,7 +7,7 @@
"languages": [{
"id": "ruby",
"extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp" ],
"filenames": [ "rakefile" ],
"filenames": [ "rakefile", "gemfile" ],
"aliases": [ "Ruby", "rb" ],
"configuration": "./ruby.configuration.json"
}],

View file

@ -6,7 +6,7 @@
"contributes": {
"languages": [{
"id": "shaderlab",
"extensions": [".shader"],
"extensions": [".shader", ".cginc"],
"aliases": ["ShaderLab", "shaderlab"],
"configuration": "./shaderlab.configuration.json"
}],

View file

@ -11,6 +11,6 @@
"typescript/src/lib",
"typescript/out/lib",
"jshint",
"csharp-o"
"vscode-api-tests/node_modules"
]
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,21 +1,21 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference path="lib.core.d.ts" />
/////////////////////////////
/// ECMAScript Internationalization API
/// ECMAScript Internationalization API
/////////////////////////////
declare module Intl {
@ -57,7 +57,7 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
@ -70,7 +70,7 @@ declare module Intl {
style: string;
currency?: string;
currencyDisplay?: string;
minimumintegerDigits: number;
minimumIntegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
minimumSignificantDigits?: number;
@ -158,14 +158,14 @@ interface String {
interface Number {
/**
* Converts a number to a string by using the current or specified locale.
* Converts a number to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
/**
* Converts a number to a string by using the current or specified locale.
* Converts a number to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
@ -174,41 +174,41 @@ interface Number {
interface Date {
/**
* Converts a date and time to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
@ -419,8 +419,8 @@ interface AnalyserNode extends AudioNode {
smoothingTimeConstant: number;
getByteFrequencyData(array: Uint8Array): void;
getByteTimeDomainData(array: Uint8Array): void;
getFloatFrequencyData(array: any): void;
getFloatTimeDomainData(array: any): void;
getFloatFrequencyData(array: Float32Array): void;
getFloatTimeDomainData(array: Float32Array): void;
}
declare var AnalyserNode: {
@ -507,7 +507,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@ -551,7 +551,7 @@ interface AudioContext extends EventTarget {
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
createPeriodicWave(real: any, imag: any): PeriodicWave;
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
@ -609,7 +609,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueAtTime(value: number, startTime: number): void;
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
}
declare var AudioParam: {
@ -685,7 +685,7 @@ interface BiquadFilterNode extends AudioNode {
frequency: AudioParam;
gain: AudioParam;
type: string;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare var BiquadFilterNode: {
@ -1284,7 +1284,7 @@ declare var CanvasPattern: {
interface CanvasRenderingContext2D {
canvas: HTMLCanvasElement;
fillStyle: any;
fillStyle: string | CanvasGradient | CanvasPattern;
font: string;
globalAlpha: number;
globalCompositeOperation: string;
@ -1299,7 +1299,7 @@ interface CanvasRenderingContext2D {
shadowColor: string;
shadowOffsetX: number;
shadowOffsetY: number;
strokeStyle: any;
strokeStyle: string | CanvasGradient | CanvasPattern;
textAlign: string;
textBaseline: string;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
@ -1812,7 +1812,7 @@ declare var DeviceRotationRate: {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
/**
* Sets or gets the URL for the current document.
* Sets or gets the URL for the current document.
*/
URL: string;
/**
@ -1840,7 +1840,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
applets: HTMLCollection;
/**
* Deprecated. Sets or retrieves a value that indicates the background color behind the object.
* Deprecated. Sets or retrieves a value that indicates the background color behind the object.
*/
bgColor: string;
/**
@ -1867,19 +1867,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
designMode: string;
/**
* Sets or retrieves a value that indicates the reading order of the object.
* Sets or retrieves a value that indicates the reading order of the object.
*/
dir: string;
/**
* Gets an object representing the document type declaration associated with the current document.
* Gets an object representing the document type declaration associated with the current document.
*/
doctype: DocumentType;
/**
* Gets a reference to the root node of the document.
* Gets a reference to the root node of the document.
*/
documentElement: HTMLElement;
/**
* Sets or gets the security domain of the document.
* Sets or gets the security domain of the document.
*/
domain: string;
/**
@ -1903,7 +1903,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
images: HTMLCollection;
/**
* Gets the implementation object of the current document.
* Gets the implementation object of the current document.
*/
implementation: DOMImplementation;
/**
@ -1911,11 +1911,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
inputEncoding: string;
/**
* Gets the date that the page was last modified, if the page supplies one.
* Gets the date that the page was last modified, if the page supplies one.
*/
lastModified: string;
/**
* Sets or gets the color of the document links.
* Sets or gets the color of the document links.
*/
linkColor: string;
/**
@ -1923,7 +1923,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
links: HTMLCollection;
/**
* Contains information about the current URL.
* Contains information about the current URL.
*/
location: Location;
media: string;
@ -1951,19 +1951,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param ev The event.
*/
onbeforedeactivate: (ev: UIEvent) => any;
/**
* Fires when the object loses the input focus.
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
*/
onblur: (ev: FocusEvent) => any;
/**
* Occurs when playback is possible, but would require further buffering.
* Occurs when playback is possible, but would require further buffering.
* @param ev The event.
*/
oncanplay: (ev: Event) => any;
oncanplaythrough: (ev: Event) => any;
/**
* Fires when the contents of the object or selection have changed.
* Fires when the contents of the object or selection have changed.
* @param ev The event.
*/
onchange: (ev: Event) => any;
@ -1973,7 +1973,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onclick: (ev: MouseEvent) => any;
/**
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* @param ev The mouse event.
*/
oncontextmenu: (ev: PointerEvent) => any;
@ -1997,12 +1997,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param ev The event.
*/
ondragend: (ev: DragEvent) => any;
/**
/**
* Fires on the target element when the user drags the object to a valid drop target.
* @param ev The drag event.
*/
ondragenter: (ev: DragEvent) => any;
/**
/**
* Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
* @param ev The drag event.
*/
@ -2013,23 +2013,23 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
ondragover: (ev: DragEvent) => any;
/**
* Fires on the source object when the user starts to drag a text selection or selected object.
* Fires on the source object when the user starts to drag a text selection or selected object.
* @param ev The event.
*/
ondragstart: (ev: DragEvent) => any;
ondrop: (ev: DragEvent) => any;
/**
* Occurs when the duration attribute is updated.
* Occurs when the duration attribute is updated.
* @param ev The event.
*/
ondurationchange: (ev: Event) => any;
/**
* Occurs when the media element is reset to its initial state.
* Occurs when the media element is reset to its initial state.
* @param ev The event.
*/
onemptied: (ev: Event) => any;
/**
* Occurs when the end of playback is reached.
* Occurs when the end of playback is reached.
* @param ev The event
*/
onended: (ev: Event) => any;
@ -2039,7 +2039,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onerror: (ev: Event) => any;
/**
* Fires when the object receives focus.
* Fires when the object receives focus.
* @param ev The event.
*/
onfocus: (ev: FocusEvent) => any;
@ -2062,12 +2062,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onkeyup: (ev: KeyboardEvent) => any;
/**
* Fires immediately after the browser loads the object.
* Fires immediately after the browser loads the object.
* @param ev The event.
*/
onload: (ev: Event) => any;
/**
* Occurs when media data is loaded at the current playback position.
* Occurs when media data is loaded at the current playback position.
* @param ev The event.
*/
onloadeddata: (ev: Event) => any;
@ -2077,22 +2077,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onloadedmetadata: (ev: Event) => any;
/**
* Occurs when Internet Explorer begins looking for media data.
* Occurs when Internet Explorer begins looking for media data.
* @param ev The event.
*/
onloadstart: (ev: Event) => any;
/**
* Fires when the user clicks the object with either mouse button.
* Fires when the user clicks the object with either mouse button.
* @param ev The mouse event.
*/
onmousedown: (ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse over the object.
* Fires when the user moves the mouse over the object.
* @param ev The mouse event.
*/
onmousemove: (ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* @param ev The mouse event.
*/
onmouseout: (ev: MouseEvent) => any;
@ -2102,12 +2102,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onmouseover: (ev: MouseEvent) => any;
/**
* Fires when the user releases a mouse button while the mouse is over the object.
* Fires when the user releases a mouse button while the mouse is over the object.
* @param ev The mouse event.
*/
onmouseup: (ev: MouseEvent) => any;
/**
* Fires when the wheel button is rotated.
* Fires when the wheel button is rotated.
* @param ev The mouse event
*/
onmousewheel: (ev: MouseWheelEvent) => any;
@ -2129,7 +2129,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onmspointerover: (ev: MSPointerEvent) => any;
onmspointerup: (ev: MSPointerEvent) => any;
/**
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* @param ev The event.
*/
onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any;
@ -2144,24 +2144,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onpause: (ev: Event) => any;
/**
* Occurs when the play method is requested.
* Occurs when the play method is requested.
* @param ev The event.
*/
onplay: (ev: Event) => any;
/**
* Occurs when the audio or video has started playing.
* Occurs when the audio or video has started playing.
* @param ev The event.
*/
onplaying: (ev: Event) => any;
onpointerlockchange: (ev: Event) => any;
onpointerlockerror: (ev: Event) => any;
/**
* Occurs to indicate progress while downloading media data.
* Occurs to indicate progress while downloading media data.
* @param ev The event.
*/
onprogress: (ev: ProgressEvent) => any;
/**
* Occurs when the playback rate is increased or decreased.
* Occurs when the playback rate is increased or decreased.
* @param ev The event.
*/
onratechange: (ev: Event) => any;
@ -2171,22 +2171,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onreadystatechange: (ev: ProgressEvent) => any;
/**
* Fires when the user resets a form.
* Fires when the user resets a form.
* @param ev The event.
*/
onreset: (ev: Event) => any;
/**
* Fires when the user repositions the scroll box in the scroll bar on the object.
* Fires when the user repositions the scroll box in the scroll bar on the object.
* @param ev The event.
*/
onscroll: (ev: UIEvent) => any;
/**
* Occurs when the seek operation ends.
* Occurs when the seek operation ends.
* @param ev The event.
*/
onseeked: (ev: Event) => any;
/**
* Occurs when the current playback position is moved.
* Occurs when the current playback position is moved.
* @param ev The event.
*/
onseeking: (ev: Event) => any;
@ -2197,7 +2197,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onselect: (ev: UIEvent) => any;
onselectstart: (ev: Event) => any;
/**
* Occurs when the download has stopped.
* Occurs when the download has stopped.
* @param ev The event.
*/
onstalled: (ev: Event) => any;
@ -2208,7 +2208,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onstop: (ev: Event) => any;
onsubmit: (ev: Event) => any;
/**
* Occurs if the load operation has been intentionally halted.
* Occurs if the load operation has been intentionally halted.
* @param ev The event.
*/
onsuspend: (ev: Event) => any;
@ -2227,7 +2227,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onvolumechange: (ev: Event) => any;
/**
* Occurs when playback stops because the next frame of a video resource is not available.
* Occurs when playback stops because the next frame of a video resource is not available.
* @param ev The event.
*/
onwaiting: (ev: Event) => any;
@ -2261,7 +2261,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
title: string;
visibilityState: string;
/**
/**
* Sets or gets the color of the links that the user has visited.
*/
vlinkColor: string;
@ -2414,7 +2414,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
createNSResolver(nodeResolver: Node): XPathNSResolver;
/**
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
* @param root The root element or node to start traversing on.
* @param whatToShow The type of nodes or elements to appear in the node list
* @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.
@ -2423,11 +2423,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;
createProcessingInstruction(target: string, data: string): ProcessingInstruction;
/**
* Returns an empty range object that has both of its boundary points positioned at the beginning of the document.
* Returns an empty range object that has both of its boundary points positioned at the beginning of the document.
*/
createRange(): Range;
/**
* Creates a text string from the specified value.
* Creates a text string from the specified value.
* @param data String that specifies the nodeValue property of the text node.
*/
createTextNode(data: string): Text;
@ -2442,7 +2442,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
@ -2667,8 +2667,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
importNode(importedNode: Node, deep: boolean): Node;
msElementsFromPoint(x: number, y: number): NodeList;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
msGetPrintDocumentForNamedFlow(flowName: string): Document;
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
/**
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
* @param url Specifies a MIME type for the document.
@ -2677,7 +2675,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
*/
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
/**
/**
* Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.
* @param commandId Specifies a command identifier.
*/
@ -2699,7 +2697,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
queryCommandSupported(commandId: string): boolean;
/**
* Retrieves the string associated with a command.
* @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.
* @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.
*/
queryCommandText(commandId: string): string;
/**
@ -2715,12 +2713,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
webkitCancelFullScreen(): void;
webkitExitFullscreen(): void;
/**
* Writes one or more HTML expressions to a document in the specified window.
* Writes one or more HTML expressions to a document in the specified window.
* @param content Specifies the text and HTML tags to write.
*/
write(...content: string[]): void;
/**
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
@ -3428,12 +3426,12 @@ interface HTMLAnchorElement extends HTMLElement {
*/
target: string;
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
type: string;
urn: string;
/**
/**
* Returns a string representation of an object.
*/
toString(): string;
@ -3534,7 +3532,7 @@ interface HTMLAreaElement extends HTMLElement {
*/
host: string;
/**
* Sets or retrieves the host name part of the location or URL.
* Sets or retrieves the host name part of the location or URL.
*/
hostname: string;
/**
@ -3570,7 +3568,7 @@ interface HTMLAreaElement extends HTMLElement {
* Sets or retrieves the window or frame at which to target content.
*/
target: string;
/**
/**
* Returns a string representation of an object.
*/
toString(): string;
@ -3853,7 +3851,7 @@ interface HTMLButtonElement extends HTMLElement {
* Overrides the target attribute on a form element.
*/
formTarget: string;
/**
/**
* Sets or retrieves the name of the object.
*/
name: string;
@ -3870,7 +3868,7 @@ interface HTMLButtonElement extends HTMLElement {
* Returns a ValidityState object that represents the validity states of an element.
*/
validity: ValidityState;
/**
/**
* Sets or retrieves the default or selected value of the control.
*/
value: string;
@ -4004,7 +4002,7 @@ declare var HTMLDirectoryElement: {
interface HTMLDivElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
* Sets or retrieves how the object is aligned with adjacent text.
*/
align: string;
/**
@ -5150,7 +5148,7 @@ interface HTMLInputElement extends HTMLElement {
*/
files: FileList;
/**
* Retrieves a reference to the form that the object is embedded in.
* Retrieves a reference to the form that the object is embedded in.
*/
form: HTMLFormElement;
/**
@ -5320,7 +5318,7 @@ interface HTMLIsIndexElement extends HTMLElement {
*/
action: string;
/**
* Retrieves a reference to the form that the object is embedded in.
* Retrieves a reference to the form that the object is embedded in.
*/
form: HTMLFormElement;
prompt: string;
@ -5879,7 +5877,7 @@ interface HTMLMetaElement extends HTMLElement {
*/
scheme: string;
/**
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
*/
url: string;
}
@ -6125,7 +6123,7 @@ declare var HTMLOptionElement: {
interface HTMLParagraphElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
* Sets or retrieves how the object is aligned with adjacent text.
*/
align: string;
clear: string;
@ -6244,10 +6242,10 @@ interface HTMLScriptElement extends HTMLElement {
*/
defer: boolean;
/**
* Sets or retrieves the event for which the script is written.
* Sets or retrieves the event for which the script is written.
*/
event: string;
/**
/**
* Sets or retrieves the object that is bound to the event script.
*/
htmlFor: string;
@ -6256,7 +6254,7 @@ interface HTMLScriptElement extends HTMLElement {
*/
src: string;
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
/**
@ -6277,7 +6275,7 @@ interface HTMLSelectElement extends HTMLElement {
autofocus: boolean;
disabled: boolean;
/**
* Retrieves a reference to the form that the object is embedded in.
* Retrieves a reference to the form that the object is embedded in.
*/
form: HTMLFormElement;
/**
@ -6302,7 +6300,7 @@ interface HTMLSelectElement extends HTMLElement {
*/
selectedIndex: number;
/**
* Sets or retrieves the number of rows in the list box.
* Sets or retrieves the number of rows in the list box.
*/
size: number;
/**
@ -6328,7 +6326,7 @@ interface HTMLSelectElement extends HTMLElement {
/**
* Adds an element to the areas, controlRange, or options collection.
* @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.
* @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection.
* @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection.
*/
add(element: HTMLElement, before?: HTMLElement | number): void;
/**
@ -6520,7 +6518,7 @@ interface HTMLTableElement extends HTMLElement {
*/
border: string;
/**
* Sets or retrieves the border color of the object.
* Sets or retrieves the border color of the object.
*/
borderColor: any;
/**
@ -6809,7 +6807,7 @@ declare var HTMLTextAreaElement: {
interface HTMLTitleElement extends HTMLElement {
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
}
@ -7239,7 +7237,7 @@ interface ImageDataConstructor {
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
}
declare var ImageData: ImageDataConstructor;
declare var ImageData: ImageDataConstructor;
interface KeyboardEvent extends UIEvent {
altKey: boolean;
@ -7490,27 +7488,6 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
interface MSHeaderFooter {
URL: string;
dateLong: string;
dateShort: string;
font: string;
htmlFoot: string;
htmlHead: string;
page: number;
pageTotal: number;
textFoot: string;
textHead: string;
timeLong: string;
timeShort: string;
title: string;
}
declare var MSHeaderFooter: {
prototype: MSHeaderFooter;
new(): MSHeaderFooter;
}
interface MSInputMethodContext extends EventTarget {
compositionEndOffset: number;
compositionStartOffset: number;
@ -7669,24 +7646,6 @@ declare var MSPointerEvent: {
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
}
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
percentScale: number;
showHeaderFooter: boolean;
shrinkToFit: boolean;
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
endPrint(): void;
getPrintTaskOptionValue(key: string): any;
invalidatePreview(): void;
setPageCount(pageCount: number): void;
startPrint(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSPrintManagerTemplatePrinter: {
prototype: MSPrintManagerTemplatePrinter;
new(): MSPrintManagerTemplatePrinter;
}
interface MSRangeCollection {
length: number;
item(index: number): Range;
@ -7734,63 +7693,6 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
interface MSTemplatePrinter {
collate: boolean;
copies: number;
currentPage: boolean;
currentPageAvail: boolean;
duplex: boolean;
footer: string;
frameActive: boolean;
frameActiveEnabled: boolean;
frameAsShown: boolean;
framesetDocument: boolean;
header: string;
headerFooterFont: string;
marginBottom: number;
marginLeft: number;
marginRight: number;
marginTop: number;
orientation: string;
pageFrom: number;
pageHeight: number;
pageTo: number;
pageWidth: number;
selectedPages: boolean;
selection: boolean;
selectionEnabled: boolean;
unprintableBottom: number;
unprintableLeft: number;
unprintableRight: number;
unprintableTop: number;
usePrinterCopyCollate: boolean;
createHeaderFooter(): MSHeaderFooter;
deviceSupports(property: string): any;
ensurePrintDialogDefaults(): boolean;
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
printBlankPage(): void;
printNonNative(document: any): boolean;
printNonNativeFrames(document: any, activeFrame: boolean): void;
printPage(element: HTMLElement): void;
showPageSetupDialog(): boolean;
showPrintDialog(): boolean;
startDoc(title: string): boolean;
stopDoc(): void;
updatePageStatus(status: number): void;
}
declare var MSTemplatePrinter: {
prototype: MSTemplatePrinter;
new(): MSTemplatePrinter;
}
interface MSWebViewAsyncOperation extends EventTarget {
error: DOMError;
oncomplete: (ev: Event) => any;
@ -8208,6 +8110,10 @@ declare var Node: {
}
interface NodeFilter {
acceptNode(n: Node): number;
}
declare var NodeFilter: {
FILTER_ACCEPT: number;
FILTER_REJECT: number;
FILTER_SKIP: number;
@ -8225,7 +8131,6 @@ interface NodeFilter {
SHOW_PROCESSING_INSTRUCTION: number;
SHOW_TEXT: number;
}
declare var NodeFilter: NodeFilter;
interface NodeIterator {
expandEntityReferences: boolean;
@ -8935,7 +8840,6 @@ declare var SVGDescElement: {
interface SVGElement extends Element {
id: string;
className: any;
onclick: (ev: MouseEvent) => any;
ondblclick: (ev: MouseEvent) => any;
onfocusin: (ev: FocusEvent) => any;
@ -8949,6 +8853,7 @@ interface SVGElement extends Element {
ownerSVGElement: SVGSVGElement;
viewportElement: SVGElement;
xmlbase: string;
className: any;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@ -11110,7 +11015,7 @@ declare var WEBGL_depth_texture: {
}
interface WaveShaperNode extends AudioNode {
curve: any;
curve: Float32Array;
oversample: string;
}
@ -11297,34 +11202,34 @@ interface WebGLRenderingContext {
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
uniform1f(location: WebGLUniformLocation, x: number): void;
uniform1fv(location: WebGLUniformLocation, v: any): void;
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform1i(location: WebGLUniformLocation, x: number): void;
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
uniform2fv(location: WebGLUniformLocation, v: any): void;
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3fv(location: WebGLUniformLocation, v: any): void;
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4fv(location: WebGLUniformLocation, v: any): void;
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
useProgram(program: WebGLProgram): void;
validateProgram(program: WebGLProgram): void;
vertexAttrib1f(indx: number, x: number): void;
vertexAttrib1fv(indx: number, values: any): void;
vertexAttrib1fv(indx: number, values: Float32Array): void;
vertexAttrib2f(indx: number, x: number, y: number): void;
vertexAttrib2fv(indx: number, values: any): void;
vertexAttrib2fv(indx: number, values: Float32Array): void;
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
vertexAttrib3fv(indx: number, values: any): void;
vertexAttrib3fv(indx: number, values: Float32Array): void;
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
vertexAttrib4fv(indx: number, values: any): void;
vertexAttrib4fv(indx: number, values: Float32Array): void;
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
viewport(x: number, y: number, width: number, height: number): void;
ACTIVE_ATTRIBUTES: number;
@ -12088,7 +11993,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
locationbar: BarProp;
menubar: BarProp;
msAnimationStartTime: number;
msTemplatePrinter: MSTemplatePrinter;
name: string;
navigator: Navigator;
offscreenBuffering: string | boolean;
@ -12825,7 +12729,6 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface NodeListOf<TNode extends Node> extends NodeList {
length: number;
item(index: number): TNode;
@ -12846,8 +12749,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@ -12863,6 +12764,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
@ -12923,7 +12826,6 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msAnimationStartTime: number;
declare var msTemplatePrinter: MSTemplatePrinter;
declare var name: string;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,14 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
@ -45,7 +45,7 @@ interface TextStreamBase {
/**
* Closes a text stream.
* It is not necessary to close standard streams; they close automatically when the process ends. If
* It is not necessary to close standard streams; they close automatically when the process ends. If
* you close a standard stream, be aware that any other pointers to that standard stream become invalid.
*/
Close(): void;

View file

@ -1,21 +1,21 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference path="lib.core.d.ts" />
/////////////////////////////
/// ECMAScript Internationalization API
/// ECMAScript Internationalization API
/////////////////////////////
declare module Intl {
@ -57,7 +57,7 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumintegerDigits?: number;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
@ -70,7 +70,7 @@ declare module Intl {
style: string;
currency?: string;
currencyDisplay?: string;
minimumintegerDigits: number;
minimumIntegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
minimumSignificantDigits?: number;
@ -158,14 +158,14 @@ interface String {
interface Number {
/**
* Converts a number to a string by using the current or specified locale.
* Converts a number to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
/**
* Converts a number to a string by using the current or specified locale.
* Converts a number to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
@ -174,41 +174,41 @@ interface Number {
interface Date {
/**
* Converts a date and time to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
@ -234,7 +234,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@ -688,7 +688,7 @@ interface ImageDataConstructor {
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
}
declare var ImageData: ImageDataConstructor;
declare var ImageData: ImageDataConstructor;
interface MSApp {
clearTemporaryWebDataAsync(): MSAppAsyncOperation;
@ -1111,7 +1111,6 @@ interface WorkerUtils extends Object, WindowBase64 {
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
@ -1126,8 +1125,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@ -1143,6 +1140,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@ function registerSupports(modeID: string, host: TypeScriptServiceClientHost, cli
languages.registerDocumentHighlightProvider(modeID, new DocumentHighlightProvider(client));
languages.registerReferenceProvider(modeID, new ReferenceProvider(client));
languages.registerDocumentSymbolProvider(modeID, new DocumentSymbolProvider(client));
languages.registerSignatureHelpProvider(modeID, new SignatureHelpProvider(client), '(', ';');
languages.registerSignatureHelpProvider(modeID, new SignatureHelpProvider(client), '(', ',');
languages.registerRenameProvider(modeID, new RenameProvider(client));
languages.registerDocumentRangeFormattingEditProvider(modeID, new FormattingProvider(client));
languages.registerOnTypeFormattingEditProvider(modeID, new FormattingProvider(client), ';', '}', '\n');
@ -149,7 +149,9 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost {
this.triggerAllDiagnostics();
};
let handleProjectChange = () => {
this.triggerAllDiagnostics();
setTimeout(() => {
this.triggerAllDiagnostics();
}, 1500);
}
let watcher = workspace.createFileSystemWatcher('**/tsconfig.json');
watcher.onDidCreate(handleProjectCreateOrDelete);

View file

@ -6,7 +6,7 @@
"contributes": {
"languages": [{
"id": "vb",
"extensions": [ ".vb" ],
"extensions": [ ".vb", ".brs" ],
"aliases": [ "Visual Basic", "vb" ],
"configuration": "./vb.configuration.json"
}],
@ -20,4 +20,4 @@
"path": "./snippets/vb.json"
}]
}
}
}

View file

@ -0,0 +1,17 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["${workspaceRoot}/../../", "${workspaceRoot}/testWorkspace", "--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "out",
"preLaunchTask": "npm"
}
]
}

View file

@ -0,0 +1,30 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",
// we want to run npm
"command": "npm",
// the command is a shell script
"isShellCommand": true,
// show the output window only if unrecognized errors occur.
"showOutput": "silent",
// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],
// The tsc compiler is started in watching mode
"isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}

View file

@ -1,9 +1,6 @@
.vscode/**
typings/**
out/test/**
test/**
**/*.ts
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md

View file

@ -1,14 +0,0 @@
# README
## This is the README for your extension "vscode-api-tests"
-------------------
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
### For more information
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
** Enjoy!**

View file

@ -1,15 +1,18 @@
{
"name": "vscode-api-tests",
"description": "",
"description": "API tests for VS Code",
"version": "0.0.1",
"publisher": "vscode",
"private": true,
"engines": {
"vscode": "*"
},
"scripts": {
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../gulpfile.plugins.js compile-plugin:vscode-api-tests ./tsconfig.json"
},
"devDependencies": {
"typescript": "^1.6.2",
"vscode": "next"
}
}

View file

@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import * as fs from 'fs';
import * as os from 'os';
import {workspace, window, Position, commands} from 'vscode';
import {createRandomFile, deleteFile, cleanUp} from './utils';
import {join} from 'path';
suite("editor tests", () => {
teardown(cleanUp);
// test('calling command completes with the extension host updated properly', () => {
// return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
// return window.showTextDocument(doc).then(editor => {
// assert.equal(window.visibleTextEditors.length, 1);
// return commands.executeCommand('workbench.action.closeAllEditors').then(() => {
// assert.equal(window.visibleTextEditors.length, 0);
// });
// });
// });
// });
});

View file

@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import * as fs from 'fs';
import * as os from 'os';
import {workspace, window, Position} from 'vscode';
import {createRandomFile, deleteFile, cleanUp} from './utils';
import {join} from 'path';
suite("editor tests", () => {
teardown(cleanUp);
test('make edit', () => {
return createRandomFile().then(file => {
return workspace.openTextDocument(file).then(doc => {
return window.showTextDocument(doc).then((editor) => {
return editor.edit((builder) => {
builder.insert(new Position(0, 0), 'Hello World');
}).then(applied => {
assert.ok(applied);
assert.equal(doc.getText(), 'Hello World');
assert.ok(doc.isDirty);
return doc.save().then(saved => {
assert.ok(saved);
assert.ok(!doc.isDirty);
return deleteFile(file);
});
});
});
});
});
});
});

View file

@ -21,7 +21,8 @@ const testRunner = require('vscode/lib/testrunner');
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
timeout: 10000
});
export= testRunner;

View file

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as os from 'os';
import {join} from 'path';
function rndName() {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
}
export function createRandomFile(contents = ''): Thenable<vscode.Uri> {
return new Promise((resolve, reject) => {
const tmpFile = join(os.tmpdir(), rndName());
fs.writeFile(tmpFile, contents, (error) => {
if (error) {
return reject(error);
}
resolve(vscode.Uri.file(tmpFile));
});
});
}
export function pathEquals(path1: string, path2: string): boolean {
if (process.platform !== 'linux') {
path1 = path1.toLowerCase();
path2 = path2.toLowerCase();
}
return path1 === path2;
}
export function deleteFile(file: vscode.Uri): Thenable<boolean> {
return new Promise((resolve, reject) => {
fs.unlink(file.fsPath, (err) => {
if (err) {
reject(err);
} else {
resolve(true);
}
});
});
}
export function cleanUp(): Thenable<any> {
return new Promise((c, e) => {
if (vscode.window.visibleTextEditors.length === 0) {
return c();
}
// TODO: the visibleTextEditors variable doesn't seem to be
// up to date after a onDidChangeActiveTextEditor event, not
// even using a setTimeout 0... so we MUST poll :(
const interval = setInterval(() => {
if (vscode.window.visibleTextEditors.length > 0) {
return;
}
clearInterval(interval);
c();
}, 10);
vscode.commands.executeCommand('workbench.action.closeAllEditors')
.then(() => vscode.commands.executeCommand('workbench.files.action.closeAllFiles'))
.then(null, err => {
clearInterval(interval);
e(err);
});
}).then(() => {
assert.equal(vscode.window.visibleTextEditors.length, 0);
assert(!vscode.window.activeTextEditor);
// TODO: we can't yet make this assertion because when
// the phost creates a document and makes no changes to it,
// the main side doesn't know about it and the phost side
// assumes it exists. Calling closeAllFiles will not
// remove it from textDocuments array. :(
// assert.equal(vscode.workspace.textDocuments.length, 0);
});
}

View file

@ -6,12 +6,21 @@
'use strict';
import * as assert from 'assert';
import {window, workspace} from 'vscode';
import {workspace, window} from 'vscode';
import {join} from 'path';
import {cleanUp, pathEquals} from './utils';
suite("window namespace texts", () => {
suite("window namespace tests", () => {
// test('open document fires event', (done) => {
// });
teardown(cleanUp);
test('active text editor', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
return window.showTextDocument(doc).then((editor) => {
const active = window.activeTextEditor;
assert.ok(active);
assert.ok(pathEquals(active.document.uri.fsPath, doc.uri.fsPath));
});
});
});
});

View file

@ -6,27 +6,30 @@
'use strict';
import * as assert from 'assert';
import {workspace, TextDocument} from 'vscode';
import {join} from 'path';
import {workspace, TextDocument, window, Position, Uri} from 'vscode';
import {createRandomFile, deleteFile, cleanUp, pathEquals} from './utils';
import {join, basename} from 'path';
import * as fs from 'fs';
import * as os from 'os';
suite('workspace-namespace', () => {
teardown(cleanUp);
test('textDocuments', () => {
assert.ok(Array.isArray(workspace.textDocuments));
assert.throws(() => workspace.textDocuments = null);
});
test('rootPath', () => {
assert.equal(workspace.rootPath, join(__dirname, '../testWorkspace'));
assert.ok(pathEquals(workspace.rootPath, join(__dirname, '../testWorkspace')));
assert.throws(() => workspace.rootPath = 'farboo');
});
test('openTextDocument', done => {
workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
test('openTextDocument', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
assert.ok(doc);
done();
}, err => {
done(err);
assert.equal(workspace.textDocuments.length, 1);
});
});
@ -38,17 +41,89 @@ suite('workspace-namespace', () => {
});
});
// test('createTextDocument', done => {
test('openTextDocument, untitled is dirty', function(done) {
if (process.platform === 'win32') {
return done(); // TODO@Joh this test fails on windows
}
workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile.txt'))).then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
assert.ok(doc.isDirty);
done();
});
});
// let text = 'Das Pferd isst keinen Reis.'
// workspace.createTextDocument(text).then(doc => {
// assert.equal(doc.getText(), text);
// test('openTextDocument, untitled closes on save', function(done) {
// workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile2.txt'))).then(doc => {
// assert.equal(doc.uri.scheme, 'untitled');
// assert.equal(doc.languageId, 'plaintext');
// done();
// }, err => {
// done(err);
// assert.ok(doc.isDirty);
// let closed: TextDocument, opened: TextDocument;
// let d0 = workspace.onDidCloseTextDocument(e => closed = e);
// let d1 = workspace.onDidOpenTextDocument(e => opened = e);
// function donedone() {
// assert.ok(closed === doc);
// assert.equal(opened.uri.scheme, 'file');
// assert.equal(opened.uri.toString(), 'file:///' + join(workspace.rootPath, './newfile2.txt'))
// d0.dispose();
// d1.dispose();
// deleteFile(opened.uri).then(done, done);
// }
// doc.save().then(donedone, done);
// });
// });
// })
test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => {
return createRandomFile().then(file => {
let disposables = [];
let onDidOpenTextDocument = false;
disposables.push(workspace.onDidOpenTextDocument(e => {
assert.ok(pathEquals(e.uri.fsPath, file.fsPath));
onDidOpenTextDocument = true;
}));
let onDidChangeTextDocument = false;
disposables.push(workspace.onDidChangeTextDocument(e => {
assert.ok(pathEquals(e.document.uri.fsPath, file.fsPath));
onDidChangeTextDocument = true;
}));
let onDidSaveTextDocument = false;
disposables.push(workspace.onDidSaveTextDocument(e => {
assert.ok(pathEquals(e.uri.fsPath, file.fsPath));
onDidSaveTextDocument = true;
}));
return workspace.openTextDocument(file).then(doc => {
return window.showTextDocument(doc).then((editor) => {
return editor.edit((builder) => {
builder.insert(new Position(0, 0), 'Hello World');
}).then(applied => {
return doc.save().then(saved => {
assert.ok(onDidOpenTextDocument);
assert.ok(onDidChangeTextDocument);
assert.ok(onDidSaveTextDocument);
while (disposables.length) {
disposables.pop().dispose();
}
return deleteFile(file);
});
});
});
});
});
});
test('findFiles', () => {
return workspace.findFiles('*.js', null).then((res) => {
assert.equal(res.length, 1);
assert.equal(basename(workspace.asRelativePath(res[0])), 'far.js');
});
});
});

View file

@ -6,13 +6,70 @@
"contributes": {
"languages": [{
"id": "xml",
"extensions": [ ".xml", ".dtd", ".ascx", ".csproj", ".config", ".wxi", ".wxl", ".wxs", ".xaml", ".svg", ".svgz" ],
"extensions": [
".ascx",
".axml",
".bpmn",
".config",
".cpt",
".csl",
".csproj",
".csproj.user",
".dita",
".ditamap",
".dtd",
".dtml",
".fsproj",
".fxml",
".iml",
".isml",
".jmx",
".launch",
".menu",
".mxml",
".nuspec",
".opml",
".owl",
".proj",
".pt",
".pubxml",
".pubxml.user",
".rdf",
".rng",
".rss",
".shproj",
".storyboard",
".svg",
".targets",
".tld",
".vbproj",
".vbproj.user",
".vcxproj",
".vcxproj.filters",
".wsdl",
".wxi",
".wxl",
".wxs",
".xaml",
".xbl",
".xib",
".xlf",
".xliff",
".xml",
".xpdl",
".xsd",
".xul",
".xoml"
],
"firstLine" : "(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",
"aliases": [ "XML", "xml" ],
"configuration": "./xml.configuration.json"
}, {
"id": "xsl",
"extensions": [ ".xsl", ".xslt" ],
"extensions": [
".xsl",
".xslt"
],
"aliases": [ "XSL", "xsl" ],
"configuration": "./xsl.configuration.json"
}],
@ -26,4 +83,4 @@
"path": "./syntaxes/XSL.plist"
}]
}
}
}

View file

@ -13,8 +13,6 @@ var mocha = require('gulp-mocha');
var es = require('event-stream');
var watch = require('./build/lib/watch');
var nls = require('./build/lib/nls');
var style = require('./build/lib/style');
var copyrights = require('./build/lib/copyrights');
var util = require('./build/lib/util');
var reporter = require('./build/lib/reporter')();
var remote = require('gulp-remote-src');
@ -115,71 +113,6 @@ gulp.task('clean', ['clean-client', 'clean-plugins']);
gulp.task('compile', ['compile-client', 'compile-plugins']);
gulp.task('watch', ['watch-client', 'watch-plugins']);
var LINE_FEED_FILES = [
'build/**/*',
'extensions/**/*',
'scripts/**/*',
'src/**/*',
'test/**/*',
'!extensions/csharp-o/bin/**',
'!extensions/**/out/**',
'!**/node_modules/**',
'!**/fixtures/**',
'!**/*.{svg,exe,png,scpt,bat,cur,ttf,woff,eot}',
];
gulp.task('eol-style', function() {
return gulp.src(LINE_FEED_FILES).pipe(style({complain:true}));
});
gulp.task('fix-eol-style', function() {
return gulp.src(LINE_FEED_FILES, { base: '.' }).pipe(style({})).pipe(gulp.dest('.'));
});
var WHITESPACE_FILES = LINE_FEED_FILES.concat([
'!**/lib/**',
'!**/*.d.ts',
'!extensions/typescript/server/**',
'!test/assert.js',
'!**/octicons/**',
'!**/vs/languages/sass/test/common/example.scss',
'!**/vs/languages/less/common/parser/less.grammar.txt',
'!**/vs/languages/css/common/buildscripts/css-schema.xml',
'!**/vs/languages/markdown/common/raw.marked.js',
'!**/vs/base/common/winjs.base.raw.js',
'!**/vs/base/node/terminateProcess.sh',
'!extensions/csharp-o/gulpfile.js',
'!**/vs/base/node/terminateProcess.sh',
'!**/vs/text.js',
'!**/vs/nls.js',
'!**/vs/css.js',
'!**/vs/loader.js',
'!extensions/**/snippets/**',
'!extensions/**/syntaxes/**',
'!extensions/**/themes/**',
]);
gulp.task('whitespace-style', function() {
return gulp.src(WHITESPACE_FILES).pipe(style({complain:true, whitespace:true}));
});
gulp.task('fix-whitespace-style', function() {
return gulp.src(WHITESPACE_FILES, { base: '.' }).pipe(style({whitespace:true})).pipe(gulp.dest('.'));
});
var COPYRIGHTS_FILES = WHITESPACE_FILES.concat([
'!**/*.json',
'!**/*.html',
'!**/test/**',
'!**/*.md',
'!**/*.sh',
'!**/*.txt',
'!src/vs/editor/standalone-languages/swift.ts',
]);
gulp.task('copyrights', function() {
return gulp.src(COPYRIGHTS_FILES, { base: '.' }).pipe(copyrights.copyrights());
});
gulp.task('insert-copyrights', function() {
return gulp.src(COPYRIGHTS_FILES, { base: '.' }).pipe(copyrights.insertCopyrights());
});
gulp.task('test', function () {
return gulp.src('test/all.js')
.pipe(mocha({ ui: 'tdd', delay: true }))
@ -215,6 +148,7 @@ gulp.task('mixin', function () {
.pipe(gulp.dest('.'));
});
require('./build/gulpfile.hygiene');
require('./build/gulpfile.vscode');
require('./build/gulpfile.editor');
require('./build/gulpfile.plugins');

27
npm-shrinkwrap.json generated
View file

@ -416,9 +416,9 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz"
},
"vscode-textmate": {
"version": "1.0.6",
"from": "vscode-textmate@1.0.6",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-1.0.6.tgz",
"version": "1.0.8",
"from": "vscode-textmate@1.0.8",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-1.0.8.tgz",
"dependencies": {
"oniguruma": {
"version": "5.1.1",
@ -439,6 +439,11 @@
}
}
},
"native-keymap": {
"version": "0.0.2",
"from": "native-keymap@0.0.2",
"resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-0.0.2.tgz"
},
"winreg": {
"version": "0.0.12",
"from": "winreg@0.0.12",
@ -460,6 +465,22 @@
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz"
}
}
},
"windows-mutex": {
"version": "0.2.0",
"from": "windows-mutex@0.2.0",
"dependencies": {
"bindings": {
"version": "1.2.1",
"from": "bindings@>=1.2.1 <2.0.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "2.1.0",
"from": "nan@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz"
}
}
}
}
}

View file

@ -1,87 +1,97 @@
{
"name": "Code",
"version": "0.10.1",
"electronVersion": "0.34.1",
"author": {
"name": "Microsoft Corporation"
},
"main": "./out/vs/workbench/electron-main/bootstrap",
"private": true,
"engines": {
"node": ">= 0.10.0 < 0.11.0"
},
"scripts": {
"test": "node node_modules/mocha/bin/_mocha",
"postinstall": "npm --prefix extensions/csharp-o/ install extensions/csharp-o/"
},
"dependencies": {
"applicationinsights": "0.15.6",
"chokidar": "1.0.5",
"emmet": "^1.3.0",
"getmac": "1.0.7",
"graceful-fs": "4.1.2",
"http-proxy-agent": "^0.2.6",
"https-proxy-agent": "^0.3.5",
"iconv-lite": "^0.4.13",
"sax": "^1.1.1",
"semver": "^4.2.0",
"vscode-textmate": "^1.0.6",
"winreg": "0.0.12",
"yauzl": "^2.3.1"
},
"devDependencies": {
"async": "^1.4.0",
"atom-shell-installer-assets": "^0.2.0",
"azure-storage": "^0.3.1",
"clone": "^1.0.2",
"debounce": "^1.0.0",
"event-stream": "^3.1.7",
"express": "^4.13.1",
"glob": "^5.0.13",
"gulp": "^3.8.9",
"gulp-atom-electron": "^0.17.2",
"gulp-azure-storage": "^0.3.0",
"gulp-bom": "^1.0.0",
"gulp-concat": "^2.6.0",
"gulp-filter": "^3.0.0",
"gulp-insert": "^0.5.0",
"gulp-json-editor": "^2.2.1",
"gulp-minify-css": "^1.2.1",
"clean-css": "3.4.6",
"gulp-mocha": "^2.1.3",
"gulp-remote-src": "^0.4.0",
"gulp-rename": "^1.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-tsb": "^1.7.3",
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-symdest": "^1.0.0",
"gulp-vinyl-zip": "^1.1.0",
"gulp-watch": "^4.2.4",
"innosetup-compiler": "^5.5.60",
"istanbul": "^0.3.17",
"jsdom-no-contextify": "^3.1.0",
"json-comments": "^0.2.1",
"lazy.js": "^0.4.2",
"mime": "1.2.11",
"minimatch": "^2.0.10",
"mkdirp": "^0.5.0",
"mocha": "^2.2.5",
"object-assign": "^4.0.1",
"optimist": "0.3.5",
"queue": "3.0.6",
"rimraf": "^2.2.8",
"sinon": "^1.17.2",
"source-map": "^0.4.4",
"uglify-js": "2.4.8",
"underscore": "^1.8.2",
"vinyl": "^0.4.5"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode.git"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode/issues"
}
}
"name": "Code",
"version": "0.10.3",
"electronVersion": "0.34.5",
"author": {
"name": "Microsoft Corporation"
},
"main": "./out/vs/workbench/electron-main/bootstrap",
"private": true,
"engines": {
"node": ">= 0.10.0 < 0.11.0"
},
"scripts": {
"test": "node node_modules/mocha/bin/_mocha",
"preinstall": "node build/npm/preinstall.js",
"postinstall": "npm --prefix extensions/vscode-api-tests/ install extensions/vscode-api-tests/"
},
"dependencies": {
"applicationinsights": "0.15.6",
"chokidar": "1.0.5",
"emmet": "^1.3.0",
"getmac": "1.0.7",
"graceful-fs": "4.1.2",
"http-proxy-agent": "^0.2.6",
"https-proxy-agent": "^0.3.5",
"iconv-lite": "^0.4.13",
"sax": "^1.1.1",
"semver": "^4.2.0",
"vscode-textmate": "^1.0.8",
"native-keymap": "^0.0.2",
"winreg": "0.0.12",
"yauzl": "^2.3.1"
},
"devDependencies": {
"async": "^1.4.0",
"azure-storage": "^0.3.1",
"clean-css": "3.4.6",
"clone": "^1.0.2",
"debounce": "^1.0.0",
"event-stream": "^3.1.7",
"express": "^4.13.1",
"ghooks": "^1.0.1",
"glob": "^5.0.13",
"gulp": "^3.8.9",
"gulp-atom-electron": "^1.1.0",
"gulp-azure-storage": "^0.3.0",
"gulp-bom": "^1.0.0",
"gulp-concat": "^2.6.0",
"gulp-filter": "^3.0.0",
"gulp-insert": "^0.5.0",
"gulp-json-editor": "^2.2.1",
"gulp-minify-css": "^1.2.1",
"gulp-mocha": "^2.1.3",
"gulp-remote-src": "^0.4.0",
"gulp-rename": "^1.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-symdest": "^1.0.0",
"gulp-tsb": "^1.7.3",
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-vinyl-zip": "^1.1.0",
"gulp-watch": "^4.2.4",
"innosetup-compiler": "^5.5.60",
"istanbul": "^0.3.17",
"jsdom-no-contextify": "^3.1.0",
"json-comments": "^0.2.1",
"lazy.js": "^0.4.2",
"mime": "1.2.11",
"minimatch": "^2.0.10",
"mkdirp": "^0.5.0",
"mocha": "^2.2.5",
"object-assign": "^4.0.1",
"optimist": "0.3.5",
"queue": "3.0.6",
"rimraf": "^2.2.8",
"sinon": "^1.17.2",
"source-map": "^0.4.4",
"uglify-js": "2.4.8",
"underscore": "^1.8.2",
"vinyl": "^0.4.5"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode.git"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode/issues"
},
"config": {
"ghooks": {
"pre-commit": "node build/gulpfile.hygiene.js"
}
},
"optionalDependencies": {
"windows-mutex": "^0.2.0"
}
}

View file

@ -4,6 +4,7 @@
"win32ExeBasename": "CodeOSS",
"companyName": "Microsoft Corporation",
"copyright": "Copyright (C) 2015 Microsoft. All rights reserved",
"licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt",
"darwinBundleIdentifier": "code.visualstudio.com.Code",
"darwinApplicationCategoryType": "public.app-category.developer-tools",
"darwinBundleDocumentTypes": [{

View file

@ -1,12 +1,24 @@
@echo off
title VSCode Dev
pushd %~dp0\..
:: Node modules
if not exist node_modules call .\scripts\npm.bat install
:: Get electron
node .\node_modules\gulp\bin\gulp.js electron
:: Build
if not exist out node .\node_modules\gulp\bin\gulp.js compile
:: Configuration
set NODE_ENV=development
set VSCODE_DEV=1
set ELECTRON_DEFAULT_ERROR_MODE=1
set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1
pushd %~dp0\..
node .\node_modules\gulp\bin\gulp.js electron
..\Electron-Build\CodeOSS.exe . %*
:: Launch Code
.\.build\electron\CodeOSS.exe . %*
popd

View file

@ -7,17 +7,30 @@ else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
# Configuration
export NODE_ENV=development
export VSCODE_DEV=1
export ELECTRON_ENABLE_LOGGING=1
export ELECTRON_ENABLE_STACK_DUMPING=1
function code() {
cd $ROOT
# Prepare
cd $ROOT ; node node_modules/gulp/bin/gulp.js electron
# Node modules
test -d node_modules || ./scripts/npm.sh install
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT; ../Electron-Build/Electron.app/Contents/MacOS/Electron . $*
else
cd $ROOT; ../Electron-Build/electron . $*
fi
# Get electron
node node_modules/gulp/bin/gulp.js electron
# Build
test -d out || gulp compile
# Configuration
export NODE_ENV=development
export VSCODE_DEV=1
export ELECTRON_ENABLE_LOGGING=1
export ELECTRON_ENABLE_STACK_DUMPING=1
# Launch Code
if [[ "$OSTYPE" == "darwin"* ]]; then
./.build/electron/Electron.app/Contents/MacOS/Electron . $*
else
./.build/electron/electron . $*
fi
}
code $*

14
src/bootstrap.js vendored
View file

@ -63,16 +63,24 @@ if (!!process.send && process.env.PIPE_LOGGING === 'true') {
return res;
}
function safeSend(arg) {
try {
process.send(arg);
} catch (error) {
// Can happen if the parent channel is closed meanwhile
}
}
// Pass console logging to the outside so that we have it in the main side if told so
if (process.env.VERBOSE_LOGGING === 'true') {
console.log = function () { process.send({ type: '__$console', severity: 'log', arguments: safeStringify(arguments) }); };
console.warn = function () { process.send({ type: '__$console', severity: 'warn', arguments: safeStringify(arguments) }); };
console.log = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeStringify(arguments) }); };
console.warn = function () { safeSend({ type: '__$console', severity: 'warn', arguments: safeStringify(arguments) }); };
} else {
console.log = function () { /* ignore */ };
console.warn = function () { /* ignore */ };
}
console.error = function () { process.send({ type: '__$console', severity: 'error', arguments: safeStringify(arguments) }); };
console.error = function () { safeSend({ type: '__$console', severity: 'error', arguments: safeStringify(arguments) }); };
// Let stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF
// error when we are inside a forked process and this process tries to access those channels.

View file

@ -5,8 +5,19 @@
declare module 'https-proxy-agent' {
import * as tls from 'tls';
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
host: string;
port: number;
secureProxy?: boolean;
secureEndpoint?: boolean;
}
class HttpsProxyAgent {
constructor(proxy: string);
constructor(opts: IHttpsProxyAgentOptions);
}
export = HttpsProxyAgent;
}

Some files were not shown because too many files have changed in this diff Show more