-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
vfmt: automatically add imports for vlib modules #23389
Comments
Afaik |
It doesn't sort now... but it could. It could also add missing imports... maybe? |
It should not sort stuff, especially imports. |
It would be fine if it sorted them, as long as there was no order-dependence on the imports. |
When using module two
fn init() {
println('init-two')
}
fn cleanup() {
println('cleanup-two')
} File three/three.v: module three
fn init() {
println('init-three')
}
fn cleanup() {
println('cleanup-three')
} This program: module main
import two as _
import three as _
fn main() {
} produces:
A would sort of the previous program: module main
import three as _
import two as _
fn main() {
} produces something different:
|
... and that shows an instance of the order dependence I was talking about. It wouldn't hurt a thing if those |
Describe the feature
vfmt should get the mod names from the vlib directory and add
import <mod_name>
to the top of your file if it's missing.Use Case
source:
after running
v fmt -w <file>
:Proposed Solution
No response
Other Information
No response
Acknowledgements
Version used
V 0.4.9 495adc9
Environment details (OS name and version, etc.)
V 0.4.9 4225a34.495adc9
The text was updated successfully, but these errors were encountered: