-
Notifications
You must be signed in to change notification settings - Fork 20
Option to define possible values for custom footer type #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It should be possible by extending the default tokens schema. I'll take a look soon. |
For your use case this seems overkill btw. |
This is more complex than expected, in the sense that it uncovered a deeper issue: the org.json library does not preserve JSON keys order (well it's the spec, but there is no option for it), resulting in a mess when calling completion. Thus I'm also replacing the JSON-related libraries now, will take a bit longer. |
Thanks for your time and effort! I was just curious why can't it be defined similar to scopes? "action": {
"description": "Some description",
"options": {
"close": {},
"revert": {},
"whatever": {}
}
}, |
It can, but up until now I did not realize the JSON lib is NOT maintaining keys ordering as internally it uses a hash map, and not a linked hash map. It's not noticeable with three keys, but it is with ten+. |
And JSON arrays can't be used? There would be no additional fields to each option possible of course but for our case it's more than enough :) "action": {
"description": "Some description",
"options": ["close", "revert", "whatever"]
}, |
Sure, but in this specific context they make the schema and the resulting JSON worse to write. I also want to encode values as objects, so that additional properties are easy to add, and potentially read from extenders. |
Thanks, makes sense, it's not feature just for me :) |
It's not easy to go back once you commit something, that's mostly why I take a cautious approach. |
Could you try this version? You'll have to install it manually. |
Completion doesn't seem to be updated somehow, it only suggests existing fields, I checked the structure in repo, is this correct? {
"name": "Action",
"description": "action description",
"values": {
"something": {
"description": "some description"
},
"else": {
"description": "whatever"
}
}
}, But when I try to type anything in commit msg area, I get "Error reading custom defaults file: the file does not respect the JSON schema. Using built-in tokens instead". |
If // conventionalcommit.json
{
"types": {
...
},
"footerTypes": {
"Action": {
"description": "action description",
"values": {
"something": {
"description": "Some description"
},
"else": {
"description": "whatever"
}
}
}
}
} Also note that manually specifying the schema is not necessary. The correct schema should be injected automatically. |
Ah, okay, I didn't realise/notice it's now one of array or object, now it's clear, thanks. But if you don't mind me asking stupid questions: why couldn't it stay as array with additional "footerTypes": [
{
"name": "Action",
"description": "action description",
"values": [
{
"first-value": {
"description": "some description"
},
"second-value": {
"description": "whatever"
}
}
]
}
]
Anyway I tested it a bit and it looks like it's working fine except couple things (which I'm not sure can be solved): If I'm typing footer type value manually, the completion popup only shows defined values which is correct: After automatic completion (when I finish And if I press Completion shortcut, in addition it also shows commit messages and some files etc from history (or whatever is used for it), could it always only show defined values? Also when I remove
It showed warning (missing schema) in GoLand's status bar when editing |
It was done to align it to the
You can disable the VCS provider via the
Indeed that's what the default completion would give you, I cannot block it. Well I can, but it's dangerous.
Could you let me know what exception you see in the IDE logs? |
I would need this setting per footer type because I want to get issues for things like
Not sure if there are other logs than popup and notifications, I even tried "Tail Log in Console" but there was nothing, all I see is this: |
Hello,
first of all thanks for a very nice plugin and I'd like to ask if it's possible (if it makes sense for you) to add option to define values for custom footer type in
conventionalcommit.json
schema?We are using something like
Action: <value>
wherevalue
is one of some predefined values.I suppose I could create some simple plugin with my own provider (is there maybe some example or documentation about how to do it?) but was wondering if such thing could be builtin feature.
Thanks!
The text was updated successfully, but these errors were encountered: