mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-13 23:51:20 +03:00
Fix json schema for context of CustomCommand
Previously the schema only allowed a single value; however, it is now possible to specify multiple values separated by comma, and you would get very ugly red error squiggles in VS Code when you did that. The only solution that I can see is to get rid of the "enum" specification, and mention the valid values only in the description. Add examples too so that you get at least auto-completion.
This commit is contained in:
parent
c37376af74
commit
19921b7c42
2 changed files with 5 additions and 5 deletions
|
@ -611,8 +611,8 @@ type CustomCommandAfterHook struct {
|
|||
type CustomCommand struct {
|
||||
// The key to trigger the command. Use a single letter or one of the values from https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md
|
||||
Key string `yaml:"key"`
|
||||
// The context in which to listen for the key
|
||||
Context string `yaml:"context" jsonschema:"enum=status,enum=files,enum=worktrees,enum=localBranches,enum=remotes,enum=remoteBranches,enum=tags,enum=commits,enum=reflogCommits,enum=subCommits,enum=commitFiles,enum=stash,enum=global"`
|
||||
// The context in which to listen for the key. Valid values are: status, files, worktrees, localBranches, remotes, remoteBranches, tags, commits, reflogCommits, subCommits, commitFiles, stash, and global. Multiple contexts separated by comma are allowed; most useful for "commits, subCommits" or "files, commitFiles".
|
||||
Context string `yaml:"context" jsonschema:"example=status,example=files,example=worktrees,example=localBranches,example=remotes,example=remoteBranches,example=tags,example=commits,example=reflogCommits,example=subCommits,example=commitFiles,example=stash,example=global"`
|
||||
// The command to run (using Go template syntax for placeholder values)
|
||||
Command string `yaml:"command" jsonschema:"example=git fetch {{.Form.Remote}} {{.Form.Branch}} && git checkout FETCH_HEAD"`
|
||||
// If true, run the command in a subprocess (e.g. if the command requires user input)
|
||||
|
|
|
@ -875,7 +875,8 @@
|
|||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"description": "The context in which to listen for the key. Valid values are: status, files, worktrees, localBranches, remotes, remoteBranches, tags, commits, reflogCommits, subCommits, commitFiles, stash, and global. Multiple contexts separated by comma are allowed; most useful for \"commits, subCommits\" or \"files, commitFiles\".",
|
||||
"examples": [
|
||||
"status",
|
||||
"files",
|
||||
"worktrees",
|
||||
|
@ -889,8 +890,7 @@
|
|||
"commitFiles",
|
||||
"stash",
|
||||
"global"
|
||||
],
|
||||
"description": "The context in which to listen for the key"
|
||||
]
|
||||
},
|
||||
"command": {
|
||||
"type": "string",
|
||||
|
|
Loading…
Reference in a new issue