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

GH-6428: Refactored the built-in monaco commands. #7481

Merged
merged 2 commits into from
Apr 6, 2020
Merged

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Apr 1, 2020

Signed-off-by: Akos Kitta [email protected]

What it does

Changes the way how we handle monaco commands, and hopefully providers a better UX for the Undo, Redo, and Select All commands. It is the fix for electron, as it

How to test

Test Plan:

  • Preconditions:
  • Steps:
    • Type foo and press Ctrl/⌘+A (Select All). Assert: the input value is foo and is selected.
    • Press Del. Assert: the input is empty.
    • Press Ctrl/⌘+Z (Undo). Assert: the input value is foo and is selected.
    • Press Ctrl/⌘+Shift+Z (Redo). Assert: the input is empty.
    • Type bar and select the Selection > Select All menu item. Assert: the input value is bar and is selected.
    • Press Del. Assert: the input is empty.
    • Select the Edit > Undo menu item. Assert: the input is bar and is selected. (Note: there is a bug here. The SIW widget's input does not listen on value change and does not re-run the query.)
    • Select the Edit > Redo menu item. Assert: the input is empty.

  • Preconditions:
    • If you are verify this in electron, you have to be avere of the non-dynamic nature of the application menu. ([electron][menu] Selection menu is missing from the electron app #6425).
    • Open theia as a workspace in Theia.
    • Run Reset Workbench Layout.
    • Open the SIW widget; the input widget has the focus, type baz.
    • Open the os.ts module via the Command Palette. If it is opened in a preview mode, make sure the editor has the focus; the cursor blinks inside the editor.
  • Steps:
    • Type foo somewhere in the editor and press Ctrl/⌘+Z (Undo). Assert: foo is not there.
    • Press Ctrl/⌘+Shift+Z (Redo). Assert: foo is there.
    • Press Ctrl/⌘+Z (Undo). Assert: foo is not there.
    • Press Ctrl/⌘+A (Select All). Assert: the editor content is selected.
    • Press Esc. Assert: the cursor blinks at the end of the file, nothing is selected.
    • Type bar and select the Edit > Undo menu item. Assert: bar is not there.
    • Select the Edit > Redo menu item. Assert: bar is in the editor.
    • Set the focus (single-click) into the SIW's input.
    • Press Ctrl/⌘+A (Select All). Assert: baz is selected.
    • Make sure the cursor blinks once again in the editor and select the Selection > Select All menu item. Assert: the editor content is selected.
    • Press Esc. Assert: the cursor blinks at the end of the file, nothing is selected.
    • Right-click on isWindows in the editor and select Peek > Peek References from the context menu. Assert: embedded editor is open. The cursor blinks on isWindows in the main editor.
    • Press Ctrl/⌘+A (Select All). Assert: the main editor content is selected.
    • Make sure the cursor blinks this time in the embedded editor and press Ctrl/⌘+A (Select All). Assert: the embbedded editor content is selected. (Fixes [monaco] Select all does not work in inline, embedded editors #7483)

🎖Let's verify other issues:


TODOs:

  • Verify this. From time to time, I can see the Commiting pending changes before change accessor leaves due to read access. warning when running the electron example. Hmm, but the logger code was removed by the VS Code guys in January. Let's double-check it. Verified ✅ (microsoft/vscode@6beb757)

Review checklist

Reminder for reviewers

@akosyakov, @RomanNikitenko, here is an early preview of my changes. I am going to verify the behavior locally and write down the verification steps. Please take a look at my changes. Thank you!

@akosyakov akosyakov added electron issues related to the electron target keybindings issues related to keybindings monaco issues related to monaco labels Apr 2, 2020
@akosyakov akosyakov requested a review from RomanNikitenko April 2, 2020 07:01
@akosyakov
Copy link
Member

@marechal-p Could you help with testing please too?

@kittaakos kittaakos force-pushed the core-commands branch 2 times, most recently from 97fbb9a to f48ba38 Compare April 2, 2020 08:28
@kittaakos kittaakos marked this pull request as ready for review April 2, 2020 08:30
@kittaakos kittaakos force-pushed the core-commands branch 5 times, most recently from 83be302 to 95a99dc Compare April 2, 2020 12:11
@kittaakos
Copy link
Contributor Author

I did my best to address all remarks, the PR is ready for the review. @RomanNikitenko, @marechal-p can you please help with the verification? Thank you! 🙏

@RomanNikitenko
Copy link
Contributor

@kittaakos
I can start to test the changes for browser.
Does it make sense?

or according to

It is the fix for electron

it's expected to test the changes for electron only

@kittaakos
Copy link
Contributor Author

I can start to test the changes for browser.
Does it make sense?

Yes. Always 😊

it's expected to test the changes for electron only

Just go for the browser now.

@RomanNikitenko
Copy link
Contributor

Sorry for misleading you, I have a meeting, can start testing in ~2 hours...

Copy link
Contributor

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

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

@kittaakos
I'm testing browser side at the moment.

Looks like, for step:

Type bar and select the Selection > Select All menu item. Assert: the input value is bar and is selected.

I have the different behavior from VS Code:

refactored_select_all

So, it does nothing.
But it works from context menu.

For master I have another behavior, but is different from VS Code as well:

master_selection

So it selects editor content, I think because:

  • the command is executed using this method
    and
  • editor.focus() is present in master branch

Please let me know if my testing steps are wrong.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

@kittaakos This PR is awesome! It is going to solve so many issues.

@RomanNikitenko
Copy link
Contributor

@kittaakos
I'm testing the changes for browser.

About:

  • Right-click on isWindows in the editor and select Peek > Peek References from the context menu. Assert: embedded editor is open. The cursor blinks on isWindows in the main editor.
  • Press Ctrl/⌘+A (Select All). Assert: the main editor content is selected.

I'm not sure where the cursor is at this step
You can see the behavior here:

Selection_peek

But I can apply Select All action for any area at this step, it fixes the master branch behavior and I have the same behavior for VS Code, so it looks good to me.

@kittaakos
Copy link
Contributor Author

  • t: embedded editor is open. The cursor blinks on isWindows in the main editor.

Well, your cursor does not blink in the main editor, at least I cannot see it.

@RomanNikitenko
Copy link
Contributor

@kittaakos
Regarding

Close all editors and press Ctrl/⌘+F. Assert: no errors because of the missing handler for core.find command. (Fixes #7474)

Looks like it's not fixed for me for browser side:

find_bug

@kittaakos
Copy link
Contributor Author

I'm not sure where the cursor is at this step

You can clearly see when you open the embedded editor, the selection is on the right-hand side, the selected item is blueish:

Screen Shot 2020-04-06 at 11 50 03

@kittaakos
Copy link
Contributor Author

Looks like it's not fixed for me for browser side:

👍 Thanks for finding it. Checking...

@kittaakos
Copy link
Contributor Author

Regarding

Close all editors and press Ctrl/⌘+F. Assert: no errors because of the missing handler for core.find command. (Fixes #7474)

Looks like it's not fixed for me for browser side:

Very useful findings. The following commands do not have a when clause.

root INFO actions.findWithSelection when null
logger-protocol.ts:112 root INFO actions.find when null

VS Code refs:

@kittaakos
Copy link
Contributor Author

Looks like it's not fixed for me for browser side:

Fixed now. It delegates to the browser's Find functionality, if there is no opened editor.

@RomanNikitenko
Copy link
Contributor

Fixed now.

Testing...

Copy link
Contributor

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

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

I tested for browser side.

Faced with the issue related to Ctrl+z withing testing the changes

undo_error

Checked that master has the same problem, so it's not a regression.

I still can see Commiting pending changes before change accessor leaves due to read access.:

Comitting_pending

I can confirm that:

  • first two sets from the Test Plan work well for me
  • Find Next (Enter) and Find Previous (Shift +Enter) are fixed - thanks!
  • the problem was fixed - now It delegates to the browser's Find functionality

@kittaakos
Copy link
Contributor Author

I still can see Commiting pending changes before change accessor leaves due to read access.:

We are not yet using that version. microsoft/vscode@6beb757
By the way, it happens with you open and close the Find widget in the editor.

Faced with the issue related to Ctrl+z withing testing the changes

Let me check this one too. Ohh, sorry 😕

@kittaakos
Copy link
Contributor Author

Faced with the issue related to Ctrl+z withing testing the changes

@RomanNikitenko, did you see this when undoing in the editor? #7486

@RomanNikitenko
Copy link
Contributor

@kittaakos
I think yes:
errors_typescript

@kittaakos
Copy link
Contributor Author

I leave this open till the end of the day if anyone wants to object. Thank you for the review @akosyakov and for the multiple verifications @RomanNikitenko 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target keybindings issues related to keybindings monaco issues related to monaco
Projects
None yet
4 participants