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

Improve vscode tab API #13730

Merged
merged 8 commits into from
May 30, 2024
Merged

Improve vscode tab API #13730

merged 8 commits into from
May 30, 2024

Conversation

jonah-iden
Copy link
Contributor

@jonah-iden jonah-iden commented May 24, 2024

What it does

This improves and fixes some things for the vscode tab api.

  • Now there should always be a default tabGroup open, even when no tabs are open
  • Implements the viewCollumn property
  • Smaller fix for tab events being fired even though there was no change

How to test

Here is a small test extension.
This shows message and logs into the console the different tabApi events.

Follow-ups

Review checklist

Reminder for reviewers

Signed-off-by: Jonah Iden <[email protected]>
@jonah-iden jonah-iden requested a review from tsmaeder May 24, 2024 12:04
Signed-off-by: Jonah Iden <[email protected]>
@tsmaeder
Copy link
Contributor

@jonah-iden do we have a list of issues this PR fixes?

@jonah-iden
Copy link
Contributor Author

I think its just the List above with these three points. Are you still seeing Problems or discrepancies somewhere?

@jonah-iden
Copy link
Contributor Author

It can easily be that i overlooked problems. Its sadly super hard to align this perfectly to vscode because phosphor is just doing things differently to vscodes layouting. Like events just happening in different order

@tsmaeder
Copy link
Contributor

#12702
#13674

Also, we should try to remove the workaround in the tests I introduced for the 1.88.1 built-ins. #13679 (comment)

@tsmaeder
Copy link
Contributor

Removing the workaround for #13679 makes the tests fail again. Seems that one at least is still there.

@msujew msujew changed the title Improved vsocde tabApi Improve vscode tab API May 27, 2024
@msujew msujew requested a review from tsmaeder May 27, 2024 10:59
@msujew msujew added the vscode issues related to VSCode compatibility label May 27, 2024
Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, looks good to me.

@@ -103,7 +103,6 @@ describe('TypeScript', function () {
const editorWidget = widget instanceof EditorWidget ? widget : undefined;
const editor = MonacoEditor.get(editorWidget);
assert.isDefined(editor);
await timeout(1000); // workaround for https://github.com/eclipse-theia/theia/issues/13679
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the workaround: the workaround is not waiting for the context key typescrip.isManagedFile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I need the 1 second timeout for the tests to run reliably, locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typescript.isManagedFile context key is working unreliably. When opening a TypeScript file in the editor and querying the context key value, I always get false, even though a TypeScript editor is open (and focused).

I've reinstated the 1 second timeout, as the issue seems to be unrelated to the tab API.

@msujew
Copy link
Member

msujew commented May 29, 2024

@tsmaeder FYI the latest commit fixes an error in the plugin host that appeared due to an off-by-one error. Note that the typescript.isManagedFile context key seems to work unreliably and cannot be used to check whether the TypeScript language services are available (or not). See also #13730 (comment). This could be potentially fixed in a separate PR. However it fixes the initial issue that causes #13674, to this PR should be good to go.

@tsmaeder
Copy link
Contributor

@msujew we should keep the issue reference, since adding the one second timeout is necessary as long as setting the context does not work reliably. Otherwise, this PR looks fine as far as it goes. Unfortunately, typescript-language-features has started to rely extensively on getting the correct active tab and tab group, so I think getting the behavior aligned with VS Code is kinda non-optional, eventually.

@msujew
Copy link
Member

msujew commented May 30, 2024

FYI I believe I've mostly fixed #13679, it's just a minor issue left: The onDidChangeActiveTextEditor event is fired on the plugin host before the tab API has been updated on the plugin host (due to the order of events in the frontend). However, I couldn't find a quick way to fix this without breaking a bunch of other stuff, so I'm putting this off for a separate PR.

The original off-by-one issue mentioned in the issue is fixed, it's just a matter of correctly ordering the events.

@msujew msujew requested a review from tsmaeder May 30, 2024 11:14
@msujew msujew merged commit a17c637 into master May 30, 2024
13 of 14 checks passed
@msujew msujew deleted the jiden/improve-tabApi branch May 30, 2024 12:19
@github-actions github-actions bot added this to the 1.50.0 milestone May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants