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

Custom Editor API #3961

Merged
merged 9 commits into from
Jul 12, 2023
Merged

Custom Editor API #3961

merged 9 commits into from
Jul 12, 2023

Conversation

ManuelHentschel
Copy link
Contributor

Implements the changes discussed in #3951

I added a new viewmode instead of replacing the "singleton" mode, in case some users want to preserve the specific behavior of that mode, but of course that can be changed easily.

I had to add the option "latex-workshop.view.pdf.tab.viewColumn", since the current option "latex-workshop.view.pdf.tab.editorGroup" is not compatible with the editor-open API of vscode, and merging the two felt rather confusing.

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/viewer.ts Outdated Show resolved Hide resolved
src/components/viewer.ts Outdated Show resolved Hide resolved
src/components/viewerlib/pdfviewerhook.ts Outdated Show resolved Hide resolved
src/components/viewerlib/pdfviewerpanel.ts Outdated Show resolved Hide resolved
@James-Yu
Copy link
Owner

James-Yu commented Jul 9, 2023

Can you take a look at 8c3df83 and see if things work as you intended?

@ManuelHentschel
Copy link
Contributor Author

Can you take a look at 8c3df83 and see if things work as you intended?

With this change, the command latex-workshop.tab opens the (non-custom-editor) viewer, even if otherwise the custom editor API is specified in the settings. In line with your earlier comment, I think it would make sense to adjust the behavior of this command to choose the correct internal viewer. This is why I used the 'internal' option in some places. To avoid that we can also put more logic into main.ts if you prefer that over using "internal".

Also, omitting the default value in Viewer.open also causes the command latex-workshop.view to stop working.

@James-Yu
Copy link
Owner

James-Yu commented Jul 9, 2023

I suppose f8c7c3a fixes both?

@ManuelHentschel
Copy link
Contributor Author

I suppose f8c7c3a fixes both?

The latest version seems to work as intended

@James-Yu
Copy link
Owner

Before merge, please add related tests. A minimum one is to try setting the config and view and see if a viewer is fired. You may refer to other tests for the implementation. I do encourage to add more as you may think of (I am not quite sufficient in thinking of different test cases.)

@ManuelHentschel

This comment was marked as resolved.

@James-Yu James-Yu merged commit 21cf620 into James-Yu:master Jul 12, 2023
6 checks passed
@James-Yu
Copy link
Owner

Thanks for your contribution!

@ManuelHentschel ManuelHentschel deleted the customEditor2 branch July 13, 2023 18:01
@James-Yu
Copy link
Owner

It seems that the custom editors can be duplicated by the "splitting" button, which I think is acceptable. Therefore, I'd propose to switch the options of view.mode to

  • tab uses custom editor
  • singleton uses old logic (primary unchanged), marked with "deprecated"
  • Remove customEditor
  • Add legacy, which uses old logic

What do you think? @ManuelHentschel

@ManuelHentschel
Copy link
Contributor Author

It seems that the custom editors can be duplicated by the "splitting" button, which I think is acceptable. Therefore, I'd propose to switch the options of view.mode to

* `tab` uses custom editor

* `singleton` uses old logic (primary unchanged), marked with "deprecated"

* Remove `customEditor`

* Add `legacy`, which uses old logic

What do you think? @ManuelHentschel

Sounds good to me!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
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.

2 participants