Skip to content

Commit ac03e62

Browse files
committed
last round of making changes smaller
1 parent b49bf46 commit ac03e62

7 files changed

Lines changed: 12 additions & 44 deletions

File tree

src/vs/vscode.proposed.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ declare module 'vscode' {
3333

3434
export namespace workspace {
3535
export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
36-
3736
}
37+
3838
//#endregion
3939

4040

src/vs/workbench/api/electron-browser/mainThreadWebview.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi
3030
@extHostNamedCustomer(MainContext.MainThreadWebviews)
3131
export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver {
3232

33-
_serviceBrand: any;
34-
3533
private static readonly viewType = 'mainThreadWebview';
3634

3735
private static readonly standardSupportedLinkSchemes = ['http', 'https', 'mailto'];
@@ -352,7 +350,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
352350
}
353351
}
354352

355-
public getWebview(handle: WebviewPanelHandle): WebviewEditorInput {
353+
private getWebview(handle: WebviewPanelHandle): WebviewEditorInput {
356354
const webview = this._webviews.get(handle);
357355
if (!webview) {
358356
throw new Error('Unknown webview handle:' + handle);

src/vs/workbench/api/node/extHost.protocol.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -505,18 +505,6 @@ export interface ExtHostWebviewsShape {
505505
$deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: vscode.WebviewOptions): Promise<void>;
506506
}
507507

508-
// export type CodeInsetWebviewHandle = string;
509-
510-
// export interface ExtHostCodeInsetWebviewsShape {
511-
// }
512-
513-
// export interface ExtHostCodeInsetWebviewShape extends IDisposable {
514-
// $setHtml(handle: WebviewPanelHandle, value: string): void;
515-
// $setOptions(handle: WebviewPanelHandle, options: vscode.WebviewOptions): void;
516-
// $postMessage(handle: WebviewPanelHandle, value: any): Promise<boolean>;
517-
// }
518-
519-
520508
export interface MainThreadUrlsShape extends IDisposable {
521509
$registerUriHandler(handle: number, extensionId: ExtensionIdentifier): Promise<void>;
522510
$unregisterUriHandler(handle: number): Promise<void>;
@@ -1179,7 +1167,6 @@ export const ExtHostContext = {
11791167
ExtHostWorkspace: createExtId<ExtHostWorkspaceShape>('ExtHostWorkspace'),
11801168
ExtHostWindow: createExtId<ExtHostWindowShape>('ExtHostWindow'),
11811169
ExtHostWebviews: createExtId<ExtHostWebviewsShape>('ExtHostWebviews'),
1182-
// ExtHostCodeInsetWebviews: createExtId<ExtHostCodeInsetWebviewsShape>('ExtHostWebviews'),
11831170
ExtHostProgress: createMainId<ExtHostProgressShape>('ExtHostProgress'),
11841171
ExtHostComments: createMainId<ExtHostCommentsShape>('ExtHostComments'),
11851172
ExtHostStorage: createMainId<ExtHostStorageShape>('ExtHostStorage'),

src/vs/workbench/api/node/extHostLanguageFeatures.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,16 +1134,16 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
11341134

11351135
registerCodeInsetProvider(extension: IExtensionDescription, selector: vscode.DocumentSelector, provider: vscode.CodeInsetProvider): vscode.Disposable {
11361136
const handle = this._nextHandle();
1137-
// const eventHandle = typeof provider.onDidChangeCodeInsets === 'function' ? this._nextHandle() : undefined;
1137+
const eventHandle = typeof provider.onDidChangeCodeInsets === 'function' ? this._nextHandle() : undefined;
11381138

11391139
this._adapter.set(handle, new AdapterData(new CodeInsetAdapter(this._documents, this._heapService, provider), extension));
1140-
this._proxy.$registerCodeInsetSupport(handle, this._transformDocumentSelector(selector), undefined);
1140+
this._proxy.$registerCodeInsetSupport(handle, this._transformDocumentSelector(selector), eventHandle);
11411141
let result = this._createDisposable(handle);
11421142

1143-
// if (eventHandle !== undefined) {
1144-
// const subscription = provider.onDidChangeCodeInsets(_ => this._proxy.$emitCodeLensEvent(eventHandle));
1145-
// result = Disposable.from(result, subscription);
1146-
// }
1143+
if (eventHandle !== undefined) {
1144+
const subscription = provider.onDidChangeCodeInsets(_ => this._proxy.$emitCodeLensEvent(eventHandle));
1145+
result = Disposable.from(result, subscription);
1146+
}
11471147

11481148
return result;
11491149
}

src/vs/workbench/api/node/extHostTypes.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,12 +1140,10 @@ export class CodeLens {
11401140
export class CodeInset {
11411141

11421142
range: Range;
1143-
isResolved: boolean;
11441143
height?: number;
11451144

11461145
constructor(range: Range, height?: number) {
11471146
this.range = range;
1148-
this.isResolved = false;
11491147
this.height = height;
11501148
}
11511149
}

src/vs/workbench/contrib/webview/electron-browser/webview-pre.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
delete window.frameElement;
244244
`;
245245

246-
newDocument.head.prepend(defaultScript);
246+
newDocument.head.prepend(defaultScript, newDocument.head.firstChild);
247247
}
248248

249249
// apply default styles

src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
1313
import * as colorRegistry from 'vs/platform/theme/common/colorRegistry';
1414
import { DARK, ITheme, IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
1515
import { registerFileProtocol, WebviewProtocol } from 'vs/workbench/contrib/webview/electron-browser/webviewProtocols';
16+
import { areWebviewInputOptionsEqual } from './webviewEditorService';
1617
import { WebviewFindWidget } from './webviewFindWidget';
1718
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1819
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
1920
import { endsWith } from 'vs/base/common/strings';
2021
import { isMacintosh } from 'vs/base/common/platform';
21-
import { equals } from 'vs/base/common/arrays';
2222

2323
export interface WebviewOptions {
2424
readonly allowSvgs?: boolean;
@@ -33,20 +33,6 @@ export interface WebviewContentOptions {
3333
readonly disableFindView?: boolean;
3434
}
3535

36-
37-
export function areWebviewContentOptionsEqual(a: WebviewContentOptions, b: WebviewContentOptions): boolean {
38-
const sameArray = <T>(a1: ReadonlyArray<T>, a2: ReadonlyArray<T>) =>
39-
(a.localResourceRoots === b.localResourceRoots
40-
|| (Array.isArray(a.localResourceRoots) && Array.isArray(b.localResourceRoots)
41-
&& equals(a.localResourceRoots, b.localResourceRoots, (a, b) => a.toString() === b.toString())));
42-
43-
return a.allowScripts === b.allowScripts
44-
&& a.disableFindView === b.disableFindView
45-
&& sameArray(a.svgWhiteList, b.svgWhiteList)
46-
&& sameArray(a.localResourceRoots, b.localResourceRoots);
47-
}
48-
49-
5036
interface IKeydownEvent {
5137
key: string;
5238
keyCode: number;
@@ -263,7 +249,6 @@ export class WebviewElement extends Disposable {
263249
this._webview.setAttribute('partition', `webview${Date.now()}`);
264250

265251
this._webview.setAttribute('webpreferences', 'contextIsolation=yes');
266-
this._webview.setAttribute('autosize', 'on');
267252

268253
this._webview.style.flex = '0 1';
269254
this._webview.style.width = '0';
@@ -417,7 +402,7 @@ export class WebviewElement extends Disposable {
417402
}
418403

419404
public set options(value: WebviewContentOptions) {
420-
if (this._contentOptions && areWebviewContentOptionsEqual(value, this._contentOptions)) {
405+
if (this._contentOptions && areWebviewInputOptionsEqual(value, this._contentOptions)) {
421406
return;
422407
}
423408

@@ -439,7 +424,7 @@ export class WebviewElement extends Disposable {
439424
}
440425

441426
public update(value: string, options: WebviewContentOptions, retainContextWhenHidden: boolean) {
442-
if (retainContextWhenHidden && value === this._contents && this._contentOptions && areWebviewContentOptionsEqual(options, this._contentOptions)) {
427+
if (retainContextWhenHidden && value === this._contents && this._contentOptions && areWebviewInputOptionsEqual(options, this._contentOptions)) {
443428
return;
444429
}
445430
this._contents = value;

0 commit comments

Comments
 (0)