Skip to content

Commit 8f4d34e

Browse files
committed
Merge branch 'master' into sandy081/requestService
2 parents 2c895cf + 9f70a16 commit 8f4d34e

94 files changed

Lines changed: 912 additions & 2736 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/gulpfile.vscode.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ const apiToken = process.env.TRANSIFEX_API_TOKEN;
475475
gulp.task(task.define(
476476
'vscode-translations-push',
477477
task.series(
478+
compileBuildTask,
479+
compileExtensionsBuildTask,
478480
optimizeVSCodeTask,
479481
function () {
480482
const pathToMetadata = './out-vscode/nls.metadata.json';
@@ -494,6 +496,8 @@ gulp.task(task.define(
494496
gulp.task(task.define(
495497
'vscode-translations-export',
496498
task.series(
499+
compileBuildTask,
500+
compileExtensionsBuildTask,
497501
optimizeVSCodeTask,
498502
function () {
499503
const pathToMetadata = './out-vscode/nls.metadata.json';

extensions/typescript-language-features/src/features/task.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class TscTaskProvider implements vscode.TaskProvider {
7272
}
7373

7474
public resolveTask(_task: vscode.Task): vscode.Task | undefined {
75+
const definition = <TypeScriptTaskDefinition>_task.definition;
76+
const badTsconfig = '\\tsconfig.json';
77+
if ((definition.tsconfig.length > badTsconfig.length) && (definition.tsconfig.substring(definition.tsconfig.length - badTsconfig.length, definition.tsconfig.length) === badTsconfig)) {
78+
// Warn that the task has the wrong slash type
79+
vscode.window.showWarningMessage(localize('badTsConfig', "Typescript Task in tasks.json contains \"\\\\\". Typescript tasks must use \"/\""));
80+
}
7581
return undefined;
7682
}
7783

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.37.0",
4-
"distro": "3c319811459f451676c3ccb148f96c49d342dbdc",
4+
"distro": "40f61fd7e131c62473197b6505a3168a6bce1bc6",
55
"author": {
66
"name": "Microsoft Corporation"
77
},

src/tsconfig.base.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"module": "amd",
44
"moduleResolution": "node",
55
"noImplicitAny": true,
6-
"suppressImplicitAnyIndexErrors": true,
76
"target": "es5",
87
"experimentalDecorators": true,
98
"noImplicitReturns": true,

src/vs/base/browser/htmlContentRenderer.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as DOM from 'vs/base/browser/dom';
77
import { defaultGenerator } from 'vs/base/common/idGenerator';
88
import { escape } from 'vs/base/common/strings';
9-
import { removeMarkdownEscapes, IMarkdownString } from 'vs/base/common/htmlContent';
9+
import { removeMarkdownEscapes, IMarkdownString, parseHrefAndDimensions } from 'vs/base/common/htmlContent';
1010
import * as marked from 'vs/base/common/marked/marked';
1111
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
1212
import { DisposableStore } from 'vs/base/common/lifecycle';
@@ -100,29 +100,11 @@ export function renderMarkdown(markdown: IMarkdownString, options: RenderOptions
100100

101101
const renderer = new marked.Renderer();
102102
renderer.image = (href: string, title: string, text: string) => {
103-
href = _href(href, true);
104103
let dimensions: string[] = [];
105-
if (href) {
106-
const splitted = href.split('|').map(s => s.trim());
107-
href = splitted[0];
108-
const parameters = splitted[1];
109-
if (parameters) {
110-
const heightFromParams = /height=(\d+)/.exec(parameters);
111-
const widthFromParams = /width=(\d+)/.exec(parameters);
112-
const height = heightFromParams ? heightFromParams[1] : '';
113-
const width = widthFromParams ? widthFromParams[1] : '';
114-
const widthIsFinite = isFinite(parseInt(width));
115-
const heightIsFinite = isFinite(parseInt(height));
116-
if (widthIsFinite) {
117-
dimensions.push(`width="${width}"`);
118-
}
119-
if (heightIsFinite) {
120-
dimensions.push(`height="${height}"`);
121-
}
122-
}
123-
}
124104
let attributes: string[] = [];
125105
if (href) {
106+
({ href, dimensions } = parseHrefAndDimensions(href));
107+
href = _href(href, true);
126108
attributes.push(`src="${href}"`);
127109
}
128110
if (text) {

src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface IBreadcrumbsItemEvent {
5757

5858
export class BreadcrumbsWidget {
5959

60-
private readonly _disposables = new Array<IDisposable>();
60+
private readonly _disposables = new DisposableStore();
6161
private readonly _domNode: HTMLDivElement;
6262
private readonly _styleElement: HTMLStyleElement;
6363
private readonly _scrollable: DomScrollableElement;
@@ -94,26 +94,25 @@ export class BreadcrumbsWidget {
9494
useShadows: false,
9595
scrollYToX: true
9696
});
97-
this._disposables.push(this._scrollable);
98-
this._disposables.push(dom.addStandardDisposableListener(this._domNode, 'click', e => this._onClick(e)));
97+
this._disposables.add(this._scrollable);
98+
this._disposables.add(dom.addStandardDisposableListener(this._domNode, 'click', e => this._onClick(e)));
9999
container.appendChild(this._scrollable.getDomNode());
100100

101101
this._styleElement = dom.createStyleSheet(this._domNode);
102102

103-
let focusTracker = dom.trackFocus(this._domNode);
104-
this._disposables.push(focusTracker);
105-
this._disposables.push(focusTracker.onDidBlur(_ => this._onDidChangeFocus.fire(false)));
106-
this._disposables.push(focusTracker.onDidFocus(_ => this._onDidChangeFocus.fire(true)));
103+
const focusTracker = dom.trackFocus(this._domNode);
104+
this._disposables.add(focusTracker);
105+
this._disposables.add(focusTracker.onDidBlur(_ => this._onDidChangeFocus.fire(false)));
106+
this._disposables.add(focusTracker.onDidFocus(_ => this._onDidChangeFocus.fire(true)));
107107
}
108108

109109
dispose(): void {
110-
dispose(this._disposables);
110+
this._disposables.dispose();
111111
dispose(this._pendingLayout);
112112
this._onDidSelectItem.dispose();
113113
this._onDidFocusItem.dispose();
114114
this._onDidChangeFocus.dispose();
115115
this._domNode.remove();
116-
this._disposables.length = 0;
117116
this._nodes.length = 0;
118117
this._freeNodes.length = 0;
119118
}

src/vs/base/common/buffer.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,13 @@ export interface VSBufferReadable {
141141
read(): VSBuffer | null;
142142
}
143143

144-
/**
145-
* A buffer readable stream emits data to listeners. The stream
146-
* will only start emitting when the first data listener has
147-
* been added or the resume() method has been called.
148-
*/
149-
export interface VSBufferReadableStream {
144+
export interface ReadableStream<T> {
150145

151146
/**
152147
* The 'data' event is emitted whenever the stream is
153148
* relinquishing ownership of a chunk of data to a consumer.
154149
*/
155-
on(event: 'data', callback: (chunk: VSBuffer) => void): void;
150+
on(event: 'data', callback: (chunk: T) => void): void;
156151

157152
/**
158153
* Emitted when any error occurs.
@@ -188,6 +183,17 @@ export function isVSBufferReadableStream(obj: any): obj is VSBufferReadableStrea
188183
return candidate && [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every(fn => typeof fn === 'function');
189184
}
190185

186+
/**
187+
* A readable stream that sends data via VSBuffer.
188+
*/
189+
export interface VSBufferReadableStream extends ReadableStream<VSBuffer> { }
190+
191+
export function isVSBufferReadableStream(obj: any): obj is VSBufferReadableStream {
192+
const candidate: VSBufferReadableStream = obj;
193+
194+
return candidate && [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every(fn => typeof fn === 'function');
195+
}
196+
191197
/**
192198
* Helper to fully read a VSBuffer readable into a single buffer.
193199
*/
@@ -245,6 +251,19 @@ export function bufferToStream(buffer: VSBuffer): VSBufferReadableStream {
245251
return stream;
246252
}
247253

254+
/**
255+
* Helper to create a VSBufferStream from a Uint8Array stream.
256+
*/
257+
export function toVSBufferReadableStream(stream: ReadableStream<Uint8Array>): VSBufferReadableStream {
258+
const vsbufferStream = writeableBufferStream();
259+
260+
stream.on('data', data => vsbufferStream.write(VSBuffer.wrap(data)));
261+
stream.on('end', () => vsbufferStream.end());
262+
stream.on('error', error => vsbufferStream.error(error));
263+
264+
return vsbufferStream;
265+
}
266+
248267
/**
249268
* Helper to create a VSBufferStream that can be pushed
250269
* buffers to. Will only start to emit data when a listener

src/vs/base/common/htmlContent.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,25 @@ export function removeMarkdownEscapes(text: string): string {
9292
}
9393
return text.replace(/\\([\\`*_{}[\]()#+\-.!])/g, '$1');
9494
}
95+
96+
export function parseHrefAndDimensions(href: string): { href: string, dimensions: string[] } {
97+
const dimensions: string[] = [];
98+
const splitted = href.split('|').map(s => s.trim());
99+
href = splitted[0];
100+
const parameters = splitted[1];
101+
if (parameters) {
102+
const heightFromParams = /height=(\d+)/.exec(parameters);
103+
const widthFromParams = /width=(\d+)/.exec(parameters);
104+
const height = heightFromParams ? heightFromParams[1] : '';
105+
const width = widthFromParams ? widthFromParams[1] : '';
106+
const widthIsFinite = isFinite(parseInt(width));
107+
const heightIsFinite = isFinite(parseInt(height));
108+
if (widthIsFinite) {
109+
dimensions.push(`width="${width}"`);
110+
}
111+
if (heightIsFinite) {
112+
dimensions.push(`height="${height}"`);
113+
}
114+
}
115+
return { href, dimensions };
116+
}

src/vs/base/common/lifecycle.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ export function combinedDisposable(...disposables: IDisposable[]): IDisposable {
8181
}
8282

8383
export function toDisposable(fn: () => void): IDisposable {
84-
return trackDisposable({ dispose: fn });
84+
const self = trackDisposable({
85+
dispose: () => {
86+
markTracked(self);
87+
fn();
88+
}
89+
});
90+
return self;
8591
}
8692

8793
export class DisposableStore implements IDisposable {

src/vs/base/common/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ export function getAllPropertyNames(obj: object): string[] {
170170
}
171171

172172
export function getAllMethodNames(obj: object): string[] {
173-
let methods: string[] = [];
173+
const methods: string[] = [];
174174
for (const prop of getAllPropertyNames(obj)) {
175-
if (typeof obj[prop] === 'function') {
175+
if (typeof (obj as any)[prop] === 'function') {
176176
methods.push(prop);
177177
}
178178
}

0 commit comments

Comments
 (0)