pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

VSCode Auto-import inserts imports above `from __future__ import annotations`

Open memben opened this issue 6 months ago • 8 comments

Describe the Bug

VS Code auto-import Quick Fix inserts imports above from __future__ import annotations, causing invalid Python syntax. __future__ imports must remain at the top of the file, but Pyrefly’s code action places new imports before them.

Image Image

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

VSCode: Version: 1.119.1 [email protected]

memben avatar May 13 '26 19:05 memben

https://github.com/facebook/pyrefly/pull/1580

asukaminato0721 avatar May 14 '26 03:05 asukaminato0721

@yangdanny97 Hi, Can i take this?

f1sherFM avatar May 23 '26 04:05 f1sherFM

I'd like to work on this issue. The fix should ensure auto-imports are inserted after future imports rather than before them.

MD-Mushfiqur123 avatar May 25 '26 11:05 MD-Mushfiqur123

There's an in-progress PR for this issue, I'll see if I can get this merged soon, and if it cannot be merged for some reason I'll re-assign it.

yangdanny97 avatar May 25 '26 23:05 yangdanny97

#claim

asukaminato0721 avatar Jul 08 '26 11:07 asukaminato0721

@asukaminato0721 you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉

github-actions[bot] avatar Jul 08 '26 11:07 github-actions[bot]

This issue has someone assigned, but has not had recent activity for more than 2 weeks.

If you are still working on this issue, please add a comment so everyone knows. Otherwise, please comment #unclaim to unassign yourself.

Thank you for your contributions!

github-actions[bot] avatar Oct 31 '26 09:10 github-actions[bot]

https://github.com/meta/pyrefly/pull/5443

asukaminato0721 avatar Nov 03 '26 03:11 asukaminato0721