Skip to content

Commit

Permalink
[ fix #197 ] When reopening a folder, the panel created by Agda-mode …
Browse files Browse the repository at this point in the history
…is restored as an empty window #197
  • Loading branch information
banacorn committed Nov 28, 2024
1 parent 89d98f9 commit 188e731
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 16 deletions.
34 changes: 33 additions & 1 deletion lib/js/src/View/WebviewPanel.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions src/View/WebviewPanel.res
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ module WebviewPanel: {
let reveal: t => unit

// move the panel around
let getEditorLayout: unit => promise<Obj.t>
let moveToBottom: unit => unit
// let moveToLeft: unit => unit
let moveToRight: unit => unit
} = {
type t = VSCode.WebviewPanel.t

Expand Down Expand Up @@ -129,19 +130,6 @@ module WebviewPanel: {

let reveal = panel => panel->VSCode.WebviewPanel.reveal(~preserveFocus=true)

// let moveToLeft = () => {
// open VSCode.Commands
// executeCommand(
// #setEditorLayout({
// orientation: 0,
// groups: {
// open Layout
// [sized({groups: [simple], size: 0.5}), sized({groups: [simple], size: 0.5})]
// },
// }),
// )->ignore
// }

let moveToBottom = () => {
open VSCode.Commands
executeCommand(
Expand All @@ -159,6 +147,20 @@ module WebviewPanel: {
),
)->ignore
}

let moveToRight = () => {
open VSCode.Commands
executeCommand(
#setEditorLayout(
%raw(`{
orientation: 0,
groups: [ {size: 0.5}, {size: 0.5} ]
}`),
),
)->ignore
}

let getEditorLayout = async () => await VSCode.Commands.executeCommand0("vscode.getEditorLayout")
}

// a thin layer on top of WebviewPanel
Expand Down Expand Up @@ -255,7 +257,7 @@ module Module: Module = {
// Move the created panel to the bottom row
switch Config.View.getPanelMountingPosition() {
| Bottom => WebviewPanel.moveToBottom()
| Right => ()
| Right => WebviewPanel.moveToRight()
}

// on message
Expand Down

0 comments on commit 188e731

Please sign in to comment.