Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use customEditor api #3069

Closed
wants to merge 1 commit into from
Closed

Conversation

ManuelHentschel
Copy link
Contributor

This PR modifies the methods openPdfInTab etc. to open pdfs using vscode's CustomEditor api. Previously, this api was only used to show 'LaTeX Workshop PDF Viewer is opening a PDF file...' and then opening a separately managed webview. Advantages of showing pdfs as custom editors include:

  • Avoids opening the same pdf multiple times (though this is still possible if intended)
  • Does not steal focus from the explorer view after opening a pdf. This can get a bit annoying when trying to e.g. click on a pdf file and then del to delete it.
  • Pdf icon in the file tab is supported

I've tested this on windows 10 and ubuntu 18.04 using WSL. The only disadvantage I'm aware of is

  • It is no longer possible to specify 'left'/'top'/'bottom' as locations for the panel. However, when opening a file from the explorer view this can be done using e.g. open to the side.

@tamuratak
Copy link
Contributor

Rejected. Not convinced.

Avoids opening the same pdf multiple times

The feature of opening the same pdf multiple times is what we want.

@tamuratak tamuratak closed this Jan 30, 2022
Repository owner locked as resolved and limited conversation to collaborators Jan 30, 2022
@tamuratak
Copy link
Contributor

tamuratak commented Jan 30, 2022

See

Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.

"workbench.list.openMode": "singleClick",

Repository owner unlocked this conversation Jun 22, 2022
@James-Yu
Copy link
Owner

James-Yu commented Jun 22, 2022

It is no longer possible to specify 'left'/'top'/'bottom' as locations for the panel. However, when opening a file from the explorer view this can be done using e.g. open to the side.

This degeneration is unfortunately not acceptable w.r.t. LW in my opinion. A neat feature to LaTeX users is to single click on the view PDF icon to the top right (when focusing a .tex file) and see the pdf opened at the correct location, defined in the configuration. Is there a workaround to retain this feature while using the customEditor API? @ManuelHentschel

@ManuelHentschel
Copy link
Contributor Author

It is no longer possible to specify 'left'/'top'/'bottom' as locations for the panel. However, when opening a file from the explorer view this can be done using e.g. open to the side.

This degeneration is unfortunately not acceptable w.r.t. LW in my opinion. A neat feature to LaTeX users is to single click on the view PDF icon to the top right (when focusing a .tex file) and see the pdf opened at the correct location, defined in the configuration. Is there a workaround to retain this feature while using the customEditor API? @ManuelHentschel

Agree. I re-implemented the different opening locations on the master branch of my fork https://github.com/ManuelHentschel/LaTeX-Workshop. Unfortunately, the vscode api does not fully support opening (non-text?) documents in most of the locations that can be specified in the LW settings (and also not without taking focus), but the procedure currently used here also works when using the custom editor api.

Since I originally opened this PR, lots of things have changed, leading to lots of merge conflicts, so I did not update this branch. However, let me know if you want me to open a new PR with this modification. Also, feel free to point out/fix any problems due to my unfamiliarity with the code base.

Repository owner locked as resolved and limited conversation to collaborators Jun 23, 2022
Repository owner unlocked this conversation Jun 24, 2022
Repository owner locked and limited conversation to collaborators Jun 24, 2022
@James-Yu
Copy link
Owner

Since I originally opened this PR, lots of things have changed, leading to lots of merge conflicts, so I did not update this branch. However, let me know if you want me to open a new PR with this modification. Also, feel free to point out/fix any problems due to my unfamiliarity with the code base.

Welcome a new PR/PRs! Thanks 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants