提交 b1f471ff 编写于 作者: A Alex Dima

Merge branch 'master' into pr/Logerfo/63027

......@@ -152,10 +152,19 @@ gulp.task('extract-editor-esm', ['clean-editor-esm', 'clean-editor-distro', 'ext
});
});
gulp.task('compile-editor-esm', ['extract-editor-esm', 'clean-editor-distro'], function () {
const result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
cwd: path.join(__dirname, '../out-editor-esm')
});
console.log(result.stdout.toString());
if (process.platform === 'win32') {
const result = cp.spawnSync(`..\\node_modules\\.bin\\tsc.cmd`, {
cwd: path.join(__dirname, '../out-editor-esm')
});
console.log(result.stdout.toString());
console.log(result.stderr.toString());
} else {
const result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
cwd: path.join(__dirname, '../out-editor-esm')
});
console.log(result.stdout.toString());
console.log(result.stderr.toString());
}
});
function toExternalDTS(contents) {
......
......@@ -77,7 +77,7 @@ function fromLocalWebpack(extensionPath, sourceMappingURLBase) {
return data;
}))
.pipe(packageJsonFilter.restore);
const webpackStreams = webpackConfigLocations.map(webpackConfigPath => {
const webpackStreams = webpackConfigLocations.map(webpackConfigPath => () => {
const webpackDone = (err, stats) => {
util.log(`Bundled extension: ${util.colors.yellow(path.join(path.basename(extensionPath), path.relative(extensionPath, webpackConfigPath)))}...`);
if (err) {
......@@ -118,7 +118,7 @@ function fromLocalWebpack(extensionPath, sourceMappingURLBase) {
this.emit('data', data);
}));
});
es.merge(...webpackStreams, patchFilesStream)
es.merge(sequence(webpackStreams), patchFilesStream)
// .pipe(es.through(function (data) {
// // debug
// console.log('out', data.path, data.contents.length);
......@@ -216,10 +216,10 @@ function packageExtensionsStream(optsIn) {
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
.filter(({ name }) => opts.desiredExtensions ? opts.desiredExtensions.indexOf(name) >= 0 : true)
.filter(({ name }) => builtInExtensions.every(b => b.name !== name));
const localExtensions = () => es.merge(...localExtensionDescriptions.map(extension => {
return fromLocal(extension.path, opts.sourceMappingURLBase)
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
}));
const localExtensions = () => sequence([...localExtensionDescriptions.map(extension => () => {
return fromLocal(extension.path, opts.sourceMappingURLBase)
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
})]);
const localExtensionDependencies = () => gulp.src('extensions/node_modules/**', { base: '.' });
const marketplaceExtensions = () => es.merge(...builtInExtensions
.filter(({ name }) => opts.desiredExtensions ? opts.desiredExtensions.indexOf(name) >= 0 : true)
......
......@@ -90,7 +90,7 @@ function fromLocalWebpack(extensionPath: string, sourceMappingURLBase: string |
.pipe(packageJsonFilter.restore);
const webpackStreams = webpackConfigLocations.map(webpackConfigPath => {
const webpackStreams = webpackConfigLocations.map(webpackConfigPath => () => {
const webpackDone = (err: any, stats: any) => {
util.log(`Bundled extension: ${util.colors.yellow(path.join(path.basename(extensionPath), path.relative(extensionPath, webpackConfigPath)))}...`);
......@@ -139,7 +139,7 @@ function fromLocalWebpack(extensionPath: string, sourceMappingURLBase: string |
}));
});
es.merge(...webpackStreams, patchFilesStream)
es.merge(sequence(webpackStreams), patchFilesStream)
// .pipe(es.through(function (data) {
// // debug
// console.log('out', data.path, data.contents.length);
......@@ -270,10 +270,10 @@ export function packageExtensionsStream(optsIn?: IPackageExtensionsOptions): Nod
.filter(({ name }) => opts.desiredExtensions ? opts.desiredExtensions.indexOf(name) >= 0 : true)
.filter(({ name }) => builtInExtensions.every(b => b.name !== name));
const localExtensions = () => es.merge(...localExtensionDescriptions.map(extension => {
const localExtensions = () => sequence([...localExtensionDescriptions.map(extension => () => {
return fromLocal(extension.path, opts.sourceMappingURLBase)
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
}));
})]);
const localExtensionDependencies = () => gulp.src('extensions/node_modules/**', { base: '.' });
......
......@@ -90,6 +90,7 @@ function extractEditor(options) {
}
}
}
delete tsConfig.compilerOptions.moduleResolution;
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
[
'vs/css.build.js',
......@@ -126,7 +127,7 @@ function createESMSourcesAndResources2(options) {
if (file === 'tsconfig.json') {
const tsConfig = JSON.parse(fs.readFileSync(path.join(SRC_FOLDER, file)).toString());
tsConfig.compilerOptions.module = 'es6';
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs');
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs').replace(/\\/g, '/');
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
continue;
}
......@@ -154,15 +155,16 @@ function createESMSourcesAndResources2(options) {
importedFilepath = path.join(path.dirname(file), importedFilepath);
}
let relativePath;
if (importedFilepath === path.dirname(file)) {
if (importedFilepath === path.dirname(file).replace(/\\/g, '/')) {
relativePath = '../' + path.basename(path.dirname(file));
}
else if (importedFilepath === path.dirname(path.dirname(file))) {
else if (importedFilepath === path.dirname(path.dirname(file)).replace(/\\/g, '/')) {
relativePath = '../../' + path.basename(path.dirname(path.dirname(file)));
}
else {
relativePath = path.relative(path.dirname(file), importedFilepath);
}
relativePath = relativePath.replace(/\\/g, '/');
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
relativePath = './' + relativePath;
}
......
......@@ -99,6 +99,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
}
}
delete tsConfig.compilerOptions.moduleResolution;
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
[
......@@ -148,7 +149,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
if (file === 'tsconfig.json') {
const tsConfig = JSON.parse(fs.readFileSync(path.join(SRC_FOLDER, file)).toString());
tsConfig.compilerOptions.module = 'es6';
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs');
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs').replace(/\\/g, '/');
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
continue;
}
......@@ -181,13 +182,14 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
}
let relativePath: string;
if (importedFilepath === path.dirname(file)) {
if (importedFilepath === path.dirname(file).replace(/\\/g, '/')) {
relativePath = '../' + path.basename(path.dirname(file));
} else if (importedFilepath === path.dirname(path.dirname(file))) {
} else if (importedFilepath === path.dirname(path.dirname(file)).replace(/\\/g, '/')) {
relativePath = '../../' + path.basename(path.dirname(path.dirname(file)));
} else {
relativePath = path.relative(path.dirname(file), importedFilepath);
}
relativePath = relativePath.replace(/\\/g, '/');
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
relativePath = './' + relativePath;
}
......
......@@ -57,7 +57,7 @@ function createTypeScriptLanguageService(options) {
const FILES = discoverAndReadFiles(options);
// Add fake usage files
options.inlineEntryPoints.forEach((inlineEntryPoint, index) => {
FILES[`inlineEntryPoint:${index}.ts`] = inlineEntryPoint;
FILES[`inlineEntryPoint.${index}.ts`] = inlineEntryPoint;
});
// Add additional typings
options.typings.forEach((typing) => {
......@@ -336,7 +336,7 @@ function markNodes(languageService, options) {
}
options.entryPoints.forEach(moduleId => enqueueFile(moduleId + '.ts'));
// Add fake usage files
options.inlineEntryPoints.forEach((_, index) => enqueueFile(`inlineEntryPoint:${index}.ts`));
options.inlineEntryPoints.forEach((_, index) => enqueueFile(`inlineEntryPoint.${index}.ts`));
let step = 0;
const checker = program.getTypeChecker();
while (black_queue.length > 0 || gray_queue.length > 0) {
......
......@@ -110,7 +110,7 @@ function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.Langu
// Add fake usage files
options.inlineEntryPoints.forEach((inlineEntryPoint, index) => {
FILES[`inlineEntryPoint:${index}.ts`] = inlineEntryPoint;
FILES[`inlineEntryPoint.${index}.ts`] = inlineEntryPoint;
});
// Add additional typings
......@@ -445,7 +445,7 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt
options.entryPoints.forEach(moduleId => enqueueFile(moduleId + '.ts'));
// Add fake usage files
options.inlineEntryPoints.forEach((_, index) => enqueueFile(`inlineEntryPoint:${index}.ts`));
options.inlineEntryPoints.forEach((_, index) => enqueueFile(`inlineEntryPoint.${index}.ts`));
let step = 0;
......
此差异已折叠。
......@@ -6,6 +6,15 @@
import { transformErrorForSerialization } from 'vs/base/common/errors';
import { Disposable } from 'vs/base/common/lifecycle';
import { isWeb } from 'vs/base/common/platform';
import { PolyfillPromise } from 'vs/base/common/winjs.polyfill.promise';
var global: any = self;
// When missing, polyfill the native promise
// with our winjs-based polyfill
if (typeof global.Promise === 'undefined') {
global.Promise = PolyfillPromise;
}
const INITIALIZE = '$initialize';
......
......@@ -231,15 +231,15 @@ export class Server extends IPCServer {
}
}
export class Client extends IPCClient {
export class Client<TContext = string> extends IPCClient<TContext> {
static fromSocket(socket: Socket, id: string): Client {
static fromSocket<TContext = string>(socket: Socket, id: TContext): Client<TContext> {
return new Client(new Protocol(socket), id);
}
get onClose(): Event<void> { return this.protocol.onClose; }
constructor(private protocol: Protocol, id: string) {
constructor(private protocol: Protocol, id: TContext) {
super(protocol, id);
}
......
......@@ -5,16 +5,15 @@
import * as assert from 'assert';
import { IPager, PagedModel } from 'vs/base/common/paging';
import { TPromise } from 'vs/base/common/winjs.base';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { isPromiseCanceledError, canceled } from 'vs/base/common/errors';
function getPage(pageIndex: number, cancellationToken: CancellationToken): Thenable<number[]> {
if (cancellationToken.isCancellationRequested) {
return TPromise.wrapError(canceled());
return Promise.reject(canceled());
}
return TPromise.as([0, 1, 2, 3, 4].map(i => i + (pageIndex * 5)));
return Promise.resolve([0, 1, 2, 3, 4].map(i => i + (pageIndex * 5)));
}
class TestPager implements IPager<number> {
......@@ -102,7 +101,7 @@ suite('PagedModel', () => {
test('preemptive cancellation works', async function () {
const pager = new TestPager(() => {
assert(false);
return TPromise.wrap([]);
return Promise.resolve([]);
});
const model = new PagedModel(pager);
......@@ -117,7 +116,7 @@ suite('PagedModel', () => {
});
test('cancellation works', function () {
const pager = new TestPager((_, token) => new TPromise((_, e) => {
const pager = new TestPager((_, token) => new Promise((_, e) => {
token.onCancellationRequested(() => e(canceled()));
}));
......@@ -140,7 +139,7 @@ suite('PagedModel', () => {
const pager = new TestPager((pageIndex, token) => {
state = 'resolving';
return new TPromise((_, e) => {
return new Promise((_, e) => {
token.onCancellationRequested(() => {
state = 'idle';
e(canceled());
......@@ -180,6 +179,6 @@ suite('PagedModel', () => {
}, 10);
}, 10);
return TPromise.join([promise1, promise2]);
return Promise.all([promise1, promise2]);
});
});
\ No newline at end of file
});
......@@ -57,7 +57,7 @@ import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
import * as errors from 'vs/base/common/errors';
import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener';
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
import { connectRemoteAgentManagement } from 'vs/platform/remote/node/remoteAgentConnection';
import { connectRemoteAgentManagement, RemoteAgentConnectionContext } from 'vs/platform/remote/node/remoteAgentConnection';
import { IMenubarService } from 'vs/platform/menubar/common/menubar';
import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService';
import { MenubarChannel } from 'vs/platform/menubar/node/menubarIpc';
......@@ -174,13 +174,13 @@ export class CodeApplication {
class ActiveConnection {
private _authority: string;
private _client: TPromise<Client>;
private _client: TPromise<Client<RemoteAgentConnectionContext>>;
private _disposeRunner: RunOnceScheduler;
constructor(authority: string, connectionInfo: TPromise<ResolvedAuthority>) {
this._authority = authority;
this._client = connectionInfo.then(({ host, port }) => {
return connectRemoteAgentManagement(host, port, `main`);
return connectRemoteAgentManagement(authority, host, port, `main`);
});
this._disposeRunner = new RunOnceScheduler(() => this._dispose(), 5000);
}
......@@ -193,7 +193,7 @@ export class CodeApplication {
});
}
public getClient(): TPromise<Client> {
public getClient(): TPromise<Client<RemoteAgentConnectionContext>> {
this._disposeRunner.schedule();
return this._client;
}
......
......@@ -15,7 +15,6 @@ import { Emitter, Event } from 'vs/base/common/event';
import { hash } from 'vs/base/common/hash';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { Schemas } from 'vs/base/common/network';
import { mark } from 'vs/base/common/performance';
import { Configuration } from 'vs/editor/browser/config/configuration';
import { CoreEditorCommand } from 'vs/editor/browser/controller/coreCommands';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
......@@ -286,7 +285,6 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._contentWidgets = {};
this._overlayWidgets = {};
mark('editor/start/contrib');
let contributions: IEditorContributionCtor[];
if (Array.isArray(codeEditorWidgetOptions.contributions)) {
contributions = codeEditorWidgetOptions.contributions;
......@@ -302,7 +300,6 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
onUnexpectedError(err);
}
}
mark('editor/end/contrib');
EditorExtensionsRegistry.getEditorActions().forEach((action) => {
const internalAction = new InternalEditorAction(
......
......@@ -23,16 +23,14 @@ export interface IEditorScrollbarOptions {
arrowSize?: number;
/**
* Render vertical scrollbar.
* Accepted values: 'auto', 'visible', 'hidden'.
* Defaults to 'auto'.
*/
vertical?: string;
vertical?: 'auto' | 'visible' | 'hidden';
/**
* Render horizontal scrollbar.
* Accepted values: 'auto', 'visible', 'hidden'.
* Defaults to 'auto'.
*/
horizontal?: string;
horizontal?: 'auto' | 'visible' | 'hidden';
/**
* Cast horizontal and vertical shadows when the content is scrolled.
* Defaults to true.
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册