-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
workspace.openTextDocument opens second editor window #25801
Comments
this is a regression from b5340db#diff-5c241ba7b54b0818cea62f7130c9082d |
@kburtram trying to understand your scenario here: it is actually normal behaviour of code to open documents in the column that is currently active. if people do not like that, we have a setting In any case, I think the fix here does not make sense: if I am in column 2 and I open a document in column 3 and now |
@bpasero it's been a little, but as I recall, there was a change in vscode behavior in a particular insiders build regarding openTextDocument behavior. At a high-level I can describe our use-case. We open a preview window for query results that is associated to a particular SQL text editor window. In the preview window there is an HTML link that we use to select text in the SQL text editor and bring the text editor into focus. Currently we use openTextDocument to bring the existing text editor into focus. In the insiders build related to this issue, the behavior of openTextDocument changed to no longer bring the existing editor into focus, but opened a new duplicate editor window in the same column as the preview window (which we explicitly try to open in a different column then the text window unless the user manually repositions the documents). It was the duplicate editor that was the core issue, not really the which column the document was opened in. Basically, we want a way to either reveal the existing SQL text window associated with a particular preview window if it is already open, or to open a new SQL text window for the particular file if the editor has been closed. Preferably the SQL text window would open in a different column then the preview window. This was the behavior we were getting from our usage of openTextDocument prior to this issue and the fix restored that behavior. We can update the extension if there is a better way to accomplish this goal, but having two SQL editor windows open when clicking on the link in the preview window didn't really provide a good experience for the user. Please let me know if you need more details on our scenario or API usage. |
@kevcunnane please watch this issue in case there are any API changes we need to react to. |
@kburtram thanks for the explanation, I do not think we would change existing behaviour. But for some extensions the desire is to open an editor in the currently active view column, so we might have new API to get there. |
@bpasero from the discussion this change sounds fine. I'll test the mssql extension with the latest insiders build this weekend and get back to you. |
Steps to Reproduce:
workspace.openTextDocument
with URI from file from step 1Expected: Focus is returned to existing open file from step 1
Actual: A new editor instance is opened in the split window pane from step 2. Net results is two editor windows open with same URI. One editor in each of the split pane windows. This is a change in the openTextDocument behavior in the insiders build.
Additional note: This is impacting the mssql for VS Code extension which has a link in the query results window that refocuses to the correct lines in the SQL file. Instead of refocusing to the existing SQL editor, now a new editor window is opened.
The text was updated successfully, but these errors were encountered: