webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO
https://webdriverio-community.github.io/wdio-vscode-service/
MIT License
29 stars 23 forks source link

`selectText()` on TextEditor select wrong text when tabs are used for indention #96

Open openscript opened 8 months ago

openscript commented 8 months ago

If tabs are used in a file, where selectText() is executed, the cursor will stop before the text, which should be selected. The reason for this, could be that columns and coordinates don't correspond in VSCode:

https://github.com/webdriverio-community/wdio-vscode-service/blob/88c7a47d041b126e84ae1703d04bc13d7648e4bf/src/pageobjects/editor/TextEditor.ts#L344C44-L344C50

If the tab size is two moving one tab to the right increases the column count by two.

christian-bromann commented 8 months ago

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

openscript commented 8 months ago

@christian-bromann I'm happy to fix this, but what would be the right way to do it?

I've been thinking if we can just read each character at the cursor and compare it to the to be selected text until it matches?

seanpoulter commented 4 months ago

I don't think we know the right way to solve this @openscript. What are our options? You've already suggested one. I can think of another option to increment by the size of a tab if we find one. We should be able to check the TextEditorOptions.

I'm also curious what test cases we'd want to cover. I'm fairly confidence searching for whitespace at the end of a sentence won't work as expected due to a .trim(). :thinking: