mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Merge branch 'main' into notebook/dev
This commit is contained in:
@@ -34,7 +34,7 @@ export class MainThreadAuthenticationProvider extends Disposable {
|
||||
const allowedExtensions = readAllowedExtensions(this.storageService, this.id, accountName);
|
||||
|
||||
if (!allowedExtensions.length) {
|
||||
this.dialogService.show(Severity.Info, nls.localize('noTrustedExtensions', "This account has not been used by any extensions."), []);
|
||||
this.dialogService.show(Severity.Info, nls.localize('noTrustedExtensions', "This account has not been used by any extensions."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -321,14 +321,20 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
return extHostUrls.createAppUri(uri);
|
||||
}
|
||||
|
||||
if (!matchesScheme(uri, Schemas.http) && !matchesScheme(uri, Schemas.https)) {
|
||||
const isHttp = matchesScheme(uri, Schemas.http) || matchesScheme(uri, Schemas.https);
|
||||
|
||||
if (!isHttp) {
|
||||
checkProposedApiEnabled(extension); // https://github.com/microsoft/vscode/issues/124263
|
||||
}
|
||||
|
||||
try {
|
||||
return await extHostWindow.asExternalUri(uri, { allowTunneling: !!initData.remote.authority });
|
||||
} catch {
|
||||
return uri;
|
||||
} catch (err) {
|
||||
if (isHttp) {
|
||||
return uri;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
get remoteName() {
|
||||
|
||||
@@ -323,7 +323,7 @@ const newCommands: ApiCommand[] = [
|
||||
),
|
||||
// --- inline hints
|
||||
new ApiCommand(
|
||||
'vscode.executeInlayHintProvider', '_executeInlayHintProvider', 'Execute inline hints provider',
|
||||
'vscode.executeInlayHintProvider', '_executeInlayHintProvider', 'Execute inlay hints provider',
|
||||
[ApiCommandArgument.Uri, ApiCommandArgument.Range],
|
||||
new ApiCommandResult<modes.InlayHint[], vscode.InlayHint[]>('A promise that resolves to an array of Inlay objects', result => {
|
||||
return result.map(typeConverters.InlayHint.to);
|
||||
|
||||
@@ -1199,50 +1199,62 @@ class LinkProviderAdapter {
|
||||
private readonly _provider: vscode.DocumentLinkProvider
|
||||
) { }
|
||||
|
||||
provideLinks(resource: URI, token: CancellationToken): Promise<extHostProtocol.ILinksListDto | undefined> {
|
||||
async provideLinks(resource: URI, token: CancellationToken): Promise<extHostProtocol.ILinksListDto | undefined> {
|
||||
const doc = this._documents.getDocument(resource);
|
||||
|
||||
return asPromise(() => this._provider.provideDocumentLinks(doc, token)).then(links => {
|
||||
if (!Array.isArray(links) || links.length === 0) {
|
||||
// bad result
|
||||
return undefined;
|
||||
}
|
||||
const links = await asPromise(() => this._provider.provideDocumentLinks(doc, token));
|
||||
if (!Array.isArray(links) || links.length === 0) {
|
||||
// bad result
|
||||
return undefined;
|
||||
}
|
||||
if (token.isCancellationRequested) {
|
||||
// cancelled -> return without further ado, esp no caching
|
||||
// of results as they will leak
|
||||
return undefined;
|
||||
}
|
||||
if (typeof this._provider.resolveDocumentLink !== 'function') {
|
||||
// no resolve -> no caching
|
||||
return { links: links.filter(LinkProviderAdapter._validateLink).map(typeConvert.DocumentLink.from) };
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
// cancelled -> return without further ado, esp no caching
|
||||
// of results as they will leak
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
// cache links for future resolving
|
||||
const pid = this._cache.add(links);
|
||||
const result: extHostProtocol.ILinksListDto = { links: [], id: pid };
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
|
||||
if (typeof this._provider.resolveDocumentLink !== 'function') {
|
||||
// no resolve -> no caching
|
||||
return { links: links.map(typeConvert.DocumentLink.from) };
|
||||
|
||||
} else {
|
||||
// cache links for future resolving
|
||||
const pid = this._cache.add(links);
|
||||
const result: extHostProtocol.ILinksListDto = { links: [], id: pid };
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
const dto: extHostProtocol.ILinkDto = typeConvert.DocumentLink.from(links[i]);
|
||||
dto.cacheId = [pid, i];
|
||||
result.links.push(dto);
|
||||
if (!LinkProviderAdapter._validateLink(links[i])) {
|
||||
continue;
|
||||
}
|
||||
return result;
|
||||
|
||||
const dto: extHostProtocol.ILinkDto = typeConvert.DocumentLink.from(links[i]);
|
||||
dto.cacheId = [pid, i];
|
||||
result.links.push(dto);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
resolveLink(id: extHostProtocol.ChainedCacheId, token: CancellationToken): Promise<extHostProtocol.ILinkDto | undefined> {
|
||||
private static _validateLink(link: vscode.DocumentLink): boolean {
|
||||
if (link.target && link.target.path.length > 50_000) {
|
||||
console.warn('DROPPING link because it is too long');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async resolveLink(id: extHostProtocol.ChainedCacheId, token: CancellationToken): Promise<extHostProtocol.ILinkDto | undefined> {
|
||||
if (typeof this._provider.resolveDocumentLink !== 'function') {
|
||||
return Promise.resolve(undefined);
|
||||
return undefined;
|
||||
}
|
||||
const item = this._cache.get(...id);
|
||||
if (!item) {
|
||||
return Promise.resolve(undefined);
|
||||
return undefined;
|
||||
}
|
||||
return asPromise(() => this._provider.resolveDocumentLink!(item, token)).then(value => {
|
||||
return value && typeConvert.DocumentLink.from(value) || undefined;
|
||||
});
|
||||
const link = await asPromise(() => this._provider.resolveDocumentLink!(item, token));
|
||||
if (!link || !LinkProviderAdapter._validateLink(link)) {
|
||||
return undefined;
|
||||
}
|
||||
return typeConvert.DocumentLink.from(link);
|
||||
}
|
||||
|
||||
releaseLinks(id: number): any {
|
||||
|
||||
@@ -236,7 +236,8 @@ const apiMenus: IAPIMenu[] = [
|
||||
key: 'editor/inlineCompletions/actions',
|
||||
id: MenuId.InlineCompletionsActions,
|
||||
description: localize('inlineCompletions.actions', "The actions shown when hovering on an inline completion"),
|
||||
supportsSubmenus: false
|
||||
supportsSubmenus: false,
|
||||
proposed: true
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
||||
}));
|
||||
const socketMap = getSockets(procSockets);
|
||||
|
||||
const procChildren = await pfs.readdir('/proc');
|
||||
const procChildren = await pfs.Promises.readdir('/proc');
|
||||
const processes: {
|
||||
pid: number, cwd: string, cmd: string
|
||||
}[] = [];
|
||||
|
||||
Reference in New Issue
Block a user