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

Cursor moved during typing #396

Closed
guoh27 opened this issue Feb 14, 2025 · 10 comments
Closed

Cursor moved during typing #396

guoh27 opened this issue Feb 14, 2025 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@guoh27
Copy link

guoh27 commented Feb 14, 2025

Describe the bug
Cursor moved during typing

To Reproduce
Steps to reproduce the behavior:

  1. Go to .bb recipe text.
  2. Typing something
  3. Cursor was moved

Desktop (please complete the following information):

  • OS: Windows
  • VS Code version 1.97.2
  • Extension version 2.8.0
  • Yocto Version 4.0
  • Other affected software version when applicable (CMake, SSH, kas, ...)
@guoh27 guoh27 added the bug Something isn't working label Feb 14, 2025
@deribaucourt deribaucourt added the question Further information is requested label Feb 14, 2025
@deribaucourt
Copy link
Member

Hello, thank you for your feedback!

I couldn't reproduce a jumpy cursor when editing a .bb. Maybe it only appears in specific conditions?
Could you provide a screen recording of the bug happening, along with an affected .bb file?
Do you think this only happens on specific sections of the text file?

@jrmejiaa
Copy link

I have the same behavior since the last update. For me it happens when I was trying to change something from a python task.

@deribaucourt
Copy link
Member

deribaucourt commented Feb 14, 2025

Indeed I was able to reproduce this, but it's not systematic.

  1. open file poky/meta/classes/baremetal-image.bbclass
  2. Save it and run a recipe scan (global env)
  3. Type something at the end of the file
  4. Type something in do_rootfs()
  5. Click quickly everywhere and type around the file
  6. The cursor may jump to a previous location (the same several times)

We'll investigate this further. May be due to a new way vscode handles tab transitions, or some of the companion extensions (bash-ide, python, shellcheck). bash-ide has not been updated recently, so that's not the issue. Disabling shellcheck slightly improves responsiveness but the bug is still present. So it's likely within our tab management that broke. Downgrading this extension to 2.7 did not solve the issue. I reproduced the same with code v1.92.2 which is 6 months dated. I'd say it's a random issue that we may have had for some time apparently. We should bring up the debugger and see if it's linked to bash or python specifically. It looks like we remember a cursor position and a race condition replays an event to teleport there even though its outdated and we forgot to clean it up.

TEMPORARY WORKAROUND (Outdated, a better one is presented bellow)

I was able to figure it is linked to our "embedded languages files feature". As a workaround, you can disable this feature through the setting bitbake.disableEmbeddedLanguagesFiles. You'll lose some features within the bash/python sections like go to definition and error highlights.

@deribaucourt deribaucourt removed the question Further information is requested label Feb 14, 2025
@guoh27
Copy link
Author

guoh27 commented Feb 15, 2025

Recording_1.mp4

Any text of bitbake edit could happened

@deribaucourt
Copy link
Member

deribaucourt commented Feb 17, 2025

Yes, with additional testing, it also requires to parse the file once.
Using breakpoints, happens at updateEmbeddedLanguageDocFile await document.save()

@struers-cge
Copy link

struers-cge commented Feb 17, 2025

I'm having the exact same issue. Cursor jumps randomly on typing/pasting/new-line. Disabling the extension removes the issue.

@deribaucourt
Copy link
Member

deribaucourt commented Feb 17, 2025

I found an interference with another extension: EditorConfig.EditorConfig since v1.17.0.
Depending on the .editorconfig (or default settings), it may try to override settings like "files.trimTrailingWhitespace": false which we need to enforce to translate between the .bb and .sh/.py background files.

Disable the EditorConfig extension or Downgrade it to 1.16.7

For now, you can disable that extension and implement the file formatting parameters through the VSCode settings. Further investigation will be needed to make this extension and the EditorConfig compatible by cross-debugging both code bases.

Thanks @idillon-sfl for testing on your side

@deribaucourt deribaucourt self-assigned this Feb 17, 2025
@deribaucourt
Copy link
Member

deribaucourt commented Feb 17, 2025

Probably linked to:

For our embedded languages features, we apply vscode edits behind the scene in temporary background tabs that we edit/save/close. The way the editorconfig extension also tries to apply edit when we save those background files is likely mixing cursor positions.

Apparently EditorConfig extension v1.17 broke other tools like:

@deribaucourt
Copy link
Member

Tested with EditorConfig extension branch delay-newline which fixed the issue.
Awaiting an official release of it and testing again before closing this issue.

@deribaucourt
Copy link
Member

deribaucourt commented Feb 21, 2025

EditorConfig extension v1.17.1 was just released. I tested it on my side and it fixed the bug.
Please update that extension.
Closing this issue.
Thanks to all users who participated in this discussion, and the EditorConfig team for their swift fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants