Home > OS >  How to indent flow/cadence files in vim correctly
How to indent flow/cadence files in vim correctly

Time:08-12

In cadence a resource interface can contain state and methods that needs to be implemented. However when I try to indent a cadence file in vim it will indent the code wrong.

pub resource interface INFT {
    pub let id: UInt64
    pub fun getName(): String
    pub fun getSchemas() : [String]
    pub fun resolveSchema(_ schema:String): AnyStruct
}

The result I get after gg=G

 pub resource interface INFT {
        pub let id: UInt64
            pub fun getName(): String
                               pub fun getSchemas() : [String]
                                                       pub fun resolveSchema(_ schema:String): AnyStruct
                                                                           
    }

I am not very familiary with indent rules for vim, can anybody help me out? There is a https://github.com/Cian911/vim-cadence project that has some syntax rules but currently it is not complete.

CodePudding user response:

Update: The maintainer has merged a request after we had a discussion that fixes a lot of my issues with this.

  • Related