Closed ShelpAm closed 1 year ago
What I actually want to know is how to 'Reads your configured scopes from [commitlint](https://commitlint.js.org/#/'.
What I actually want to know is how to 'Reads your configured scopes from [commitlint]
Can you run node --eval 'eval("var obj ="+process.argv[1]);console.log(JSON.stringify(obj?.rules?.["type-enum"]?.[2]));' "$(npx commitlint --print-config --no-color | tr '\n' ' ')" 2>/dev/null
on the root of your project?
What I actually want to know is how to 'Reads your configured scopes from [commitlint]
Can you run
node --eval 'eval("var obj ="+process.argv[1]);console.log(JSON.stringify(obj?.rules?.["type-enum"]?.[2]));' "$(npx commitlint --print-config --no-color | tr '\n' ' ')" 2>/dev/null
on the root of your project?
Ok, I will try it tomorrow.
What I actually want to know is how to 'Reads your configured scopes from [commitlint]
Can you run
node --eval 'eval("var obj ="+process.argv[1]);console.log(JSON.stringify(obj?.rules?.["type-enum"]?.[2]));' "$(npx commitlint --print-config --no-color | tr '\n' ' ')" 2>/dev/null
on the root of your project?
It returns 'undefined'. Then how should I fix it please?
You should install (and configure) @commitlint/cli
and a configuration like @commitlint/config-conventional
You should install (and configure)
@commitlint/cli
and a configuration like@commitlint/config-conventional
Now I have installed and configured them. And what else should I do?
After running this echo '123' | commitlint
, I got:
⧗ input: 123
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings,
Then I ran node --eval 'eval("var obj ="+process.argv[1]);console.log(JSON.stringify(obj?.rules?.["type-enum"]?.[2]));' "$(npx commitlint --print-config --no-color | tr '\n' ' ')" 2>/dev/null
, and it returns ["build","chore","ci","docs","feat","fix","perf","refactor","revert","style","test"]
. However, when I tried git commit
, The plugin didn't work yet.
Well, I'm running out of ideas. Can you add this to your cmp config?:
...
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete({
config = {
sources = {
{ name = 'conventionalcommits' },
},
},
}),
}),
...
Then, enter neovim (with nvim -c 'set ft=gitcommit'
, for example) in a gitcommit
filetype buffer, enter insert mode on the first row and column (0,0
) of the buffer and press <Ctrl-Space>
(with your keyboard, something like this should appear:
https://user-images.githubusercontent.com/9190258/233401784-87180c6d-8337-40d2-97c6-0d98dcf6b48e.mp4
Well, I'm running out of ideas. Can you add this to your cmp config?:
... mapping = cmp.mapping.preset.insert({ ['<C-Space>'] = cmp.mapping.complete({ config = { sources = { { name = 'conventionalcommits' }, }, }, }), }), ...
Then, enter neovim (with
nvim -c 'set ft=gitcommit'
, for example) in agitcommit
filetype buffer, enter insert mode on the first row and column (0,0
) of the buffer and press<Ctrl-Space>
(with your keyboard, something like this should appear:
2023-04-20.09-38-23.mp4
Thanks! It works! But when I run git commit
, it breaks again.
It seems that only when I commit does it not work.
I find that after setting the filetype, it works. What exactly is the problem??
The completion only activates on gitcommit
buffers, so is a requisite. git commit
should setup your $EDITOR
correctly, can't help you with that.
Ok, still thanks a lot for your help!
I can't get a completion from this plugin.