comment out checkProposedApiEnabled(extension, 'editorInsets');

This commit is contained in:
Andrew 2024-10-22 22:59:09 -07:00
parent 69277a287a
commit f2b3a2be30
4 changed files with 31 additions and 3 deletions

View file

@ -5,7 +5,7 @@
"description": "",
"version": "0.0.1",
"engines": {
"vscode": "^1.89.0"
"vscode": "^1.92.0"
},
"categories": [
"Other"

View file

@ -4,6 +4,23 @@ import { BaseDiffArea, ChatThreads, MessageFromSidebar, MessageToSidebar } from
import { SidebarWebviewProvider } from './SidebarWebviewProvider';
import { v4 as uuidv4 } from 'uuid'
// this comes from vscode.proposed.editorInsets.d.ts
declare module 'vscode' {
export interface WebviewEditorInset {
readonly editor: vscode.TextEditor;
readonly line: number;
readonly height: number;
readonly webview: vscode.Webview;
readonly onDidDispose: Event<void>;
dispose(): void;
}
export namespace window {
export function createWebviewTextEditorInset(editor: vscode.TextEditor, line: number, height: number, options?: vscode.WebviewOptions): WebviewEditorInset;
}
}
const readFileContentOfUri = async (uri: vscode.Uri) => {
return Buffer.from(await vscode.workspace.fs.readFile(uri)).toString('utf8')
.replace(/\r\n/g, '\n') // replace windows \r\n with \n
@ -21,12 +38,23 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.registerWebviewViewProvider(SidebarWebviewProvider.viewId, sidebarWebviewProvider, { webviewOptions: { retainContextWhenHidden: true } })
);
// 2. ctrl+l
context.subscriptions.push(
vscode.commands.registerCommand('void.ctrl+l', () => {
const editor = vscode.window.activeTextEditor
if (!editor) return
const inset = vscode.window.createWebviewTextEditorInset(editor, 10, 200, {})
inset.webview.html = `
<html>
<body>Hello World!</body>
</html>
`;
// show the sidebar
vscode.commands.executeCommand('workbench.view.extension.voidViewContainer');
// vscode.commands.executeCommand('vscode.moveViewToPanel', CustomViewProvider.viewId); // move to aux bar
@ -115,6 +143,7 @@ export function activate(context: vscode.ExtensionContext) {
return
}
// create an area to show diffs
const diffArea: BaseDiffArea = {
startLine: 0, // in ctrl+L the start and end lines are the full document

View file

@ -823,7 +823,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostWebviewPanels.createWebviewPanel(extension, viewType, title, showOptions, options);
},
createWebviewTextEditorInset(editor: vscode.TextEditor, line: number, height: number, options?: vscode.WebviewOptions): vscode.WebviewEditorInset {
checkProposedApiEnabled(extension, 'editorInsets');
// checkProposedApiEnabled(extension, 'editorInsets'); // Void commented this out
return extHostEditorInsets.createWebviewEditorInset(editor, line, height, options, extension);
},
createTerminal(nameOrOptions?: vscode.TerminalOptions | vscode.ExtensionTerminalOptions | string, shellPath?: string, shellArgs?: readonly string[] | string): vscode.Terminal {

View file

@ -9479,7 +9479,6 @@ declare module 'vscode' {
*/
readonly extensionHostPort: number;
}
/**
* Content settings for a webview.
*/