Comments (2)
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.
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)
- Reindent with `=` is broken HOT 4
- Apply plugin to .libjsonnet HOT 1
- An option to set indentation to 4 spaces? HOT 1
- Symlink replaced by file upon :wq HOT 2
- No syntax highlighting for .libsonnet in neovim (0.4.2) HOT 4
- Handle jsonnetfmt errors HOT 1
- Wrong documentation on g:jsonnet_fmt_command
- Adding Jsonnet syntax highlighting to the upstream HOT 1
- foldmethod=syntax is broken in neovim?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-jsonnet.