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

fix: keep selection on formatting #372

Merged
merged 9 commits into from
Jan 30, 2025
Merged

Conversation

SunsetTechuila
Copy link
Member

  • Use a meaningful title for the pull request.
  • Use meaningful commit messages.
  • Run tsc w/o errors (same as npm run compile).
  • Run npm run lint w/o errors.

fixes #330 and its duplicates

@xuhdev
Copy link
Member

xuhdev commented Jan 30, 2025

@SunsetTechuila Sorry for the delay. It seems like the main maintainer has stopped maintaining it for quite a while.

I can help with the review, but I never worked on this repo before today and don't know VSCode much. Could you add a bit more context to the original post so I can understand what this is doing/changing? Also, is there a relevant test that you can add?

@SunsetTechuila
Copy link
Member Author

SunsetTechuila commented Jan 30, 2025

before (autosave on change is on, and I'm not pressing Enter):

Recording.2025-01-30.173214.mp4

after (the active line changes only when I press Enter):

Recording.2025-01-30.173509.mp4

@SunsetTechuila
Copy link
Member Author

Why doesn't the current solution work? I have no idea. VSCode APIs are poorly documented, and after some experimentation I think this is a bug

@SunsetTechuila SunsetTechuila changed the title fix(DocumentWatcher): use Workspace.applyEdit for applying changes fix: keep selection on formatting Jan 30, 2025
@SunsetTechuila SunsetTechuila requested a review from xuhdev January 30, 2025 21:43
Co-authored-by: Hong Xu <hong@topbug.net>
Copy link
Member

@xuhdev xuhdev left a comment

Choose a reason for hiding this comment

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

Thanks!

@xuhdev xuhdev merged commit 9f87be5 into editorconfig:main Jan 30, 2025
9 checks passed
@xuhdev
Copy link
Member

xuhdev commented Jan 30, 2025

Could you take a look at this failure? https://github.com/editorconfig/editorconfig-vscode/actions/runs/13062880401/job/36449691603

It looks like the Windows test became flaky after this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong behaviour with insert_final_newline = true and "files.autoSave": "afterDelay"
2 participants