mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
move rest code code inset to workbench out of (monaco) editor
This commit is contained in:
@@ -45,6 +45,7 @@ import { IMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IRemoteConsoleLog } from 'vs/base/node/console';
|
||||
import * as codeInset from 'vs/workbench/parts/codeinset/codeInset';
|
||||
|
||||
export interface IEnvironment {
|
||||
isExtensionDevelopmentDebug: boolean;
|
||||
@@ -905,7 +906,7 @@ export interface CodeLensDto extends ObjectIdentifier {
|
||||
command?: CommandDto;
|
||||
}
|
||||
|
||||
export type CodeInsetDto = ObjectIdentifier & modes.ICodeInsetSymbol;
|
||||
export type CodeInsetDto = ObjectIdentifier & codeInset.ICodeInsetSymbol;
|
||||
|
||||
export interface ExtHostLanguageFeaturesShape {
|
||||
$provideDocumentSymbols(handle: number, resource: UriComponents, token: CancellationToken): Promise<modes.DocumentSymbol[] | undefined>;
|
||||
|
||||
@@ -18,6 +18,7 @@ import { CustomCodeAction } from 'vs/workbench/api/node/extHostLanguageFeatures'
|
||||
import { ICommandsExecutor, PreviewHTMLAPICommand, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import * as codeInset from 'vs/workbench/parts/codeinset/codeInset';
|
||||
|
||||
export class ExtHostApiCommands {
|
||||
|
||||
@@ -523,7 +524,7 @@ export class ExtHostApiCommands {
|
||||
|
||||
private _executeCodeInsetProvider(resource: URI): Thenable<vscode.CodeInset[]> {
|
||||
const args = { resource };
|
||||
return this._commands.executeCommand<modes.ICodeInsetSymbol[]>('_executeCodeInsetProvider', args)
|
||||
return this._commands.executeCommand<codeInset.ICodeInsetSymbol[]>('_executeCodeInsetProvider', args)
|
||||
.then(tryMapWith(item =>
|
||||
new types.CodeInset(
|
||||
typeConverters.Range.to(item.range))));
|
||||
|
||||
@@ -27,6 +27,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtHostWebview } from 'vs/workbench/api/node/extHostWebview';
|
||||
import * as codeInset from 'vs/workbench/parts/codeinset/codeInset';
|
||||
|
||||
// --- adapter
|
||||
|
||||
@@ -153,7 +154,7 @@ class CodeInsetAdapter {
|
||||
private readonly _provider: vscode.CodeInsetProvider
|
||||
) { }
|
||||
|
||||
provideCodeInsets(resource: URI, token: CancellationToken): Promise<modes.ICodeInsetSymbol[]> {
|
||||
provideCodeInsets(resource: URI, token: CancellationToken): Promise<codeInset.ICodeInsetSymbol[]> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
return asPromise(() => this._provider.provideCodeInsets(doc, token)).then(insets => {
|
||||
if (Array.isArray(insets)) {
|
||||
@@ -170,7 +171,7 @@ class CodeInsetAdapter {
|
||||
});
|
||||
}
|
||||
|
||||
resolveCodeInset(symbol: modes.ICodeInsetSymbol, webview: vscode.Webview, token: CancellationToken): Promise<modes.ICodeInsetSymbol> {
|
||||
resolveCodeInset(symbol: codeInset.ICodeInsetSymbol, webview: vscode.Webview, token: CancellationToken): Promise<codeInset.ICodeInsetSymbol> {
|
||||
|
||||
const inset = this._heapService.get<vscode.CodeInset>(ObjectIdentifier.of(symbol));
|
||||
if (!inset) {
|
||||
@@ -1151,11 +1152,11 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
|
||||
return result;
|
||||
}
|
||||
|
||||
$provideCodeInsets(handle: number, resource: UriComponents, token: CancellationToken): Promise<modes.ICodeInsetSymbol[]> {
|
||||
$provideCodeInsets(handle: number, resource: UriComponents, token: CancellationToken): Promise<codeInset.ICodeInsetSymbol[]> {
|
||||
return this._withAdapter(handle, CodeInsetAdapter, adapter => adapter.provideCodeInsets(URI.revive(resource), token));
|
||||
}
|
||||
|
||||
$resolveCodeInset(handle: number, resource: UriComponents, symbol: modes.ICodeInsetSymbol, token: CancellationToken): Promise<modes.ICodeInsetSymbol> {
|
||||
$resolveCodeInset(handle: number, resource: UriComponents, symbol: codeInset.ICodeInsetSymbol, token: CancellationToken): Promise<codeInset.ICodeInsetSymbol> {
|
||||
const webview = new ExtHostWebview(symbol.webviewHandle, this._webviewProxy, { enableScripts: true });
|
||||
webview.html = '<html><body></body></html>';
|
||||
const x = this._withAdapter(handle, CodeInsetAdapter, adapter => adapter.resolveCodeInset(symbol, webview, token));
|
||||
|
||||
Reference in New Issue
Block a user