1

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.

bjartek
  • 929
  • 1
  • 5
  • 11
  • `:h indent.txt` – Matt Aug 02 '21 at 04:44
  • I think the best course of action, here, is to contact the maintainer of that plugin and work with him to either write a proper indent script or find the right options to put in `ftplugin/cadence.vim`. @Matt's suggestion being the most obvious starting point. – romainl Aug 02 '21 at 07:35
  • 1
    I would recommend contacting the maintainer and opening an issue on the repo. – Piaras Hoban Aug 06 '21 at 15:45

1 Answers1

1

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

bjartek
  • 929
  • 1
  • 5
  • 11