mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
Merge from vscode 6e530127a1bb8ffbd1bfb77dc680c321dc0d71f5 (#6844)
This commit is contained in:
@@ -424,4 +424,40 @@ suite('ExtHostDiagnostics', () => {
|
||||
collection.set(URI.parse('test:me'), array);
|
||||
assert.equal(callCount, 3); // same but un-equal array
|
||||
});
|
||||
|
||||
test('Diagnostics created by tasks aren\'t accessible to extensions #47292', async function () {
|
||||
const diags = new ExtHostDiagnostics(new class implements IMainContext {
|
||||
getProxy(id: any): any {
|
||||
return {};
|
||||
}
|
||||
set(): any {
|
||||
return null;
|
||||
}
|
||||
assertRegistered(): void {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
const uri = URI.parse('foo:bar');
|
||||
const data: IMarkerData[] = [{
|
||||
message: 'message',
|
||||
startLineNumber: 1,
|
||||
startColumn: 1,
|
||||
endLineNumber: 1,
|
||||
endColumn: 1,
|
||||
severity: 3
|
||||
}];
|
||||
|
||||
const p1 = Event.toPromise(diags.onDidChangeDiagnostics);
|
||||
diags.$acceptMarkersChange([[uri, data]]);
|
||||
await p1;
|
||||
assert.equal(diags.getDiagnostics(uri).length, 1);
|
||||
|
||||
const p2 = Event.toPromise(diags.onDidChangeDiagnostics);
|
||||
diags.$acceptMarkersChange([[uri, []]]);
|
||||
await p2;
|
||||
assert.equal(diags.getDiagnostics(uri).length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ suite('ExtHostWebview', () => {
|
||||
assert.strictEqual(lastInvokedDeserializer, serializerB);
|
||||
});
|
||||
|
||||
test('toWebviewResource for desktop vscode-resource scheme', () => {
|
||||
test('asWebviewUri for desktop vscode-resource scheme', () => {
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
|
||||
webviewCspSource: '',
|
||||
@@ -57,37 +57,37 @@ suite('ExtHostWebview', () => {
|
||||
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
|
||||
|
||||
assert.strictEqual(
|
||||
webview.webview.toWebviewResource(URI.parse('file:///Users/codey/file.html')).toString(),
|
||||
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html')).toString(),
|
||||
'vscode-resource:/Users/codey/file.html',
|
||||
'Unix basic'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
webview.webview.toWebviewResource(URI.parse('file:///Users/codey/file.html#frag')).toString(),
|
||||
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html#frag')).toString(),
|
||||
'vscode-resource:/Users/codey/file.html#frag',
|
||||
'Unix should preserve fragment'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
webview.webview.toWebviewResource(URI.parse('file:///Users/codey/f%20ile.html')).toString(),
|
||||
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/f%20ile.html')).toString(),
|
||||
'vscode-resource:/Users/codey/f%20ile.html',
|
||||
'Unix with encoding'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
webview.webview.toWebviewResource(URI.parse('file://localhost/Users/codey/file.html')).toString(),
|
||||
webview.webview.asWebviewUri(URI.parse('file://localhost/Users/codey/file.html')).toString(),
|
||||
'vscode-resource://localhost/Users/codey/file.html',
|
||||
'Unix should preserve authority'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
webview.webview.toWebviewResource(URI.parse('file:///c:/codey/file.txt')).toString(),
|
||||
webview.webview.asWebviewUri(URI.parse('file:///c:/codey/file.txt')).toString(),
|
||||
'vscode-resource:/c%3A/codey/file.txt',
|
||||
'Windows C drive'
|
||||
);
|
||||
});
|
||||
|
||||
test('toWebviewResource for web endpoint', () => {
|
||||
test('asWebviewUri for web endpoint', () => {
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
|
||||
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
|
||||
@@ -101,31 +101,31 @@ suite('ExtHostWebview', () => {
|
||||
}
|
||||
|
||||
assert.strictEqual(
|
||||
stripEndpointUuid(webview.webview.toWebviewResource(URI.parse('file:///Users/codey/file.html')).toString()),
|
||||
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html')).toString()),
|
||||
'webview.contoso.com/commit///Users/codey/file.html',
|
||||
'Unix basic'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
stripEndpointUuid(webview.webview.toWebviewResource(URI.parse('file:///Users/codey/file.html#frag')).toString()),
|
||||
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html#frag')).toString()),
|
||||
'webview.contoso.com/commit///Users/codey/file.html#frag',
|
||||
'Unix should preserve fragment'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
stripEndpointUuid(webview.webview.toWebviewResource(URI.parse('file:///Users/codey/f%20ile.html')).toString()),
|
||||
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/f%20ile.html')).toString()),
|
||||
'webview.contoso.com/commit///Users/codey/f%20ile.html',
|
||||
'Unix with encoding'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
stripEndpointUuid(webview.webview.toWebviewResource(URI.parse('file://localhost/Users/codey/file.html')).toString()),
|
||||
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file://localhost/Users/codey/file.html')).toString()),
|
||||
'webview.contoso.com/commit//localhost/Users/codey/file.html',
|
||||
'Unix should preserve authority'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
stripEndpointUuid(webview.webview.toWebviewResource(URI.parse('file:///c:/codey/file.txt')).toString()),
|
||||
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///c:/codey/file.txt')).toString()),
|
||||
'webview.contoso.com/commit///c%3A/codey/file.txt',
|
||||
'Windows C drive'
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as assert from 'assert';
|
||||
import { MarkerService } from 'vs/platform/markers/common/markerService';
|
||||
import { MainThreadDiagnostics } from 'vs/workbench/api/browser/mainThreadDiagnostics';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
|
||||
|
||||
suite('MainThreadDiagnostics', function () {
|
||||
@@ -19,7 +20,16 @@ suite('MainThreadDiagnostics', function () {
|
||||
|
||||
test('clear markers on dispose', function () {
|
||||
|
||||
let diag = new MainThreadDiagnostics(null!, markerService);
|
||||
let diag = new MainThreadDiagnostics(new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
assertRegistered() { }
|
||||
set(v: any): any { return null; }
|
||||
getProxy(): any {
|
||||
return {
|
||||
$acceptMarkersChange() { }
|
||||
};
|
||||
}
|
||||
}, markerService);
|
||||
|
||||
diag.$changeMany('foo', [[URI.file('a'), [{
|
||||
code: '666',
|
||||
|
||||
Reference in New Issue
Block a user