-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db93eff
commit ea5078f
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ lib, helpers }: | ||
# Options: | ||
# - https://github.com/grafana/jsonnet-language-server/tree/main/editor/vim | ||
# - https://github.com/grafana/jsonnet-language-server/blob/main/pkg/server/configuration.go | ||
# - https://github.com/google/go-jsonnet/blob/master/internal/formatter/jsonnetfmt.go#L55 | ||
with lib; | ||
{ | ||
ext_vars = helpers.defaultNullOpts.mkAttrsOf types.str { } '' | ||
External variables. | ||
''; | ||
|
||
formatting = { | ||
Indent = helpers.defaultNullOpts.mkUnsignedInt 2 '' | ||
The number of spaces for each level of indenation. | ||
''; | ||
|
||
MaxBlankLines = helpers.defaultNullOpts.mkUnsignedInt 2 '' | ||
Max allowed number of consecutive blank lines. | ||
''; | ||
|
||
StringStyle = | ||
helpers.defaultNullOpts.mkEnum | ||
[ | ||
"double" | ||
"single" | ||
"leave" | ||
] | ||
"single" | ||
'' | ||
Whether strings should use double quotes `"`, single quotes `'`, or be left as-is. | ||
''; | ||
|
||
CommentStyle = | ||
helpers.defaultNullOpts.mkEnum | ||
[ | ||
"hash" | ||
"slash" | ||
"leave" | ||
] | ||
"slash" | ||
'' | ||
Whether comments should use hash `#`, slash `//`, or be left as-is. | ||
''; | ||
|
||
PrettyFieldNames = helpers.defaultNullOpts.mkBool true '' | ||
Causes fields to only be wrapped in `'''` when needed. | ||
''; | ||
|
||
PadArrays = helpers.defaultNullOpts.mkBool false '' | ||
Causes arrays to be written like `[ this ]` instead of `[this]`. | ||
''; | ||
|
||
PadObjects = helpers.defaultNullOpts.mkBool true '' | ||
Causes objects to be written like `{ this }` instead of `{this}`. | ||
''; | ||
|
||
SortImports = helpers.defaultNullOpts.mkBool true '' | ||
Causes imports at the top of the file to be sorted in groups by filename. | ||
''; | ||
|
||
UseImplicitPlus = helpers.defaultNullOpts.mkBool true '' | ||
Removes plus sign where it is not required. | ||
''; | ||
|
||
StripEverything = helpers.defaultNullOpts.mkBool false '' | ||
Removes all comments and newlines. | ||
''; | ||
|
||
StripComments = helpers.defaultNullOpts.mkBool false '' | ||
Removes all comments. | ||
''; | ||
|
||
StripAllButComments = helpers.defaultNullOpts.mkBool false '' | ||
Removes everything, other than comments. | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/test-sources/plugins/lsp/language-servers/jsonnet.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
example = { | ||
plugins.lsp = { | ||
enable = true; | ||
|
||
servers.jsonnet-ls = { | ||
enable = true; | ||
|
||
settings = { | ||
Indent = 4; | ||
MaxBlankLines = 10; | ||
StringStyle = "single"; | ||
CommentStyle = "leave"; | ||
PrettyFieldNames = true; | ||
PadArrays = false; | ||
PadObjects = true; | ||
SortImports = false; | ||
UseImplicitPlus = true; | ||
StripEverything = false; | ||
StripComments = false; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |