提交 a57a2a92 编写于 作者: J Joao Moreno

Merge branch 'master' into yaml-builds

* text=auto
LICENSE.txt eol=crlf
ThirdPartyNotices.txt eol=crlf
*.bat eol=crlf
*.cmd eol=crlf
*.ps1 eol=lf
*.sh eol=lf
\ No newline at end of file
.DS_Store
npm-debug.log
Thumbs.db
node_modules/
.build/
out/
out-build/
out-editor/
out-editor-min/
out-monaco-editor-core/
out-vscode/
out-vscode-min/
build/node_modules
coverage/
test_data/
.DS_Store
npm-debug.log
Thumbs.db
node_modules/
.build/
out/
out-build/
out-editor/
out-editor-min/
out-monaco-editor-core/
out-vscode/
out-vscode-min/
build/node_modules
coverage/
test_data/
yarn-error.log
\ No newline at end of file
{
"editor.insertSpaces": false,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.exclude": {
".git": true,
".build": true,
"**/.DS_Store": true,
"build/**/*.js": {
"when": "$(basename).ts"
}
},
"files.associations": {
"OSSREADME.json": "jsonc"
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
".build/**": true,
"out/**": true,
"out-build/**": true,
"out-vscode/**": true,
"i18n/**": true,
"extensions/**/out/**": true,
"test/smoke/out/**": true
},
"tslint.enable": true,
"lcov.path": [
"./.build/coverage/lcov.info",
"./.build/coverage-single/lcov.info"
],
"lcov.watch": [
{
"pattern": "**/*.test.js",
"command": "${workspaceFolder}/scripts/test.sh --coverage --run ${file}",
"windows": {
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
}
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"npm.exclude": "**/extensions/**"
}
{
"editor.insertSpaces": false,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.exclude": {
".git": true,
".build": true,
"**/.DS_Store": true,
"build/**/*.js": {
"when": "$(basename).ts"
}
},
"files.associations": {
"OSSREADME.json": "jsonc"
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
".build/**": true,
"out/**": true,
"out-build/**": true,
"out-vscode/**": true,
"i18n/**": true,
"extensions/**/out/**": true,
"test/smoke/out/**": true
},
"tslint.enable": true,
"lcov.path": [
"./.build/coverage/lcov.info",
"./.build/coverage-single/lcov.info"
],
"lcov.watch": [
{
"pattern": "**/*.test.js",
"command": "${workspaceFolder}/scripts/test.sh --coverage --run ${file}",
"windows": {
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
}
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"npm.exclude": "**/extensions/**"
}
\ No newline at end of file
MIT License
Copyright (c) 2015 - present Microsoft Corporation
All rights reserved.
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.
MIT License
Copyright (c) 2015 - present Microsoft Corporation
All rights reserved.
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.
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -33,58 +33,56 @@ const all = [
'extensions/**/*',
'scripts/**/*',
'src/**/*',
'test/**/*'
'test/**/*',
'!**/node_modules/**'
];
const eolFilter = [
const indentationFilter = [
'**',
// except specific files
'!ThirdPartyNotices.txt',
'!LICENSE.txt',
'!extensions/**/out/**',
'!src/vs/nls.js',
'!src/vs/css.js',
'!src/vs/loader.js',
'!src/vs/base/common/marked/raw.marked.js',
'!src/vs/base/common/winjs.base.raw.js',
'!src/vs/base/node/terminateProcess.sh',
'!src/vs/base/node/ps-win.ps1',
'!test/assert.js',
// except specific folders
'!test/smoke/out/**',
'!**/node_modules/**',
'!**/fixtures/**',
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot}',
'!build/{lib,tslintRules}/**/*.js',
'!extensions/vscode-api-tests/testWorkspace/**',
'!extensions/vscode-api-tests/testWorkspace2/**',
'!build/monaco/**',
'!build/win32/**',
'!build/**/*.sh',
'!build/tfs/**/*.js',
'!**/Dockerfile',
'!extensions/markdown/media/*.js'
];
const indentationFilter = [
'**',
'!ThirdPartyNotices.txt',
'!**/*.md',
'!**/*.ps1',
'!**/*.template',
'!**/*.yaml',
'!**/*.yml',
'!**/yarn.lock',
'!**/lib/**',
'!extensions/**/*.d.ts',
'!src/typings/**/*.d.ts',
'!src/vs/*/**/*.d.ts',
'!**/*.d.ts.recipe',
'!test/assert.js',
// except multiple specific files
'!**/package.json',
'!**/yarn.lock',
// except multiple specific folders
'!**/octicons/**',
'!**/vs/base/common/marked/raw.marked.js',
'!**/vs/base/common/winjs.base.raw.js',
'!**/vs/base/node/terminateProcess.sh',
'!**/vs/base/node/ps-win.ps1',
'!**/vs/nls.js',
'!**/vs/css.js',
'!**/vs/loader.js',
'!**/fixtures/**',
'!**/lib/**',
'!extensions/**/out/**',
'!extensions/**/snippets/**',
'!extensions/**/syntaxes/**',
'!extensions/**/themes/**',
'!extensions/**/colorize-fixtures/**',
'!extensions/markdown/media/*.js',
'!extensions/vscode-api-tests/testWorkspace/**',
'!extensions/vscode-api-tests/testWorkspace2/**'
// except specific file types
'!src/vs/*/**/*.d.ts',
'!src/typings/**/*.d.ts',
'!extensions/**/*.d.ts',
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe}',
'!build/{lib,tslintRules}/**/*.js',
'!build/**/*.sh',
'!build/tfs/**/*.js',
'!**/Dockerfile',
'!extensions/markdown/media/*.js'
];
const copyrightFilter = [
......@@ -107,7 +105,6 @@ const copyrightFilter = [
'!resources/linux/snap/snapcraft.yaml',
'!resources/win32/bin/code.js',
'!extensions/markdown/media/tomorrow.css',
'!extensions/markdown/media/*.js',
'!extensions/html/server/src/modes/typescript/*'
];
......@@ -138,12 +135,12 @@ const tslintFilter = [
'!extensions/html/server/lib/jquery.d.ts'
];
const copyrightHeader = [
const copyrightHeaderLines = [
'/*---------------------------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Licensed under the MIT License. See License.txt in the project root for license information.',
' *--------------------------------------------------------------------------------------------*/'
].join('\n');
];
gulp.task('eslint', () => {
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
......@@ -162,23 +159,14 @@ gulp.task('tslint', () => {
.pipe(gulptslint.default.report(options));
});
function hygiene(some, options) {
options = options || {};
function hygiene(some) {
let errorCount = 0;
const 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);
});
const indentation = es.through(function (file) {
file.contents
.toString('utf8')
.split(/\r\n|\r|\n/)
const lines = file.contents.toString('utf8').split(/\r\n|\r|\n/);
file.__lines = lines;
lines
.forEach((line, i) => {
if (/^\s*$/.test(line)) {
// empty or whitespace lines are OK
......@@ -196,9 +184,14 @@ function hygiene(some, options) {
});
const copyrights = es.through(function (file) {
if (file.contents.toString('utf8').indexOf(copyrightHeader) !== 0) {
console.error(file.relative + ': Missing or bad copyright statement');
errorCount++;
const lines = file.__lines;
for (let i = 0; i < copyrightHeaderLines.length; i++) {
if (lines[i] !== copyrightHeaderLines[i]) {
console.error(file.relative + ': Missing or bad copyright statement');
errorCount++;
break;
}
}
this.emit('data', file);
......@@ -206,7 +199,7 @@ function hygiene(some, options) {
const formatting = es.map(function (file, cb) {
tsfmt.processString(file.path, file.contents.toString('utf8'), {
verify: true,
verify: false,
tsfmt: true,
// verbose: true
// keep checkJS happy
......@@ -215,8 +208,11 @@ function hygiene(some, options) {
tsconfig: undefined,
tslint: undefined
}).then(result => {
if (result.error) {
console.error(result.message);
let original = result.src.replace(/\r\n/gm, '\n');
let formatted = result.dest.replace(/\r\n/gm, '\n');
if (original !== formatted) {
console.error('File not formatted:', file.relative);
errorCount++;
}
cb(null, file);
......@@ -246,8 +242,6 @@ function hygiene(some, options) {
const result = input
.pipe(filter(f => !f.stat.isDirectory()))
.pipe(filter(eolFilter))
.pipe(options.skipEOL ? es.through() : eol)
.pipe(filter(indentationFilter))
.pipe(indentation)
.pipe(filter(copyrightFilter))
......@@ -340,17 +334,13 @@ if (require.main === module) {
process.exit(1);
});
cp.exec('git config core.autocrlf', (err, out) => {
const skipEOL = out.trim() === 'true';
if (process.argv.length > 2) {
return hygiene(process.argv.slice(2), { skipEOL: skipEOL }).on('error', err => {
console.error();
console.error(err);
process.exit(1);
});
}
if (process.argv.length > 2) {
hygiene(process.argv.slice(2)).on('error', err => {
console.error();
console.error(err);
process.exit(1);
});
} else {
cp.exec('git diff --cached --name-only', { maxBuffer: 2000 * 1024 }, (err, out) => {
if (err) {
console.error();
......@@ -367,7 +357,7 @@ if (require.main === module) {
console.log('Reading git index versions...');
createGitIndexVinyls(some)
.then(vinyls => new Promise((c, e) => hygiene(es.readArray(vinyls), { skipEOL: skipEOL })
.then(vinyls => new Promise((c, e) => hygiene(es.readArray(vinyls))
.on('end', () => c())
.on('error', e)))
.catch(err => {
......@@ -377,5 +367,5 @@ if (require.main === module) {
});
}
});
});
}
}
......@@ -78,7 +78,7 @@ const vscodeResources = [
'out-build/vs/workbench/electron-browser/bootstrap/**',
'out-build/vs/workbench/parts/debug/**/*.json',
'out-build/vs/workbench/parts/execution/**/*.scpt',
'out-build/vs/workbench/parts/html/browser/webview-pre.js',
'out-build/vs/workbench/parts/html/electron-browser/webview-pre.js',
'out-build/vs/**/markdown.css',
'out-build/vs/workbench/parts/tasks/**/*.json',
'out-build/vs/workbench/parts/terminal/electron-browser/terminalProcess.js',
......
......@@ -27,6 +27,7 @@ if (process.env['VSCODE_NO_SOURCEMAP']) {
}
options.rootDir = rootDir;
options.sourceRoot = util.toFileUri(rootDir);
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
function createCompile(build, emitError) {
var opts = _.clone(options);
opts.inlineSources = !!build;
......
......@@ -30,6 +30,7 @@ if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
}
options.rootDir = rootDir;
options.sourceRoot = util.toFileUri(rootDir);
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
function createCompile(build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
const opts = _.clone(options);
......
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
This project incorporates components from the projects listed below. The original copyright notices and the licenses
under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted
herein, whether by implication, estoppel or otherwise.
%% winjs version 4.4.0 (https://github.com/winjs/winjs)
=========================================
WinJS
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
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.
=========================================
END OF winjs NOTICES AND INFORMATION
%% string_scorer version 0.1.20 (https://github.com/joshaven/string_score)
=========================================
This software is released under the MIT license:
Copyright (c) Joshaven Potter
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.
=========================================
END OF string_scorer NOTICES AND INFORMATION
%% chjj-marked NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
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.
=========================================
END OF chjj-marked NOTICES AND INFORMATION
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
This project incorporates components from the projects listed below. The original copyright notices and the licenses
under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted
herein, whether by implication, estoppel or otherwise.
%% winjs version 4.4.0 (https://github.com/winjs/winjs)
=========================================
WinJS
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
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.
=========================================
END OF winjs NOTICES AND INFORMATION
%% string_scorer version 0.1.20 (https://github.com/joshaven/string_score)
=========================================
This software is released under the MIT license:
Copyright (c) Joshaven Potter
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.
=========================================
END OF string_scorer NOTICES AND INFORMATION
%% chjj-marked NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
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.
=========================================
END OF chjj-marked NOTICES AND INFORMATION
......@@ -210,7 +210,8 @@ function createReplacer(data) {
};
}
function generateDeclarationFile(out, inputFiles, recipe) {
var lines = recipe.split(/\r\n|\n|\r/);
var endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
var lines = recipe.split(endl);
var result = [];
lines.forEach(function (line) {
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
......@@ -278,12 +279,11 @@ function generateDeclarationFile(out, inputFiles, recipe) {
}
result.push(line);
});
var resultTxt = result.join('\n');
var resultTxt = result.join(endl);
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
resultTxt = format(resultTxt);
resultTxt = resultTxt.replace(/\r\n/g, '\n');
return resultTxt;
}
function getFilesToWatch(out) {
......@@ -314,10 +314,13 @@ function run(out, inputFiles) {
var result = generateDeclarationFile(out, inputFiles, recipe);
var currentContent = fs.readFileSync(DECLARATION_PATH).toString();
log('Finished monaco.d.ts generation');
var one = currentContent.replace(/\r\n/gm, '\n');
var other = result.replace(/\r\n/gm, '\n');
var isTheSame = one === other;
return {
content: result,
filePath: DECLARATION_PATH,
isTheSame: currentContent === result
isTheSame: isTheSame
};
}
exports.run = run;
......
......@@ -24,15 +24,15 @@ function logErr(message: any, ...rest: any[]): void {
util.log(util.colors.red('[monaco.d.ts]'), message, ...rest);
}
function moduleIdToPath(out:string, moduleId:string): string {
function moduleIdToPath(out: string, moduleId: string): string {
if (/\.d\.ts/.test(moduleId)) {
return path.join(SRC, moduleId);
}
return path.join(OUT_ROOT, out, moduleId) + '.d.ts';
}
let SOURCE_FILE_MAP: {[moduleId:string]:ts.SourceFile;} = {};
function getSourceFile(out:string, inputFiles: { [file: string]: string; }, moduleId:string): ts.SourceFile {
let SOURCE_FILE_MAP: { [moduleId: string]: ts.SourceFile; } = {};
function getSourceFile(out: string, inputFiles: { [file: string]: string; }, moduleId: string): ts.SourceFile {
if (!SOURCE_FILE_MAP[moduleId]) {
let filePath = path.normalize(moduleIdToPath(out, moduleId));
......@@ -53,7 +53,7 @@ function getSourceFile(out:string, inputFiles: { [file: string]: string; }, modu
type TSTopLevelDeclaration = ts.InterfaceDeclaration | ts.EnumDeclaration | ts.ClassDeclaration | ts.TypeAliasDeclaration | ts.FunctionDeclaration | ts.ModuleDeclaration;
type TSTopLevelDeclare = TSTopLevelDeclaration | ts.VariableStatement;
function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
function isDeclaration(a: TSTopLevelDeclare): a is TSTopLevelDeclaration {
return (
a.kind === ts.SyntaxKind.InterfaceDeclaration
|| a.kind === ts.SyntaxKind.EnumDeclaration
......@@ -64,7 +64,7 @@ function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
);
}
function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTopLevelDeclare)=>boolean): void {
function visitTopLevelDeclarations(sourceFile: ts.SourceFile, visitor: (node: TSTopLevelDeclare) => boolean): void {
let stop = false;
let visit = (node: ts.Node): void => {
......@@ -100,8 +100,8 @@ function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTop
}
function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare[] {
let all:TSTopLevelDeclare[] = [];
function getAllTopLevelDeclarations(sourceFile: ts.SourceFile): TSTopLevelDeclare[] {
let all: TSTopLevelDeclare[] = [];
visitTopLevelDeclarations(sourceFile, (node) => {
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
let interfaceDeclaration = <ts.InterfaceDeclaration>node;
......@@ -128,8 +128,8 @@ function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare
}
function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTopLevelDeclare {
let result:TSTopLevelDeclare = null;
function getTopLevelDeclaration(sourceFile: ts.SourceFile, typeName: string): TSTopLevelDeclare {
let result: TSTopLevelDeclare = null;
visitTopLevelDeclarations(sourceFile, (node) => {
if (isDeclaration(node)) {
if (node.name.text === typeName) {
......@@ -149,12 +149,12 @@ function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTo
}
function getNodeText(sourceFile:ts.SourceFile, node:{pos:number; end:number;}): string {
function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number; }): string {
return sourceFile.getFullText().substring(node.pos, node.end);
}
function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaration: TSTopLevelDeclare): string {
function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare): string {
let result = getNodeText(sourceFile, declaration);
// if (result.indexOf('MonacoWorker') >= 0) {
// console.log('here!');
......@@ -163,7 +163,7 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
let members:ts.NodeArray<ts.Node> = interfaceDeclaration.members;
let members: ts.NodeArray<ts.Node> = interfaceDeclaration.members;
members.forEach((member) => {
try {
let memberText = getNodeText(sourceFile, member);
......@@ -182,7 +182,7 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
return result;
}
function format(text:string): string {
function format(text: string): string {
// Parse the source text
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
......@@ -214,10 +214,10 @@ function format(text:string): string {
}
}
function createReplacer(data:string): (str:string)=>string {
function createReplacer(data: string): (str: string) => string {
data = data || '';
let rawDirectives = data.split(';');
let directives: [RegExp,string][] = [];
let directives: [RegExp, string][] = [];
rawDirectives.forEach((rawDirective) => {
if (rawDirective.length === 0) {
return;
......@@ -231,7 +231,7 @@ function createReplacer(data:string): (str:string)=>string {
directives.push([new RegExp(findStr, 'g'), replaceStr]);
});
return (str:string)=> {
return (str: string) => {
for (let i = 0; i < directives.length; i++) {
str = str.replace(directives[i][0], directives[i][1]);
}
......@@ -239,10 +239,11 @@ function createReplacer(data:string): (str:string)=>string {
};
}
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe:string): string {
let lines = recipe.split(/\r\n|\n|\r/);
let result = [];
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe: string): string {
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
let lines = recipe.split(endl);
let result = [];
lines.forEach(line => {
......@@ -285,7 +286,7 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
let replacer = createReplacer(m2[2]);
let typeNames = m2[3].split(/,/);
let typesToExcludeMap: {[typeName:string]:boolean;} = {};
let typesToExcludeMap: { [typeName: string]: boolean; } = {};
let typesToExcludeArr: string[] = [];
typeNames.forEach((typeName) => {
typeName = typeName.trim();
......@@ -318,18 +319,17 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
result.push(line);
});
let resultTxt = result.join('\n');
let resultTxt = result.join(endl);
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
resultTxt = format(resultTxt);
resultTxt = resultTxt.replace(/\r\n/g, '\n');
return resultTxt;
}
export function getFilesToWatch(out:string): string[] {
export function getFilesToWatch(out: string): string[] {
let recipe = fs.readFileSync(RECIPE_PATH).toString();
let lines = recipe.split(/\r\n|\n|\r/);
let result = [];
......@@ -370,10 +370,14 @@ export function run(out: string, inputFiles: { [file: string]: string; }): IMona
let currentContent = fs.readFileSync(DECLARATION_PATH).toString();
log('Finished monaco.d.ts generation');
const one = currentContent.replace(/\r\n/gm, '\n');
const other = result.replace(/\r\n/gm, '\n');
const isTheSame = one === other;
return {
content: result,
filePath: DECLARATION_PATH,
isTheSame: currentContent === result
isTheSame
};
}
......
......@@ -7,7 +7,6 @@
"preserveConstEnums": true,
"sourceMap": false,
"experimentalDecorators": true,
"newLine": "LF",
// enable JavaScript type checking for the language service
// use the tsconfig.build.json for compiling wich disable JavaScript
// type checking so that JavaScript file are not transpiled
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
[CustomMessages]
AddContextMenuFiles=Aktion "Mit %1 ffnen" dem Dateikontextmen von Windows-Explorer hinzufgen
AddContextMenuFolders=Aktion "Mit %1 ffnen" dem Verzeichniskontextmen von Windows-Explorer hinzufgen
AssociateWithFiles=%1 als Editor fr untersttzte Dateitypen registrieren
AddToPath=Zu PATH hinzufgen (nach dem Neustart verfgbar)
RunAfter=%1 nach der Installation ausfhren
Other=Andere:
[CustomMessages]
AddContextMenuFiles=Aktion "Mit %1 ffnen" dem Dateikontextmen von Windows-Explorer hinzufgen
AddContextMenuFolders=Aktion "Mit %1 ffnen" dem Verzeichniskontextmen von Windows-Explorer hinzufgen
AssociateWithFiles=%1 als Editor fr untersttzte Dateitypen registrieren
AddToPath=Zu PATH hinzufgen (nach dem Neustart verfgbar)
RunAfter=%1 nach der Installation ausfhren
Other=Andere:
SourceFile=%1-Quelldatei
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Add "Open with %1" action to Windows Explorer file context menu
AddContextMenuFolders=Add "Open with %1" action to Windows Explorer directory context menu
AssociateWithFiles=Register %1 as an editor for supported file types
AddToPath=Add to PATH (available after restart)
RunAfter=Run %1 after installation
Other=Other:
[CustomMessages]
AddContextMenuFiles=Add "Open with %1" action to Windows Explorer file context menu
AddContextMenuFolders=Add "Open with %1" action to Windows Explorer directory context menu
AssociateWithFiles=Register %1 as an editor for supported file types
AddToPath=Add to PATH (available after restart)
RunAfter=Run %1 after installation
Other=Other:
SourceFile=%1 Source File
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Agregar la acción "Abrir con %1" al menú contextual de archivo del Explorador de Windows
AddContextMenuFolders=Agregar la acción "Abrir con %1" al menú contextual de directorio del Explorador de Windows
AssociateWithFiles=Registrar %1 como editor para tipos de archivo admitidos
AddToPath=Agregar a PATH (disponible después de reiniciar)
RunAfter=Ejecutar %1 después de la instalación
Other=Otros:
[CustomMessages]
AddContextMenuFiles=Agregar la acción "Abrir con %1" al menú contextual de archivo del Explorador de Windows
AddContextMenuFolders=Agregar la acción "Abrir con %1" al menú contextual de directorio del Explorador de Windows
AssociateWithFiles=Registrar %1 como editor para tipos de archivo admitidos
AddToPath=Agregar a PATH (disponible después de reiniciar)
RunAfter=Ejecutar %1 después de la instalación
Other=Otros:
SourceFile=Archivo de origen %1
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Ajouter l'action "Ouvrir avec %1" au menu contextuel de fichier de l'Explorateur Windows
AddContextMenuFolders=Ajouter l'action "Ouvrir avec %1" au menu contextuel de répertoire de l'Explorateur Windows
AssociateWithFiles=Inscrire %1 en tant qu'éditeur pour les types de fichier pris en charge
AddToPath=Ajouter à PATH (disponible après le redémarrage)
RunAfter=Exécuter %1 après l'installation
Other=Autre :
[CustomMessages]
AddContextMenuFiles=Ajouter l'action "Ouvrir avec %1" au menu contextuel de fichier de l'Explorateur Windows
AddContextMenuFolders=Ajouter l'action "Ouvrir avec %1" au menu contextuel de répertoire de l'Explorateur Windows
AssociateWithFiles=Inscrire %1 en tant qu'éditeur pour les types de fichier pris en charge
AddToPath=Ajouter à PATH (disponible après le redémarrage)
RunAfter=Exécuter %1 après l'installation
Other=Autre :
SourceFile=Fichier source %1
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles="Megnyits a kvetkezvel: %1" parancs hozzadsa a fjlok helyi menjhez a Windows Intzben
AddContextMenuFolders="Megnyits a kvetkezvel: %1" parancs hozzadsa a mappk helyi menjhez a Windows Intzben
AssociateWithFiles=%1 regisztrlsa szerkesztknt a tmogatott fjltpusokhoz
AddToPath=Hozzads a PATH-hoz (jraindts utn lesz elrhet)
RunAfter=%1 indtsa a telepts utn
Other=Egyb:
[CustomMessages]
AddContextMenuFiles="Megnyits a kvetkezvel: %1" parancs hozzadsa a fjlok helyi menjhez a Windows Intzben
AddContextMenuFolders="Megnyits a kvetkezvel: %1" parancs hozzadsa a mappk helyi menjhez a Windows Intzben
AssociateWithFiles=%1 regisztrlsa szerkesztknt a tmogatott fjltpusokhoz
AddToPath=Hozzads a PATH-hoz (jraindts utn lesz elrhet)
RunAfter=%1 indtsa a telepts utn
Other=Egyb:
SourceFile=%1 forrsfjl
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Aggiungi azione "Apri con %1" al menu di scelta rapida file di Esplora risorse
AddContextMenuFolders=Aggiungi azione "Apri con %1" al menu di scelta rapida directory di Esplora risorse
AssociateWithFiles=Registra %1 come editor per i tipi di file supportati
AddToPath=Aggiungi a PATH (disponibile dopo il riavvio)
RunAfter=Esegui %1 dopo l'installazione
Other=Altro:
[CustomMessages]
AddContextMenuFiles=Aggiungi azione "Apri con %1" al menu di scelta rapida file di Esplora risorse
AddContextMenuFolders=Aggiungi azione "Apri con %1" al menu di scelta rapida directory di Esplora risorse
AssociateWithFiles=Registra %1 come editor per i tipi di file supportati
AddToPath=Aggiungi a PATH (disponibile dopo il riavvio)
RunAfter=Esegui %1 dopo l'installazione
Other=Altro:
SourceFile=File di origine %1
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=エクスプローラーのファイル コンテキスト メニューに [%1 で開く] アクションを追加する
AddContextMenuFolders=エクスプローラーのディレクトリ コンテキスト メニューに [%1 で開く] アクションを追加する
AssociateWithFiles=サポートされているファイルの種類のエディターとして、%1 を登録する
AddToPath=PATH への追加(再起動後に使用可能)
RunAfter=インストール後に %1 を実行する
Other=その他:
[CustomMessages]
AddContextMenuFiles=エクスプローラーのファイル コンテキスト メニューに [%1 で開く] アクションを追加する
AddContextMenuFolders=エクスプローラーのディレクトリ コンテキスト メニューに [%1 で開く] アクションを追加する
AssociateWithFiles=サポートされているファイルの種類のエディターとして、%1 を登録する
AddToPath=PATH への追加(再起動後に使用可能)
RunAfter=インストール後に %1 を実行する
Other=その他:
SourceFile=%1 ソース ファイル
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles="%1(으)로 열기" 작업을 Windows 탐색기 파일의 상황에 맞는 메뉴에 추가
AddContextMenuFolders="%1(으)로 열기" 작업을 Windows 탐색기 디렉터리의 상황에 맞는 메뉴에 추가
AssociateWithFiles=%1을(를) 지원되는 파일 형식에 대한 편집기로 등록합니다.
AddToPath=PATH에 추가(다시 시작한 후 사용 가능)
RunAfter=설치 후 %1 실행
Other=기타:
[CustomMessages]
AddContextMenuFiles="%1(으)로 열기" 작업을 Windows 탐색기 파일의 상황에 맞는 메뉴에 추가
AddContextMenuFolders="%1(으)로 열기" 작업을 Windows 탐색기 디렉터리의 상황에 맞는 메뉴에 추가
AssociateWithFiles=%1을(를) 지원되는 파일 형식에 대한 편집기로 등록합니다.
AddToPath=PATH에 추가(다시 시작한 후 사용 가능)
RunAfter=설치 후 %1 실행
Other=기타:
SourceFile=%1 원본 파일
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Adicione a ação "Abrir com %1" ao menu de contexto de arquivo do Windows Explorer
AddContextMenuFolders=Adicione a ação "Abrir com %1" ao menu de contexto de diretório do Windows Explorer
AssociateWithFiles=Registre %1 como um editor para tipos de arquivos suportados
AddToPath=Adicione em PATH (disponível após reiniciar)
RunAfter=Executar %1 após a instalação
Other=Outros:
[CustomMessages]
AddContextMenuFiles=Adicione a ação "Abrir com %1" ao menu de contexto de arquivo do Windows Explorer
AddContextMenuFolders=Adicione a ação "Abrir com %1" ao menu de contexto de diretório do Windows Explorer
AssociateWithFiles=Registre %1 como um editor para tipos de arquivos suportados
AddToPath=Adicione em PATH (disponível após reiniciar)
RunAfter=Executar %1 após a instalação
Other=Outros:
SourceFile=Arquivo Fonte %1
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles= " %1" Windows
AddContextMenuFolders= " %1"
AssociateWithFiles= %1
AddToPath= PATH ( )
RunAfter= %1
Other=:
[CustomMessages]
AddContextMenuFiles= " %1" Windows
AddContextMenuFolders= " %1"
AssociateWithFiles= %1
AddToPath= PATH ( )
RunAfter= %1
Other=:
SourceFile= %1
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=Windows Gezgini balam mensne "%1 le A" eylemini ekle
AddContextMenuFolders=Windows Gezgini dizin balam mensne "%1 le A" eylemini ekle
AssociateWithFiles=%1 uygulamasn desteklenen dosya trleri iin bir dzenleyici olarak kayt et
AddToPath=PATH'e ekle (yeniden balattktan sonra kullanlabilir)
RunAfter=Kurulumdan sonra %1 uygulamasn altr.
Other=Dier:
[CustomMessages]
AddContextMenuFiles=Windows Gezgini balam mensne "%1 le A" eylemini ekle
AddContextMenuFolders=Windows Gezgini dizin balam mensne "%1 le A" eylemini ekle
AssociateWithFiles=%1 uygulamasn desteklenen dosya trleri iin bir dzenleyici olarak kayt et
AddToPath=PATH'e ekle (yeniden balattktan sonra kullanlabilir)
RunAfter=Kurulumdan sonra %1 uygulamasn altr.
Other=Dier:
SourceFile=%1 Kaynak Dosyas
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=将“通过 %1 打开”操作添加到 Windows 资源管理器文件上下文菜单
AddContextMenuFolders=将“通过 %1 打开”操作添加到 Windows 资源管理器目录上下文菜单
AssociateWithFiles=将 %1 注册为受支持的文件类型的编辑器
AddToPath=添加到 PATH (重启后生效)
RunAfter=安装后运行 %1
Other=其他:
[CustomMessages]
AddContextMenuFiles=将“通过 %1 打开”操作添加到 Windows 资源管理器文件上下文菜单
AddContextMenuFolders=将“通过 %1 打开”操作添加到 Windows 资源管理器目录上下文菜单
AssociateWithFiles=将 %1 注册为受支持的文件类型的编辑器
AddToPath=添加到 PATH (重启后生效)
RunAfter=安装后运行 %1
Other=其他:
SourceFile=%1 源文件
\ No newline at end of file
[CustomMessages]
AddContextMenuFiles=將 [以 %1 開啟] 動作加入 Windows 檔案總管檔案的操作功能表中
AddContextMenuFolders=將 [以 %1 開啟] 動作加入 Windows 檔案總管目錄的操作功能表中
AssociateWithFiles=針對支援的檔案類型將 %1 註冊為編輯器
AddToPath=加入 PATH 中 (重新啟動後生效)
RunAfter=安裝後執行 %1
Other=其他:
[CustomMessages]
AddContextMenuFiles=將 [以 %1 開啟] 動作加入 Windows 檔案總管檔案的操作功能表中
AddContextMenuFolders=將 [以 %1 開啟] 動作加入 Windows 檔案總管目錄的操作功能表中
AssociateWithFiles=針對支援的檔案類型將 %1 註冊為編輯器
AddToPath=加入 PATH 中 (重新啟動後生效)
RunAfter=安裝後執行 %1
Other=其他:
SourceFile=%1 來源檔案
\ No newline at end of file
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6044,
"protocol": "inspector",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
}
]
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6044,
"protocol": "inspector",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
}
]
}
\ No newline at end of file
......@@ -24,6 +24,13 @@ interface ExpandAbbreviationInput {
filter?: string;
}
interface PreviewRangesWithContent {
previewRange: vscode.Range;
originalRange: vscode.Range;
originalContent: string;
textToWrapInPreview: string[];
}
export function wrapWithAbbreviation(args: any) {
if (!validate(false) || !vscode.window.activeTextEditor) {
return;
......@@ -32,48 +39,143 @@ export function wrapWithAbbreviation(args: any) {
const editor = vscode.window.activeTextEditor;
let rootNode = parseDocument(editor.document, false);
const syntax = getSyntaxFromArgs({ language: editor.document.languageId });
const syntax = getSyntaxFromArgs({ language: editor.document.languageId }) || '';
if (!syntax) {
return;
}
const abbreviationPromise = (args && args['abbreviation']) ? Promise.resolve(args['abbreviation']) : vscode.window.showInputBox({ prompt: 'Enter Abbreviation' });
let inPreview = false;
// Fetch general information for the succesive expansions. i.e. the ranges to replace and its contents
let rangesToReplace: PreviewRangesWithContent[] = [];
editor.selections.sort((a: vscode.Selection, b: vscode.Selection) => { return a.start.line - b.start.line; }).forEach(selection => {
let rangeToReplace: vscode.Range = selection.isReversed ? new vscode.Range(selection.active, selection.anchor) : selection;
if (rangeToReplace.isEmpty) {
let { active } = selection;
let currentNode = getNode(rootNode, active, true);
if (currentNode && (currentNode.start.line === active.line || currentNode.end.line === active.line)) {
rangeToReplace = new vscode.Range(currentNode.start, currentNode.end);
} else {
rangeToReplace = new vscode.Range(rangeToReplace.start.line, 0, rangeToReplace.start.line, editor.document.lineAt(rangeToReplace.start.line).text.length);
}
}
const firstLineOfSelection = editor.document.lineAt(rangeToReplace.start).text.substr(rangeToReplace.start.character);
const matches = firstLineOfSelection.match(/^(\s*)/);
const extraWhiteSpaceSelected = matches ? matches[1].length : 0;
rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + extraWhiteSpaceSelected, rangeToReplace.end.line, rangeToReplace.end.character);
const wholeFirstLine = editor.document.lineAt(rangeToReplace.start).text;
const otherMatches = wholeFirstLine.match(/^(\s*)/);
const preceedingWhiteSpace = otherMatches ? otherMatches[1] : '';
let textToReplace = editor.document.getText(rangeToReplace);
let textToWrapInPreview = rangeToReplace.isSingleLine ? [textToReplace] : ['\n\t' + textToReplace.split('\n' + preceedingWhiteSpace).join('\n\t') + '\n'];
rangesToReplace.push({ previewRange: rangeToReplace, originalRange: rangeToReplace, originalContent: textToReplace, textToWrapInPreview });
});
let abbreviationPromise;
let currentValue = '';
function inputChanged(value: string): string {
if (value !== currentValue) {
currentValue = value;
makeChanges(value, inPreview, false).then((out) => {
if (typeof out === 'boolean') {
inPreview = out;
}
});
}
return '';
}
abbreviationPromise = (args && args['abbreviation']) ? Promise.resolve(args['abbreviation']) : vscode.window.showInputBox({ prompt: 'Enter Abbreviation', validateInput: inputChanged });
const helper = getEmmetHelper();
return abbreviationPromise.then(inputAbbreviation => {
if (!inputAbbreviation || !inputAbbreviation.trim() || !helper.isAbbreviationValid(syntax, inputAbbreviation)) { return false; }
function makeChanges(inputAbbreviation: string | undefined, inPreview: boolean, definitive: boolean): Thenable<boolean> {
if (!inputAbbreviation || !inputAbbreviation.trim() || !helper.isAbbreviationValid(syntax, inputAbbreviation)) {
return inPreview ? revertPreview(editor, rangesToReplace).then(() => { return false; }) : Promise.resolve(inPreview);
}
let extractedResults = helper.extractAbbreviationFromText(inputAbbreviation);
if (!extractedResults) {
return false;
return Promise.resolve(inPreview);
} else if (extractedResults.abbreviation !== inputAbbreviation) {
// Not clear what should we do in this case. Warn the user? How?
}
let { abbreviation, filter } = extractedResults;
if (definitive) {
const revertPromise = inPreview ? revertPreview(editor, rangesToReplace) : Promise.resolve();
return revertPromise.then(() => {
const expandAbbrList: ExpandAbbreviationInput[] = rangesToReplace.map(rangesAndContent => {
let rangeToReplace = rangesAndContent.originalRange;
let textToWrap = rangeToReplace.isSingleLine ? ['$TM_SELECTED_TEXT'] : ['\n\t$TM_SELECTED_TEXT\n'];
return { syntax, abbreviation, rangeToReplace, textToWrap, filter };
});
return expandAbbreviationInRange(editor, expandAbbrList, true).then(() => { return true; });
});
}
let expandAbbrList: ExpandAbbreviationInput[] = [];
editor.selections.forEach(selection => {
let rangeToReplace: vscode.Range = selection.isReversed ? new vscode.Range(selection.active, selection.anchor) : selection;
if (rangeToReplace.isEmpty) {
let { active } = selection;
let currentNode = getNode(rootNode, active, true);
if (currentNode && (currentNode.start.line === active.line || currentNode.end.line === active.line)) {
rangeToReplace = new vscode.Range(currentNode.start, currentNode.end);
} else {
rangeToReplace = new vscode.Range(rangeToReplace.start.line, 0, rangeToReplace.start.line, editor.document.lineAt(rangeToReplace.start.line).text.length);
}
const expandAbbrList: ExpandAbbreviationInput[] = rangesToReplace.map(rangesAndContent => {
return { syntax, abbreviation, rangeToReplace: rangesAndContent.originalRange, textToWrap: rangesAndContent.textToWrapInPreview, filter };
});
return applyPreview(editor, expandAbbrList, rangesToReplace);
}
// On inputBox closing
return abbreviationPromise.then(inputAbbreviation => {
return makeChanges(inputAbbreviation, inPreview, true);
});
}
function revertPreview(editor: vscode.TextEditor, rangesToReplace: PreviewRangesWithContent[]): Thenable<any> {
return editor.edit(builder => {
for (let i = 0; i < rangesToReplace.length; i++) {
builder.replace(rangesToReplace[i].previewRange, rangesToReplace[i].originalContent);
rangesToReplace[i].previewRange = rangesToReplace[i].originalRange;
}
}, { undoStopBefore: false, undoStopAfter: false });
}
function applyPreview(editor: vscode.TextEditor, expandAbbrList: ExpandAbbreviationInput[], rangesToReplace: PreviewRangesWithContent[]): Thenable<boolean> {
let totalLinesInserted = 0;
return editor.edit(builder => {
for (let i = 0; i < rangesToReplace.length; i++) {
const expandedText = expandAbbr(expandAbbrList[i]) || '';
if (!expandedText) {
// Failed to expand text. We already showed an error inside expandAbbr.
break;
}
const firstLineOfSelection = editor.document.lineAt(rangeToReplace.start).text.substr(rangeToReplace.start.character);
const matches = firstLineOfSelection.match(/^(\s*)/);
const preceedingWhiteSpace = matches ? matches[1].length : 0;
const oldPreviewRange = rangesToReplace[i].previewRange;
const preceedingText = editor.document.getText(new vscode.Range(oldPreviewRange.start.line, 0, oldPreviewRange.start.line, oldPreviewRange.start.character));
const indentPrefix = (preceedingText.match(/^(\s*)/) || ['', ''])[1];
rangeToReplace = new vscode.Range(rangeToReplace.start.line, rangeToReplace.start.character + preceedingWhiteSpace, rangeToReplace.end.line, rangeToReplace.end.character);
let textToWrap = rangeToReplace.isSingleLine ? ['$TM_SELECTED_TEXT'] : ['\n\t$TM_SELECTED_TEXT\n'];
expandAbbrList.push({ syntax, abbreviation, rangeToReplace, textToWrap, filter });
});
let newText = expandedText.replace(/\n/g, '\n' + indentPrefix); // Adding indentation on each line of expanded text
newText = newText.replace(/\$\{[\d]*\}/g, '|'); // Removing Tabstops
newText = newText.replace(/\$\{[\d]*(:[^}]*)?\}/g, (match) => { // Replacing Placeholders
return match.replace(/^\$\{[\d]*:/, '').replace('}', '');
});
builder.replace(oldPreviewRange, newText);
return expandAbbreviationInRange(editor, expandAbbrList, true);
});
const expandedTextLines = newText.split('\n');
const oldPreviewLines = oldPreviewRange.end.line - oldPreviewRange.start.line + 1;
const newLinesInserted = expandedTextLines.length - oldPreviewLines;
let lastLineEnd = expandedTextLines[expandedTextLines.length - 1].length;
if (expandedTextLines.length === 1) {
// If the expandedText is single line, add the length of preceeding whitespace as it will not be included in line length.
lastLineEnd += oldPreviewRange.start.character;
}
rangesToReplace[i].previewRange = new vscode.Range(oldPreviewRange.start.line + totalLinesInserted, oldPreviewRange.start.character, oldPreviewRange.end.line + totalLinesInserted + newLinesInserted, lastLineEnd);
totalLinesInserted += newLinesInserted;
}
}, { undoStopBefore: false, undoStopAfter: false });
}
export function wrapIndividualLinesWithAbbreviation(args: any) {
......
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6045,
"protocol": "inspector",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
}
]
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6045,
"protocol": "inspector",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/out/**/*.js"]
}
]
}
\ No newline at end of file
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6004,
"sourceMaps": true,
"outDir": "${workspaceFolder}/out"
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outDir": "${workspaceFolder}/out"
}
]
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 6004,
"sourceMaps": true,
"outDir": "${workspaceFolder}/out"
},
{
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"cwd": "${workspaceFolder}",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {},
"sourceMaps": true,
"outDir": "${workspaceFolder}/out"
}
]
}
\ No newline at end of file
......@@ -26,6 +26,7 @@
"name": "lessc",
"label": "Lessc compiler",
"owner": "lessc",
"source": "less",
"fileLocation": "absolute",
"pattern": {
"regexp": "(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)",
......
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><polygon fill="#656565" points="10,2 7.414,2 8.414,3 9,3 9,3.586 9,4 9,4.414 9,6 12,6 12,13 4,13 4,8 3,8 3,14 13,14 13,5"/><polygon fill="#00539C" points="5,1 3,1 5,3 1,3 1,5 5,5 3,7 5,7 8,4"/></svg>
\ No newline at end of file
......@@ -33,11 +33,12 @@ export class OpenDocumentLinkCommand implements Command {
) { }
public execute(args: OpenDocumentLinkArgs) {
return this.tryOpen(args.path, args).catch(() => {
if (path.extname(args.path) === '') {
return this.tryOpen(args.path + '.md', args);
const p = decodeURIComponent(args.path);
return this.tryOpen(p, args).catch(() => {
if (path.extname(p) === '') {
return this.tryOpen(p + '.md', args);
}
const resource = vscode.Uri.file(args.path);
const resource = vscode.Uri.file(p);
return Promise.resolve(void 0)
.then(() => vscode.commands.executeCommand('vscode.open', resource))
.then(() => void 0);
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-fg{fill:#f0eff1}.icon-folder{fill:#656565}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14 .969H6.884l-1 2H3c-.97 0-2 .701-2 2v2H0v1.196l.516 1.288A4.437 4.437 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.569 0 2.95-.81 3.755-2.031H14s.86-.021 1.43-.565c.344-.332.57-.817.57-1.435v-9c0-1.303-1.005-2-2-2z" id="outline" style="display: none;"/><path class="icon-folder" d="M11 8l3 5H8.724c.168-.471.276-.971.276-1.5 0-1.421-.675-2.675-1.706-3.5H11zM1.706 8H1l.19.476c.159-.174.333-.329.516-.476zM14 2H7.5l-1 2H3c.236 0-1 0-1 1v2.762a4.49 4.49 0 0 1 1-.485V5h4l1-2h6v9.984S15 13 15 12V3c0-1-1-1-1-1zm-9.5 8a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 11.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0zm-1 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0z" id="iconBg"/><g id="iconFg"><path id="iconFg_1_" class="icon-vs-fg" d="M3 7.969v-3h4l1-2h6v10l-3-5H3z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-fg{fill:#f0eff1}.icon-folder{fill:#656565}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14 .969H6.884l-1 2H3c-.97 0-2 .701-2 2v2H0v1.196l.516 1.288A4.437 4.437 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.569 0 2.95-.81 3.755-2.031H14s.86-.021 1.43-.565c.344-.332.57-.817.57-1.435v-9c0-1.303-1.005-2-2-2z" id="outline" style="display: none;"/><path class="icon-folder" d="M11 8l3 5H8.724c.168-.471.276-.971.276-1.5 0-1.421-.675-2.675-1.706-3.5H11zM1.706 8H1l.19.476c.159-.174.333-.329.516-.476zM14 2H7.5l-1 2H3c.236 0-1 0-1 1v2.762a4.49 4.49 0 0 1 1-.485V5h4l1-2h6v9.984S15 13 15 12V3c0-1-1-1-1-1zm-9.5 8a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 11.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0zm-1 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0z" id="iconBg"/><g id="iconFg"><path id="iconFg_1_" class="icon-vs-fg" d="M3 7.969v-3h4l1-2h6v10l-3-5H3z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-fg{fill:#2b282e}.icon-folder{fill:#C5C5C5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14 .969H6.884l-1 2H3c-.97 0-2 .701-2 2v2H0v1.196l.516 1.288A4.437 4.437 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.569 0 2.95-.81 3.755-2.031H14s.86-.021 1.43-.565c.344-.332.57-.817.57-1.435v-9c0-1.303-1.005-2-2-2z" id="outline" style="display: none;"/><path class="icon-folder" d="M11 8l3 5H8.724c.168-.471.276-.971.276-1.5 0-1.421-.675-2.675-1.706-3.5H11zM1.706 8H1l.19.476c.159-.174.333-.329.516-.476zM14 2H7.5l-1 2H3c.236 0-1 0-1 1v2.762a4.49 4.49 0 0 1 1-.485V5h4l1-2h6v9.984S15 13 15 12V3c0-1-1-1-1-1zm-9.5 8a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 11.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0zm-1 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0z" id="iconBg"/><g id="iconFg"><path id="iconFg_1_" class="icon-vs-fg" d="M3 7.969v-3h4l1-2h6v10l-3-5H3z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-fg{fill:#2b282e}.icon-folder{fill:#C5C5C5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14 .969H6.884l-1 2H3c-.97 0-2 .701-2 2v2H0v1.196l.516 1.288A4.437 4.437 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.569 0 2.95-.81 3.755-2.031H14s.86-.021 1.43-.565c.344-.332.57-.817.57-1.435v-9c0-1.303-1.005-2-2-2z" id="outline" style="display: none;"/><path class="icon-folder" d="M11 8l3 5H8.724c.168-.471.276-.971.276-1.5 0-1.421-.675-2.675-1.706-3.5H11zM1.706 8H1l.19.476c.159-.174.333-.329.516-.476zM14 2H7.5l-1 2H3c.236 0-1 0-1 1v2.762a4.49 4.49 0 0 1 1-.485V5h4l1-2h6v9.984S15 13 15 12V3c0-1-1-1-1-1zm-9.5 8a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 11.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0zm-1 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0z" id="iconBg"/><g id="iconFg"><path id="iconFg_1_" class="icon-vs-fg" d="M3 7.969v-3h4l1-2h6v10l-3-5H3z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-fg{fill:#f0eff1}.icon-folder{fill:#656565}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14.5 1H6.39l-1 2H2.504c-.827 0-1.5.673-1.5 1.5v4.202A4.454 4.454 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.557 0 2.93-.795 3.738-2H14.5c.827 0 1.5-.673 1.5-1.5v-10c0-.827-.673-1.5-1.5-1.5z" id="outline" style="display: none;"/><path class="icon-folder" d="M14.5 2H7.008l-1 2H2.504a.5.5 0 0 0-.5.5v3.26A4.47 4.47 0 0 1 4.5 7C6.981 7 9 9.019 9 11.5c0 .529-.108 1.029-.276 1.5H14.5a.5.5 0 0 0 .5-.5v-10a.5.5 0 0 0-.5-.5zm-.496 2H7.508l.5-1h5.996v1zM4.5 8a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7zM7 11.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm-1 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" id="iconBg"/><g id="iconFg"><path class="icon-vs-fg" d="M14 3v1H7.5L8 3h6z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-fg{fill:#f0eff1}.icon-folder{fill:#656565}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14.5 1H6.39l-1 2H2.504c-.827 0-1.5.673-1.5 1.5v4.202A4.454 4.454 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.557 0 2.93-.795 3.738-2H14.5c.827 0 1.5-.673 1.5-1.5v-10c0-.827-.673-1.5-1.5-1.5z" id="outline" style="display: none;"/><path class="icon-folder" d="M14.5 2H7.008l-1 2H2.504a.5.5 0 0 0-.5.5v3.26A4.47 4.47 0 0 1 4.5 7C6.981 7 9 9.019 9 11.5c0 .529-.108 1.029-.276 1.5H14.5a.5.5 0 0 0 .5-.5v-10a.5.5 0 0 0-.5-.5zm-.496 2H7.508l.5-1h5.996v1zM4.5 8a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7zM7 11.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm-1 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" id="iconBg"/><g id="iconFg"><path class="icon-vs-fg" d="M14 3v1H7.5L8 3h6z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-fg{fill:#2b282e}.icon-folder{fill:#C5C5C5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14.5 1H6.39l-1 2H2.504c-.827 0-1.5.673-1.5 1.5v4.202A4.454 4.454 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.557 0 2.93-.795 3.738-2H14.5c.827 0 1.5-.673 1.5-1.5v-10c0-.827-.673-1.5-1.5-1.5z" id="outline" style="display: none;"/><path class="icon-folder" d="M14.5 2H7.008l-1 2H2.504a.5.5 0 0 0-.5.5v3.26A4.47 4.47 0 0 1 4.5 7C6.981 7 9 9.019 9 11.5c0 .529-.108 1.029-.276 1.5H14.5a.5.5 0 0 0 .5-.5v-10a.5.5 0 0 0-.5-.5zm-.496 2H7.508l.5-1h5.996v1zM4.5 8a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7zM7 11.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm-1 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" id="iconBg"/><g id="iconFg"><path class="icon-vs-fg" d="M14 3v1H7.5L8 3h6z" style="display: none;"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-fg{fill:#2b282e}.icon-folder{fill:#C5C5C5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M14.5 1H6.39l-1 2H2.504c-.827 0-1.5.673-1.5 1.5v4.202A4.454 4.454 0 0 0 0 11.5C0 13.981 2.019 16 4.5 16c1.557 0 2.93-.795 3.738-2H14.5c.827 0 1.5-.673 1.5-1.5v-10c0-.827-.673-1.5-1.5-1.5z" id="outline" style="display: none;"/><path class="icon-folder" d="M14.5 2H7.008l-1 2H2.504a.5.5 0 0 0-.5.5v3.26A4.47 4.47 0 0 1 4.5 7C6.981 7 9 9.019 9 11.5c0 .529-.108 1.029-.276 1.5H14.5a.5.5 0 0 0 .5-.5v-10a.5.5 0 0 0-.5-.5zm-.496 2H7.508l.5-1h5.996v1zM4.5 8a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7zM7 11.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm-1 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" id="iconBg"/><g id="iconFg"><path class="icon-vs-fg" d="M14 3v1H7.5L8 3h6z" style="display: none;"/></g></svg>
......@@ -552,6 +552,7 @@
"name": "tsc",
"label": "%typescript.problemMatchers.tsc.label%",
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",
......@@ -563,6 +564,7 @@
"name": "tsc-watch",
"label": "%typescript.problemMatchers.tscWatch.label%",
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",
......
.vscode/**
typings/**
**/*.ts
**/*.map
.gitignore
tsconfig.json
.vscode/**
typings/**
**/*.ts
**/*.map
.gitignore
tsconfig.json
@echo off
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
call "%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %*
@echo off
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
call "%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %*
endlocal
\ No newline at end of file
@echo off
setlocal
title VSCode Dev
pushd %~dp0\..
:: Node modules
if not exist node_modules call yarn
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"
:: Download Electron if needed
node build\lib\electron.js
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
:: Manage build-in extensions
if "%1"=="--builtin" goto builtin
:: Sync built-in extensions
node build\lib\builtInExtensions.js
:: Build
if not exist out node .\node_modules\gulp\bin\gulp.js compile
:: Configuration
set NODE_ENV=development
set VSCODE_DEV=1
set VSCODE_CLI=1
set ELECTRON_DEFAULT_ERROR_MODE=1
set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1
:: Launch Code
:: Use the following to get v8 tracing:
:: %CODE% --js-flags="--trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces" . %*
%CODE% . %*
goto end
:builtin
%CODE% build/builtin
:end
popd
@echo off
setlocal
title VSCode Dev
pushd %~dp0\..
:: Node modules
if not exist node_modules call yarn
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"
:: Download Electron if needed
node build\lib\electron.js
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
:: Manage build-in extensions
if "%1"=="--builtin" goto builtin
:: Sync built-in extensions
node build\lib\builtInExtensions.js
:: Build
if not exist out node .\node_modules\gulp\bin\gulp.js compile
:: Configuration
set NODE_ENV=development
set VSCODE_DEV=1
set VSCODE_CLI=1
set ELECTRON_DEFAULT_ERROR_MODE=1
set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1
:: Launch Code
:: Use the following to get v8 tracing:
:: %CODE% --js-flags="--trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces" . %*
%CODE% . %*
goto end
:builtin
%CODE% build/builtin
:end
popd
endlocal
\ No newline at end of file
@echo off
yarn %*
@echo off
yarn %*
......@@ -18,7 +18,7 @@ if %errorlevel% neq 0 exit /b %errorlevel%
call .\scripts\code.bat %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%
call .\scripts\code.bat $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
call .\scripts\code.bat $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disableExtensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%
:: Integration & performance tests in AMD
......
......@@ -17,7 +17,7 @@ cd $ROOT
./scripts/code.sh $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
./scripts/code.sh $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
mkdir $ROOT/extensions/emmet/test-fixtures
./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started .
rm -r $ROOT/extensions/emmet/test-fixtures
# Integration tests in AMD
......
......@@ -12,6 +12,7 @@
"noImplicitReturns": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"alwaysStrict": true,
"baseUrl": ".",
"outDir": "../out",
"typeRoots": [
......
......@@ -15,11 +15,11 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Color } from 'vs/base/common/color';
export interface ICheckboxOpts extends ICheckboxStyles {
actionClassName: string;
title: string;
isChecked: boolean;
onChange: (viaKeyboard: boolean) => void;
onKeyDown?: (e: IKeyboardEvent) => void;
readonly actionClassName: string;
readonly title: string;
readonly isChecked: boolean;
readonly onChange: (viaKeyboard: boolean) => void;
readonly onKeyDown?: (e: IKeyboardEvent) => void;
}
export interface ICheckboxStyles {
......@@ -32,8 +32,8 @@ const defaultOpts = {
export class Checkbox extends Widget {
private _opts: ICheckboxOpts;
public domNode: HTMLElement;
private readonly _opts: ICheckboxOpts;
public readonly domNode: HTMLElement;
private _checked: boolean;
......
......@@ -20,14 +20,14 @@ import { Color } from 'vs/base/common/color';
import { ICheckboxStyles } from 'vs/base/browser/ui/checkbox/checkbox';
export interface IFindInputOptions extends IFindInputStyles {
placeholder?: string;
width?: number;
validation?: IInputValidator;
label: string;
appendCaseSensitiveLabel?: string;
appendWholeWordsLabel?: string;
appendRegexLabel?: string;
readonly placeholder?: string;
readonly width?: number;
readonly validation?: IInputValidator;
readonly label: string;
readonly appendCaseSensitiveLabel?: string;
readonly appendWholeWordsLabel?: string;
readonly appendRegexLabel?: string;
}
export interface IFindInputStyles extends IInputBoxStyles {
......@@ -38,7 +38,7 @@ const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
export class FindInput extends Widget {
static OPTION_CHANGE: string = 'optionChange';
static readonly OPTION_CHANGE: string = 'optionChange';
private contextViewProvider: IContextViewProvider;
private width: number;
......
......@@ -12,11 +12,11 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Color } from 'vs/base/common/color';
export interface IFindInputCheckboxOpts {
appendTitle: string;
isChecked: boolean;
onChange: (viaKeyboard: boolean) => void;
onKeyDown?: (e: IKeyboardEvent) => void;
inputActiveOptionBorder?: Color;
readonly appendTitle: string;
readonly isChecked: boolean;
readonly onChange: (viaKeyboard: boolean) => void;
readonly onKeyDown?: (e: IKeyboardEvent) => void;
readonly inputActiveOptionBorder?: Color;
}
const NLS_CASE_SENSITIVE_CHECKBOX_LABEL = nls.localize('caseDescription', "Match Case");
......
......@@ -7,7 +7,7 @@
import { IDisposable } from 'vs/base/common/lifecycle';
import * as dom from 'vs/base/browser/dom';
import * as objects from 'vs/base/common/objects';
import { render as renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
export interface IHighlight {
start: number;
......
......@@ -24,7 +24,7 @@ class MockOcticonLabel {
}
var mock: typeof octiconLabel = {
render: render,
renderOcticons: render,
OcticonLabel: <any>MockOcticonLabel
};
export = mock;
\ No newline at end of file
......@@ -14,20 +14,20 @@ function expand(text: string): string {
});
}
export function render(label: string): string {
export function renderOcticons(label: string): string {
return expand(escape(label));
}
export class OcticonLabel {
private _container: HTMLElement;
private readonly _container: HTMLElement;
constructor(container: HTMLElement) {
this._container = container;
}
set text(text: string) {
this._container.innerHTML = render(text || '');
this._container.innerHTML = renderOcticons(text || '');
}
set title(title: string) {
......
......@@ -12,6 +12,7 @@ import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import * as json from 'vs/base/common/json';
import * as extfs from 'vs/base/node/extfs';
import { isWindows } from 'vs/base/common/platform';
export interface IConfigurationChangeEvent<T> {
config: T;
......@@ -165,8 +166,18 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
}
private onConfigFileChange(eventType: string, filename: string, isParentFolder: boolean): void {
if (isParentFolder && filename !== this.configName) {
return; // a change to a sibling file that is not our config file
if (isParentFolder) {
// Windows: in some cases the filename contains artifacts from the absolute path
// see https://github.com/nodejs/node/issues/19170
// As such, we have to ensure that the filename basename is used for comparison.
if (isWindows && filename !== this.configName) {
filename = basename(filename);
}
if (filename !== this.configName) {
return; // a change to a sibling file that is not our config file
}
}
if (this.timeoutHandle) {
......
'use strict';
/// <reference path="employee.ts" />
var Workforce;
(function (Workforce_1) {
var Company = (function () {
function Company() {
}
return Company;
})();
(function (property, Workforce, IEmployee) {
if (property === void 0) { property = employees; }
if (IEmployee === void 0) { IEmployee = []; }
property;
calculateMonthlyExpenses();
{
var result = 0;
for (var i = 0; i < employees.length; i++) {
result += employees[i].calculatePay();
}
return result;
}
});
})(Workforce || (Workforce = {}));
'use strict';
/// <reference path="employee.ts" />
var Workforce;
(function (Workforce_1) {
var Company = (function () {
function Company() {
}
return Company;
})();
(function (property, Workforce, IEmployee) {
if (property === void 0) { property = employees; }
if (IEmployee === void 0) { IEmployee = []; }
property;
calculateMonthlyExpenses();
{
var result = 0;
for (var i = 0; i < employees.length; i++) {
result += employees[i].calculatePay();
}
return result;
}
});
})(Workforce || (Workforce = {}));
'use strict';
var Conway;
(function (Conway) {
var Cell = (function () {
function Cell() {
}
return Cell;
})();
(function (property, number, property, number, property, boolean) {
if (property === void 0) { property = row; }
if (property === void 0) { property = col; }
if (property === void 0) { property = live; }
});
var GameOfLife = (function () {
function GameOfLife() {
}
return GameOfLife;
})();
(function () {
property;
gridSize = 50;
property;
canvasSize = 600;
property;
lineColor = '#cdcdcd';
property;
liveColor = '#666';
property;
deadColor = '#eee';
property;
initialLifeProbability = 0.5;
property;
animationRate = 60;
property;
cellSize = 0;
property;
context: ICanvasRenderingContext2D;
property;
world = createWorld();
circleOfLife();
function createWorld() {
return travelWorld(function (cell) {
cell.live = Math.random() < initialLifeProbability;
return cell;
});
}
function circleOfLife() {
world = travelWorld(function (cell) {
cell = world[cell.row][cell.col];
draw(cell);
return resolveNextGeneration(cell);
});
setTimeout(function () { circleOfLife(); }, animationRate);
}
function resolveNextGeneration(cell) {
var count = countNeighbors(cell);
var newCell = new Cell(cell.row, cell.col, cell.live);
if (count < 2 || count > 3)
newCell.live = false;
else if (count == 3)
newCell.live = true;
return newCell;
}
function countNeighbors(cell) {
var neighbors = 0;
for (var row = -1; row <= 1; row++) {
for (var col = -1; col <= 1; col++) {
if (row == 0 && col == 0)
continue;
if (isAlive(cell.row + row, cell.col + col)) {
neighbors++;
}
}
}
return neighbors;
}
function isAlive(row, col) {
// todo - need to guard with world[row] exists?
if (row < 0 || col < 0 || row >= gridSize || col >= gridSize)
return false;
return world[row][col].live;
}
function travelWorld(callback) {
var result = [];
for (var row = 0; row < gridSize; row++) {
var rowData = [];
for (var col = 0; col < gridSize; col++) {
rowData.push(callback(new Cell(row, col, false)));
}
result.push(rowData);
}
return result;
}
function draw(cell) {
if (context == null)
context = createDrawingContext();
if (cellSize == 0)
cellSize = canvasSize / gridSize;
context.strokeStyle = lineColor;
context.strokeRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
context.fillStyle = cell.live ? liveColor : deadColor;
context.fillRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
}
function createDrawingContext() {
var canvas = document.getElementById('conway-canvas');
if (canvas == null) {
canvas = document.createElement('canvas');
canvas.id = "conway-canvas";
canvas.width = canvasSize;
canvas.height = canvasSize;
document.body.appendChild(canvas);
}
return canvas.getContext('2d');
}
});
})(Conway || (Conway = {}));
var game = new Conway.GameOfLife();
'use strict';
var Conway;
(function (Conway) {
var Cell = (function () {
function Cell() {
}
return Cell;
})();
(function (property, number, property, number, property, boolean) {
if (property === void 0) { property = row; }
if (property === void 0) { property = col; }
if (property === void 0) { property = live; }
});
var GameOfLife = (function () {
function GameOfLife() {
}
return GameOfLife;
})();
(function () {
property;
gridSize = 50;
property;
canvasSize = 600;
property;
lineColor = '#cdcdcd';
property;
liveColor = '#666';
property;
deadColor = '#eee';
property;
initialLifeProbability = 0.5;
property;
animationRate = 60;
property;
cellSize = 0;
property;
context: ICanvasRenderingContext2D;
property;
world = createWorld();
circleOfLife();
function createWorld() {
return travelWorld(function (cell) {
cell.live = Math.random() < initialLifeProbability;
return cell;
});
}
function circleOfLife() {
world = travelWorld(function (cell) {
cell = world[cell.row][cell.col];
draw(cell);
return resolveNextGeneration(cell);
});
setTimeout(function () { circleOfLife(); }, animationRate);
}
function resolveNextGeneration(cell) {
var count = countNeighbors(cell);
var newCell = new Cell(cell.row, cell.col, cell.live);
if (count < 2 || count > 3)
newCell.live = false;
else if (count == 3)
newCell.live = true;
return newCell;
}
function countNeighbors(cell) {
var neighbors = 0;
for (var row = -1; row <= 1; row++) {
for (var col = -1; col <= 1; col++) {
if (row == 0 && col == 0)
continue;
if (isAlive(cell.row + row, cell.col + col)) {
neighbors++;
}
}
}
return neighbors;
}
function isAlive(row, col) {
// todo - need to guard with world[row] exists?
if (row < 0 || col < 0 || row >= gridSize || col >= gridSize)
return false;
return world[row][col].live;
}
function travelWorld(callback) {
var result = [];
for (var row = 0; row < gridSize; row++) {
var rowData = [];
for (var col = 0; col < gridSize; col++) {
rowData.push(callback(new Cell(row, col, false)));
}
result.push(rowData);
}
return result;
}
function draw(cell) {
if (context == null)
context = createDrawingContext();
if (cellSize == 0)
cellSize = canvasSize / gridSize;
context.strokeStyle = lineColor;
context.strokeRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
context.fillStyle = cell.live ? liveColor : deadColor;
context.fillRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
}
function createDrawingContext() {
var canvas = document.getElementById('conway-canvas');
if (canvas == null) {
canvas = document.createElement('canvas');
canvas.id = "conway-canvas";
canvas.width = canvasSize;
canvas.height = canvasSize;
document.body.appendChild(canvas);
}
return canvas.getContext('2d');
}
});
})(Conway || (Conway = {}));
var game = new Conway.GameOfLife();
'use strict';
var Workforce;
(function (Workforce) {
var Employee = (function () {
function Employee() {
}
return Employee;
})();
(property);
name: string, property;
basepay: number;
implements;
IEmployee;
{
name;
basepay;
}
var SalesEmployee = (function () {
function SalesEmployee() {
}
return SalesEmployee;
})();
();
Employee(name, basepay);
{
function calculatePay() {
var multiplier = (document.getElementById("mult")), as = any, value;
return _super.calculatePay.call(this) * multiplier + bonus;
}
}
var employee = new Employee('Bob', 1000);
var salesEmployee = new SalesEmployee('Jim', 800, 400);
salesEmployee.calclatePay(); // error: No member 'calclatePay' on SalesEmployee
})(Workforce || (Workforce = {}));
extern;
var $;
var s = Workforce.salesEmployee.calculatePay();
$('#results').text(s);
'use strict';
var Workforce;
(function (Workforce) {
var Employee = (function () {
function Employee() {
}
return Employee;
})();
(property);
name: string, property;
basepay: number;
implements;
IEmployee;
{
name;
basepay;
}
var SalesEmployee = (function () {
function SalesEmployee() {
}
return SalesEmployee;
})();
();
Employee(name, basepay);
{
function calculatePay() {
var multiplier = (document.getElementById("mult")), as = any, value;
return _super.calculatePay.call(this) * multiplier + bonus;
}
}
var employee = new Employee('Bob', 1000);
var salesEmployee = new SalesEmployee('Jim', 800, 400);
salesEmployee.calclatePay(); // error: No member 'calclatePay' on SalesEmployee
})(Workforce || (Workforce = {}));
extern;
var $;
var s = Workforce.salesEmployee.calculatePay();
$('#results').text(s);
'use strict';
var M;
(function (M) {
var C = (function () {
function C() {
}
return C;
})();
(function (x, property, number) {
if (property === void 0) { property = w; }
var local = 1;
// unresolved symbol because x is local
//self.x++;
self.w--; // ok because w is a property
property;
f = function (y) {
return y + x + local + w + self.w;
};
function sum(z) {
return z + f(z) + w + self.w;
}
});
})(M || (M = {}));
var c = new M.C(12, 5);
'use strict';
var M;
(function (M) {
var C = (function () {
function C() {
}
return C;
})();
(function (x, property, number) {
if (property === void 0) { property = w; }
var local = 1;
// unresolved symbol because x is local
//self.x++;
self.w--; // ok because w is a property
property;
f = function (y) {
return y + x + local + w + self.w;
};
function sum(z) {
return z + f(z) + w + self.w;
}
});
})(M || (M = {}));
var c = new M.C(12, 5);
<!DOCTYPE html>
<html>
<head id='headID'>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Strada </title>
<link href="site.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.4.1.js"></script>
<script src="../compiler/dtree.js" type="text/javascript"></script>
<script src="../compiler/typescript.js" type="text/javascript"></script>
<script type="text/javascript">
// Compile strada source into resulting javascript
function compile(prog, libText) {
var outfile = {
source: "",
Write: function (s) { this.source += s; },
WriteLine: function (s) { this.source += s + "\r"; },
}
var parseErrors = []
var compiler=new Tools.TypeScriptCompiler(outfile,true);
compiler.setErrorCallback(function(start,len, message) { parseErrors.push({start:start, len:len, message:message}); });
compiler.addUnit(libText,"lib.ts");
compiler.addUnit(prog,"input.ts");
compiler.typeCheck();
compiler.emit();
if(parseErrors.length > 0 ) {
//throw new Error(parseErrors);
}
while(outfile.source[0] == '/' && outfile.source[1] == '/' && outfile.source[2] == ' ') {
outfile.source = outfile.source.slice(outfile.source.indexOf('\r')+1);
}
var errorPrefix = "";
for(var i = 0;i<parseErrors.length;i++) {
errorPrefix += "// Error: (" + parseErrors[i].start + "," + parseErrors[i].len + ") " + parseErrors[i].message + "\r";
}
return errorPrefix + outfile.source;
}
</script>
<script type="text/javascript">
var libText = "";
$.get("../compiler/lib.ts", function(newLibText) {
libText = newLibText;
});
// execute the javascript in the compiledOutput pane
function execute() {
$('#compilation').text("Running...");
var txt = $('#compiledOutput').val();
var res;
try {
var ret = eval(txt);
res = "Ran successfully!";
} catch(e) {
res = "Exception thrown: " + e;
}
$('#compilation').text(String(res));
}
// recompile the stradaSrc and populate the compiledOutput pane
function srcUpdated() {
var newText = $('#stradaSrc').val();
var compiledSource;
try {
compiledSource = compile(newText, libText);
} catch (e) {
compiledSource = "//Parse error"
for(var i in e)
compiledSource += "\r// " + e[i];
}
$('#compiledOutput').val(compiledSource);
}
// Populate the stradaSrc pane with one of the built in samples
function exampleSelectionChanged() {
var examples = document.getElementById('examples');
var selectedExample = examples.options[examples.selectedIndex].value;
if (selectedExample != "") {
$.get('examples/' + selectedExample, function (srcText) {
$('#stradaSrc').val(srcText);
setTimeout(srcUpdated,100);
}, function (err) {
console.log(err);
});
}
}
</script>
</head>
<body>
<h1>TypeScript</h1>
<br />
<select id="examples" onchange='exampleSelectionChanged()'>
<option value="">Select...</option>
<option value="small.ts">Small</option>
<option value="employee.ts">Employees</option>
<option value="conway.ts">Conway Game of Life</option>
<option value="typescript.ts">TypeScript Compiler</option>
</select>
<div>
<textarea id='stradaSrc' rows='40' cols='80' onchange='srcUpdated()' onkeyup='srcUpdated()' spellcheck="false">
//Type your TypeScript here...
</textarea>
<textarea id='compiledOutput' rows='40' cols='80' spellcheck="false">
//Compiled code will show up here...
</textarea>
<br />
<button onclick='execute()'/>Run</button>
<div id='compilation'>Press 'run' to execute code...</div>
<div id='results'>...write your results into #results...</div>
</div>
<div id='bod' style='display:none'></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head id='headID'>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Strada </title>
<link href="site.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.4.1.js"></script>
<script src="../compiler/dtree.js" type="text/javascript"></script>
<script src="../compiler/typescript.js" type="text/javascript"></script>
<script type="text/javascript">
// Compile strada source into resulting javascript
function compile(prog, libText) {
var outfile = {
source: "",
Write: function (s) { this.source += s; },
WriteLine: function (s) { this.source += s + "\r"; },
}
var parseErrors = []
var compiler=new Tools.TypeScriptCompiler(outfile,true);
compiler.setErrorCallback(function(start,len, message) { parseErrors.push({start:start, len:len, message:message}); });
compiler.addUnit(libText,"lib.ts");
compiler.addUnit(prog,"input.ts");
compiler.typeCheck();
compiler.emit();
if(parseErrors.length > 0 ) {
//throw new Error(parseErrors);
}
while(outfile.source[0] == '/' && outfile.source[1] == '/' && outfile.source[2] == ' ') {
outfile.source = outfile.source.slice(outfile.source.indexOf('\r')+1);
}
var errorPrefix = "";
for(var i = 0;i<parseErrors.length;i++) {
errorPrefix += "// Error: (" + parseErrors[i].start + "," + parseErrors[i].len + ") " + parseErrors[i].message + "\r";
}
return errorPrefix + outfile.source;
}
</script>
<script type="text/javascript">
var libText = "";
$.get("../compiler/lib.ts", function(newLibText) {
libText = newLibText;
});
// execute the javascript in the compiledOutput pane
function execute() {
$('#compilation').text("Running...");
var txt = $('#compiledOutput').val();
var res;
try {
var ret = eval(txt);
res = "Ran successfully!";
} catch(e) {
res = "Exception thrown: " + e;
}
$('#compilation').text(String(res));
}
// recompile the stradaSrc and populate the compiledOutput pane
function srcUpdated() {
var newText = $('#stradaSrc').val();
var compiledSource;
try {
compiledSource = compile(newText, libText);
} catch (e) {
compiledSource = "//Parse error"
for(var i in e)
compiledSource += "\r// " + e[i];
}
$('#compiledOutput').val(compiledSource);
}
// Populate the stradaSrc pane with one of the built in samples
function exampleSelectionChanged() {
var examples = document.getElementById('examples');
var selectedExample = examples.options[examples.selectedIndex].value;
if (selectedExample != "") {
$.get('examples/' + selectedExample, function (srcText) {
$('#stradaSrc').val(srcText);
setTimeout(srcUpdated,100);
}, function (err) {
console.log(err);
});
}
}
</script>
</head>
<body>
<h1>TypeScript</h1>
<br />
<select id="examples" onchange='exampleSelectionChanged()'>
<option value="">Select...</option>
<option value="small.ts">Small</option>
<option value="employee.ts">Employees</option>
<option value="conway.ts">Conway Game of Life</option>
<option value="typescript.ts">TypeScript Compiler</option>
</select>
<div>
<textarea id='stradaSrc' rows='40' cols='80' onchange='srcUpdated()' onkeyup='srcUpdated()' spellcheck="false">
//Type your TypeScript here...
</textarea>
<textarea id='compiledOutput' rows='40' cols='80' spellcheck="false">
//Compiled code will show up here...
</textarea>
<br />
<button onclick='execute()'/>Run</button>
<div id='compilation'>Press 'run' to execute code...</div>
<div id='results'>...write your results into #results...</div>
</div>
<div id='bod' style='display:none'></div>
</body>
</html>
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Data.Odbc;
using System.IO;
using System.Net.Mail;
using System.Text.RegularExpressions;
using System.DirectoryServices;
using System.Diagnostics;
using System.Resources;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
ObjectCount = LoadObjects("ffentlicher Ordner");
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Data.Odbc;
using System.IO;
using System.Net.Mail;
using System.Text.RegularExpressions;
using System.DirectoryServices;
using System.Diagnostics;
using System.Resources;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
ObjectCount = LoadObjects("ffentlicher Ordner");
Private = "Persnliche Information"
\ No newline at end of file
/*----------------------------------------------------------
The base color for this template is #5c87b2. If you'd like
to use a different color start by replacing all instances of
#5c87b2 with your new color.
----------------------------------------------------------*/
body
{
background-color: #5c87b2;
font-size: .75em;
font-family: Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 8px;
padding: 0;
color: #696969;
}
h1, h2, h3, h4, h5, h6
{
color: #000;
font-size: 40px;
margin: 0px;
}
textarea
{
font-family: Consolas
}
#results
{
margin-top: 2em;
margin-left: 2em;
color: black;
font-size: medium;
}
/*----------------------------------------------------------
The base color for this template is #5c87b2. If you'd like
to use a different color start by replacing all instances of
#5c87b2 with your new color.
----------------------------------------------------------*/
body
{
background-color: #5c87b2;
font-size: .75em;
font-family: Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 8px;
padding: 0;
color: #696969;
}
h1, h2, h3, h4, h5, h6
{
color: #000;
font-size: 40px;
margin: 0px;
}
textarea
{
font-family: Consolas
}
#results
{
margin-top: 2em;
margin-left: 2em;
color: black;
font-size: medium;
}
{
"type": "typescript",
"sources": [
"examples/company.ts",
"examples/conway.ts",
"examples/employee.ts",
"examples/large.ts",
"examples/small.ts"
]
{
"type": "typescript",
"sources": [
"examples/company.ts",
"examples/conway.ts",
"examples/employee.ts",
"examples/large.ts",
"examples/small.ts"
]
}
\ No newline at end of file
......@@ -71,14 +71,6 @@
font-size: 13px;
}
.monaco-editor .find-widget.visible.noanimation {
-webkit-transition: none;
-o-transition: none;
-moz-transition: none;
-ms-transition: none;
transition: none;
}
.monaco-editor .find-widget > .find-part,
.monaco-editor .find-widget > .replace-part {
margin: 4px 0 0 17px;
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册