Git Product home page Git Product logo

Comments (2)

sparkprime avatar sparkprime commented on May 2, 2024

This seems like a good idea. I welcome a PR to add this, the default (on/off) being consistent with whatever vim-go does as the default since using vim-jsonnet is opt-in anyway. The big question is what options to call jsonnet fmt with, and how are they customized?

jsonnet fmt is a core part of Jsonnet and will be maintained with the same priority as Jsonnet itself.

Also note that jsonnet fmt is quite extensible (visitor pattern) and PRs for adding new formatting rules are welcome (although any change to the default behavior will be reviewed quite thoroughly as it could have far-reaching consequences).

thanks

from vim-jsonnet.

ahakanbaba avatar ahakanbaba commented on May 2, 2024

While being strongly inspired by this we recommend the following parameters, switches.

g:jsonnet_command = "jsonnet"
// This is the name of the binary

g:jsonnet_fmt_command = "fmt"
// This is the cmd passed to the binary.

This is slightly different from vim-go. There, gofmt is one binary. In jsonnet we execute jsonnet fmt
These two flags make this extension flexible enough.
If anything changes in the underlying tools, one could merely change the g:jsonnet_command and g:jsonnet_fmt_command in their .vimrc file and continue to use this extension.

g:jsonnet_fmt_options = ''
// Further optional user specified options to the jsonnet fmt command

I have very recently started to use jsonnet. I do not know the general desired formatting sentiments in the community. Please give suggestions if you want us to change anything in the following default flags.

We propose to have the "-n 4 -i" as default, this leaves all flags default to jsonnet fmt except the indentation.
-n / --indent Number of spaces to indent by (default 0, means no change)
We have selected 4 arbitrarily. If you think, say 3 is a better indentation we could change.
-i ( Update the Jsonnet file in place.) makes the implementation easier. It does not have user facing impact anyways.

Again, please note, the user has the freedom to override these with g:jsonnet_fmt_options in their vimrc file.

We have taken a first shot at implementing this. It looks pretty reasonable. We should be half way there to add this feature request in OSX environment.

We plan to follow up with a Pull Request in the following days.

Regards.

from vim-jsonnet.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.