This is regarding the fix provided to the issue 1002. Thanks for implementing the request.
There are few cases that are not covered by the current implementation. Thought of bringing to your notice.
Scenario-1: Toggling between tex and non-tex files
explorer-view) persistslatex-viewlatex-viewScenario-2: closing a tex file
explorer-view) persistslatex-viewIt seems that there is no way for an extension to know which view is currently active, so persistent view switching seems not possible. Correct me if I am wrong.
Would it not be possible to revert to the default-view (which is usually the explorer-view)?
In any case, there are many scenarios within shifting between latex files itself that the outline view is breaking.
Scenario-3
non-latex-file. Here, the default side-bar view (explorer-view) persistslatex-file-1. the view shifts to latex-outline with the outline of latex-file-1. Make some edit to the file. ctrl+shift+e (or equivalent hotkey) to change the side-bar view to explorer. latex-file-2. The side-bar still shows explorer-view and does not shift to latex-outline. Scenario-4
scenario-3ctrl+atl+x to change the side-bar to get latex-outline. The latex-outline shows the outline for either of the latex files.non-latex-file, latex-file-1 and latex-file-2 .No, not possible as we never know which one is default. Suppose someone somehow started a debug session using some method I don't know, switching back to explorer view can be disturbing. This is a very common problem I came across when debugging python.
As to the logic, you may want to inspect the commit for code changes. What I want to emphasis is that the extension never know which view is currently active, and how the view is manually changed (clicking or hotkey) by the user. I admit that these scenarios can be frustrating, but the current vscode API does not support further customization.
I take your point for not presuming that the default view might be explorer.
In any case, there is related small thing I want to bring to your notice. Because of this implementation, when the latex-file is opened (either from explorer or command-pallette), the focus is on the side-bar and not on the opened file in the editor. Would it be possible to shift the focus back to the latex-file in the editor?
This seems to be a more significant problem to me, yet unfortunately again, I am not aware of solutions to handle this. I need to explore the API and see if it is possible. This seems to be more serious than previous problems.
Seems that workbench.action.focusLastEditorGroup might work. Need some testing.
Thinking loud here --- would be that all the above problems are happening (latex-view in the side-bar not updating) because the focus is not on the editor?
As I mentioned -- I am thinking loudly. I have no expertise or know-how of programming language in which this extension and vscode are written. Kindly excuse. Otherwise, would have helped you...
The focus problem is fixed.
Come back to the four scenarios, 1 and 2 are no-fixes due to the limit of api, though I'd love to implement them when possible. Scenario 4 is caused by the focusing problem, therefore should be resolved.
As to scenario 3, it is fixable yet arguable. Let's assume another use case. Suppose I have several tex files in the folder, and I want to inspect which one contains some content I'd find. I click file-1, then click explorer, click file-2, click explorer again, click file-3, boom. I would suppose the new logic can be problematic.
Thanks!
And I agree with your comment on scenario-3 and other scenarios. The logic of switching between views can become quite intricate and has to take lot of factors into account depending on the context and previous user actions. I can help you come up with use-cases (or some other ways of assisting) in case you want to look into these. Let me know.
Refocusing a tex file raises the latex-view pane. This has the annoying side effect of raising the latex-view when clicking in the pdf view and the .tex had focus before. If like me, you tend to keep the side bar hidden most of the time (especially with small screens), then using synctex puts the side bar into the way all the time.
I hadnt thought of this scenario.
However, would disabling this auto-switching by "latex-workshop.view.autoActivateLatex.enabled": false resolve your scenario?
OK setting "latex-workshop.view.autoActivateLatex.enabled": false fixes my issue.
Most helpful comment
OK setting
"latex-workshop.view.autoActivateLatex.enabled": falsefixes my issue.