Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead
https://Enter-tainer.github.io/typst-preview/
MIT License
444 stars 21 forks source link

Wrong position in two-row layout #270

Closed lvjr closed 8 months ago

lvjr commented 8 months ago

Describe the bug

It seems typst-preview doesn't check current layout and always opens preview on the right side of the window.

To Reproduce Steps to reproduce the behavior (Library test):

  1. Select vscode menu item "View->Editor Layout->Two Rows".
  2. Click the typst-preview button.

Expected behavior The preview should appear on the bottom of the window. But it always appears on the right.

Package/Software version:

VSCode version(Help -> About):

Version: 1.87.2 (user setup)
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:20:17.278Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.19045

typst-preview extension version: v0.10.10

Enter-tainer commented 8 months ago

We use viewcolumn.beside https://github.com/Enter-tainer/typst-preview/blob/main/addons/vscode/src/extension.ts#L449

VSCode api provide other types but they don't look interesting. I think maybe it vscode's limitation? Is there any extension that opens a new window can correctly position itself? I can take a look at its code find out how to do this.

lvjr commented 8 months ago

When I use latex-workshop extension to typeset latex documents, the position of the preview is correct in two-row layout.

Enter-tainer commented 8 months ago

ty, i will look into that

Enter-tainer commented 8 months ago

https://github.com/James-Yu/LaTeX-Workshop/blob/28892b878acc7c2c839b986f1065f13cdf485ed2/src/preview/viewer.ts#L146 related code