GithubHelp home page GithubHelp logo

lppedd / idea-conventional-commit Goto Github PK

View Code? Open in Web Editor NEW
317.0 6.0 17.0 2.46 MB

Context and template-based completion for conventional/semantic commits.

Home Page: https://plugins.jetbrains.com/plugin/13389-conventional-commit

License: MIT License

Java 1.89% HTML 10.44% Kotlin 86.83% Lex 0.85%
intellij intellij-plugin semantic-commits conventional-commit idea idea-plugin semantic

idea-conventional-commit's Introduction

Plugin logo

Conventional Commit

Looking for the latest plugin binaries? Get them here as .zip
Supported IDE versions from 0.23.0: 223.4884 to 243.* (both inclusive)
Supported IDE versions from 0.19.0: 202.6397 to 233.* (both inclusive)
Supported IDE versions upto 0.18.0: 193.**** to 212.* (both inclusive)

Additional Providers are available by installing other lightweight plugins.

Context & GitHub Plugins Repository Type Scope Subject Body Footer type Footer value
Angular (2+) ✔️ Install (Deprecated) ✔️
Commitlint ✔️ Install (Deprecated) ✔️ ✔️
GitHub Coming soon...
VCS (extended) Coming soon...

The aim of this plugin is to provide completion for conventional commits, also named semantic commits, inside the VCS Commit dialog. The plugin must provide:

  • standard completion — based on context
  • template completion — initiated intentionally
  • extensibility — which means allowing attaching providers for the various parts of the commit:
    type, scope, subject, body and footer

Writing quality commit messages is important to keep an understandable and searchable history of your project. Conventional commits are a perfect example of that.
However, as an example, it can happen choosing the correct type or scope isn't that immediate. We might have forgotten about when a specific type should be used or what are the available scopes, or we simply need a way to quickly complete the subject.

The plugin helps with the above, while also respecting the aforementioned requirements, so that each user is able to customize the experience based on its preferences.

Completion modes

The plugin offers two completion modes.

  • Context based

    The commit message can be written like you have done until now, but by invoking completion you'll be offered the correct items based on the scope. Certain commodities, such as auto-completing the scope parenthesis or the : separator, are there too.

    Standard completion
  • Template based

    By firstly invoking the type completion and confirming an item, a template will be generated in place, and you'll be guided through each token (scope and subject). You can also go back (with shift + tab) and change your pick.

    Arbitrary characters' insertion is also allowed inside each template's range marker.

    Template completion

Inspections

Inspections are bundled too, and they're extensible, which means a Provider may contribute with additional ones.
The standard inspection warns you if you're not following the Conventional Commit standard. In case, just press ctrl + alt + l (on Windows) and the commit message will be formatted for you.

Inspections

You may enable/disable inspections via Settings > Version Control > Commit

Documentation

Each commit token is able to hold documentation. This is important in case you forgot their meaning, or if you want to share additional pieces of information with users.

Documentation

Documentation for tokens which might hold long text, spawning multiple lines, is rendered a bit differently.

Long documentation

Custom default types and scopes

Default commit types and scopes can be totally customized and shared with your team by creating and populating a JSON file named

conventionalcommit.json

The plugin uses an internal version of that file, which you can export via Export built-in defaults to path.
You may then customize it per your needs.

Custom defaults

You're allowed to provide custom commit's types, scopes and footer types, given the JSON file respects a Schema.
An example is shown below:

{
  "types": {
    "customType": {
      "description": "My custom type description"
    },
    "anotherCustomType": {},
    "yetAnotherCustomType": {
      "description": "This is my description",
      "scopes": {
        "first": {
          "description": "My first description"
        },
        "second": {
          "description": "My second description"
        }
      }
    }
  },
  "commonScopes": {
    "one": {
      "description": "My first common scope"
    },
    "two": {}
  },
  "footerTypes": [
    {
      "name": "My-custom-footer",
      "description": "My footer description"
    }
  ]
}

If the file is located in the project's root directory, the plugin will pick it up automatically, making it easy to version it, and avoiding to explicitly set a Custom default tokens path.

Providers

In a fresh installation you'll only be offered the most common tokens (e.g. fix, feat, build, BREAKING CHANGE, etc.), but the plugin exposes an API to enhance completion items, per each token. Type, scope and subject each have a specific entry point, and the implementation is called Provider. Each Provider is listed in a table, based on its context.

Providers

You're allowed to re-order Providers per your necessities, knowing that possible duplicates are going to be automatically filtered by the core engine.

More on this later on...


Author and contributors

idea-conventional-commit's People

Contributors

bric3 avatar linwancen avatar lppedd avatar ymind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

idea-conventional-commit's Issues

Exporting defaults should warn in case of missing authorizations

First thanks for a great plugin. It looks like it can save a lot of time and confusion, specially for people new to conventional-commit.

I'm having some issues on Windows with using Custom default tokens. As mentioned in title clicking the button/link doesn't store a file cc_defaults.json. If I store https://github.com/lppedd/idea-conventional-commit/blob/6552bec46cf56888a45b0ddc5703e97e856739c0/src/main/resources/defaults/cc_defaults.schema.json under that file name and provide the path to plugin, it will keep saying The file does not respect JSON schema:# required key [types] not found.

image

Am I doing something wrong or it may be it's a bug?

Intellj Crash

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @6968fcee)
at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:97)
at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:25)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:133)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:278)
at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:265)
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:716)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:746)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:737)
at com.github.lppedd.cc.api.DefaultCommitTokenProvider.getCommitFooterValues(DefaultCommitTokenProvider.kt:77)
at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:44)
at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:27)
at com.github.lppedd.cc.CCExtensionsKt$sam$i$java_util_concurrent_Callable$0.call(CCExtensions.kt)
at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$1(ApplicationUtil.java:48)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$2(ApplicationUtil.java:46)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:268)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)

Update Chinese translation

Hey @ymind, I've added and updated a couple messages 😄, here is the list.
If you have some time, it would be nice to update the chinese translation.
Also feel free to give suggestions for better messages!

Added:

cc.inspection.namingConvention.description=Conventional Commit: naming convention
cc.inspection.namingConvention.text=Naming convention violation. Illegal characters used
cc.inspection.namingConvention.comment=\
  Reports commit's <b>types</b> and <b>scopes</b> that do not follow \
  the specified regular expression patterns.<br/>\
  Use the fields provided below to specify the regular expressions (in <b>java.util.regex</b> format).
cc.inspection.namingConvention.pattern.type.label=Type pattern:
cc.inspection.namingConvention.pattern.scope.label=Scope pattern:
cc.inspection.namingConvention.pattern.error=Bad regular expression pattern

Updated (notice the removed (s), replaced by a simple s):

cc.inspection.nonStdMessage.text=Non-standard whitespaces
cc.inspection.nonStdMessage.addWs=Add whitespaces
cc.inspection.nonStdMessage.removeWs=Remove whitespaces
cc.inspection.nonStdMessage.replaceWs=Replace whitespaces with {0}

Review and document code

Because the plugin is becoming quite complicated, I'm trying to find more experienced Kotlin developers which can review some code.

[feature request] VCS friendly custom tokens

I'm sharing most of my .idea files on git, so if anyone runs the same IDE he has everything set up once he clones and opens IDEs (mostly I've added that to share complex run configurations).

I've noticed that file conventionalCommit.xml always uses full path to the file, so this won't work on another computer, where user stores his project in a different directory.

I've tried to change the XML manually with

<option name="customFilePath" value="$PROJECT_DIR$/cc_defaults.json"/>

...which seems to work, plugin settings view gets the correct path (which is full path, c:..., event after IDE restart), but after a while I notice that (I guess plugin) updates this XML back with the full path instead of using $PROJECT_DIR$. I've also tried by just entering cc_defaults.json and $PROJECT_DIR$/cc_defaults.json but the plugin doesn't recognize this syntax.

Would be really nice if this could be solved. I guess the simplest solution would just be to check if full path contains $PROJECT_DIR$'s value, if so, that part of the full path should be replaced with string "$PROJECT_DIR$", so that the output is the same as in XML code snippet above. Or I guess IDE fw for plugins may already have a helper for this?

EDIT: After going back to my IDE and committing these files to my repo, I was thinking, maybe it would make more sense to store cc_defaults.json content in conventionalCommit.xml since it's both plugin configuration kind of (maybe this wouldn't work in case one would want to store this outside the project or in another project folder, so I guess current solution is the most flexible one).

[feature request] Make custom tokens configuration file more descriptive

Hi! At first, thanks for the plugin! It looks really promising.

The current approach for storing custom tokens configuration, i.e. cc_defaults.json, seems not enough self-descriptive.
E.g. in case this file is put into VCS with a project it might get confusing for other people who not have the plugin installed. There is no hint what this file is for or any explicit reference to the plugin.

It might be helpful to create additional field in the JSON schema for such purposes, e.g. above the current "types" root field. Or consider using a different format for this file, e.g. YAML which supports comments.
Another helpful thing might be allowing to use different name than cc_defaults.json, now it doesn't work for any other name - "The file is not valid" popup appears.

Compatibility with v212.*

It is not compatible with the latest WebStorm release v212.4746.80.

Could you enable compatibility/upgrade it?

grafik

System

WebStorm 2021.2
Build #WS-212.4746.80, built on July 23, 2021
Runtime version: 11.0.11+9-b1504.13 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: debugger.watches.in.variables=false, ide.balloon.shadow.size=15
Non-Bundled Plugins: zielu.gittoolbox (212.6.6), mobi.hsz.idea.gitignore (4.1.1), com.crunch42.openapi (1.18), com.intellij.swagger (212.4746.54), izhangzhihao.rainbow.brackets (6.19)

Translate new properties values to Chinese

cc.config.coAuthors.description=View, modify and select co-authors in a specialized dialog
cc.config.coAuthorsDialog.title=Select co-authors
cc.config.coAuthorsDialog.empty=No co-authors defined
cc.config.coAuthorsDialog.error=A co-author's name cannot be blank
cc.config.popup.hideSelected=Hide selected
cc.config.popup.keepSelected=Keep selected

cc.inspection.nonStdMessage.description=Conventional Commit: non-standard message
cc.inspection.nonStdMessage.text=Non-standard whitespace(s)
cc.inspection.nonStdMessage.emptyScope=The scope cannot be empty
cc.inspection.nonStdMessage.removeScope=Remove empty scope
cc.inspection.nonStdMessage.addWs=Add whitespace(s)
cc.inspection.nonStdMessage.removeWs=Remove whitespace(s)
cc.inspection.nonStdMessage.replaceWs=Replace whitespace(s) with {0}
cc.inspection.nonStdMessage.replaceWs.label=Replace scope's middle spaces with:

@ymind Hi! 😄
I'm asking you again (you're the only one I know lol), if you have free time and want to do it 💯
If you have any doubt for the context of those labels, let me know.

Add Refs footer type

Example

revert: let us never again speak of the noodle incident

Refs: 676104e, a215868

Only if the type is revert.

Update translations

@ymind Hi there! 😄 Need your feedback.
Do you think "Recently used" and "Default" should be translated here? Or even VCS (Version Control System)?

image

Implement concurrent Providers execution

  • Add timeout to the CommitTokenProvider interface, with a default value of 1000 ms
  • Use CompletableFutures with a pool of min(numOfProviders, 4) threads

Optional

  • Rework element's weight logic

Feedback: general

Feel free to write down whatever you want regarding the plugin, good and bad things you noticed using it, things you would like to see implemented or enhanced.

Error when deleting file outside of Intellij IDEA

java.lang.RuntimeException: com.intellij.openapi.vcs.VcsException: Cannot start process, the working directory '/Users/kkn/src/github.com/streamr-dev/streamr-client-java/contracts/data-union-solidity' does not exist
	at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:132)
	at com.intellij.util.EventDispatcher.throwExceptions(EventDispatcher.java:158)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:402)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:379)
	at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:178)
	at com.sun.proxy.$Proxy127.dirtyUnder(Unknown Source)
	at git4idea.annotate.GitRepositoryForAnnotationsListener$1.repositoryChanged(GitRepositoryForAnnotationsListener.java:18)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:674)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:649)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:422)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:397)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:379)
	at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:185)
	at com.sun.proxy.$Proxy126.repositoryChanged(Unknown Source)
	at git4idea.repo.GitRepositoryManager.lambda$notifyListenersAsync$2(GitRepositoryManager.java:88)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.intellij.openapi.vcs.VcsException: Cannot start process, the working directory '/Users/kkn/src/github.com/streamr-dev/streamr-client-java/contracts/data-union-solidity' does not exist
	at git4idea.history.GitLogOutputSplitter.startFailed(GitLogOutputSplitter.java:123)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:123)
	at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:86)
	at com.sun.proxy.$Proxy122.startFailed(Unknown Source)
	at git4idea.commands.GitHandler.start(GitHandler.java:442)
	at git4idea.commands.GitHandler.runInCurrentThread(GitHandler.java:377)
	at git4idea.commands.GitImplBase.doRun(GitImplBase.java:209)
	at git4idea.commands.GitImplBase.run(GitImplBase.java:171)
	at git4idea.commands.GitImplBase.runCommandWithoutCollectingOutput(GitImplBase.java:103)
	at git4idea.history.GitLogUtil.readTimedCommits(GitLogUtil.java:94)
	at git4idea.log.GitLogProvider.getCommitsMatchingFilter(GitLogProvider.java:536)
	at git4idea.log.GitLogProvider.getCommitsMatchingFilter(GitLogProvider.java:410)
	at com.github.lppedd.cc.vcs.CCVcsHandler.fetchCommitsFromLogProvider(CCVcsHandler.kt:121)
	at com.github.lppedd.cc.vcs.CCVcsHandler.access$fetchCommitsFromLogProvider(CCVcsHandler.kt:28)
	at com.github.lppedd.cc.vcs.CCVcsHandler$fetchCommits$1.invoke(CCVcsHandler.kt:103)
	at com.github.lppedd.cc.vcs.CCVcsHandler$fetchCommits$1.invoke(CCVcsHandler.kt:103)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
	at com.github.lppedd.cc.vcs.CCVcsHandler.fetchCommits(CCVcsHandler.kt:104)
	at com.github.lppedd.cc.vcs.CCVcsHandler.refreshCachedValues(CCVcsHandler.kt:91)
	at com.github.lppedd.cc.vcs.CCVcsHandler.access$refreshCachedValues(CCVcsHandler.kt:28)
	at com.github.lppedd.cc.vcs.CCVcsHandler$MyVcsLogRefresher.refresh(CCVcsHandler.kt:210)
	at git4idea.log.GitLogProvider.lambda$subscribeToRootRefreshEvents$4(GitLogProvider.java:397)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:674)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:649)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:422)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:393)
	... 26 more
Caused by: com.intellij.execution.ExecutionException: Cannot start process, the working directory '/Users/kkn/src/github.com/streamr-dev/streamr-client-java/contracts/data-union-solidity' does not exist
	at com.intellij.execution.configurations.GeneralCommandLine.validateAndPrepareCommandLine(GeneralCommandLine.java:399)
	at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:379)
	at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:100)
	at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:48)
	at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:37)
	at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:45)
	at git4idea.commands.GitTextHandler$MyOSProcessHandler.<init>(GitTextHandler.java:184)
	at git4idea.commands.GitLineHandler$1.<init>(GitLineHandler.java:146)
	at git4idea.commands.GitLineHandler.createProcess(GitLineHandler.java:146)
	at git4idea.commands.GitTextHandler.startProcess(GitTextHandler.java:76)
	at git4idea.commands.GitHandler.start(GitHandler.java:432)
	... 50 more

Another crash

java.lang.ClassCastException: class com.github.lppedd.cc.inspection.CommitBaseInspection$ConventionalCommitReformatQuickFix cannot be cast to class com.intellij.codeInspection.LocalQuickFixBase (com.github.lppedd.cc.inspection.CommitBaseInspection$ConventionalCommitReformatQuickFix is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @67f86a61; com.intellij.codeInspection.LocalQuickFixBase is in unnamed module of loader com.intellij.util.lang.UrlClassLoader @7bab3f1a)
at com.github.lppedd.cc.inspection.CommitFormatInspection$handleType$3.invoke(CommitFormatInspection.kt:87)
at com.github.lppedd.cc.inspection.CommitFormatInspection$handleType$3.invoke(CommitFormatInspection.kt:23)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:172)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:716)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:746)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:737)
at com.github.lppedd.cc.inspection.CommitFormatInspection.handleType(CommitFormatInspection.kt:100)
at com.github.lppedd.cc.inspection.CommitFormatInspection.checkHeader(CommitFormatInspection.kt:56)
at com.github.lppedd.cc.inspection.CommitFormatInspection.checkFile(CommitFormatInspection.kt:40)
at com.intellij.vcs.commit.message.BaseCommitMessageInspection.checkFile(BaseCommitMessageInspection.java:64)
at com.github.lppedd.cc.inspection.CommitBaseInspection.checkFile(CommitBaseInspection.kt:43)
at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:145)
at com.intellij.psi.PsiElementVisitor.visitPlainTextFile(PsiElementVisitor.java:43)
at com.intellij.psi.impl.source.PsiPlainTextFileImpl.accept(PsiPlainTextFileImpl.java:36)
at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:65)
at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:56)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:294)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$3(LocalInspectionsPass.java:263)
at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:155)
at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:147)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:262)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:126)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:115)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:262)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1105)
at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:117)
at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:57)
at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:49)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitPriorityElementsAndInit(LocalInspectionsPass.java:266)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:191)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:113)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:80)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:54)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:399)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:392)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:391)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:367)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:365)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

NoSuchElementException

This is using Conventional Commit 0.18.0, downloaded in IntelliJ Zvia the plugin marketplace.

Upon first typing in the commit dialog, the IntelliJ IDE reports this error:

java.util.NoSuchElementException: Collection contains no element matching the predicate.
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider$getCommitTypes$2$1.invoke(RecentCommitTokenProvider.kt:168)
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider$getCommitTypes$2$1.invoke(RecentCommitTokenProvider.kt:23)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.DistinctIterator.computeNext(Sequences.kt:571)
	at kotlin.collections.AbstractIterator.tryToComputeNext(AbstractIterator.kt:42)
	at kotlin.collections.AbstractIterator.hasNext(AbstractIterator.kt:29)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableSet(_Sequences.kt:1155)
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider$getCommitTypes$2.invoke(RecentCommitTokenProvider.kt:58)
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider$getCommitTypes$2.invoke(RecentCommitTokenProvider.kt:23)
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider.doGet(RecentCommitTokenProvider.kt:120)
	at com.github.lppedd.cc.vcs.RecentCommitTokenProvider.getCommitTypes(RecentCommitTokenProvider.kt:48)
	at com.github.lppedd.cc.completion.providers.TypeCompletionProvider$complete$2$1.invoke(TypeCompletionProvider.kt:34)
	at com.github.lppedd.cc.completion.providers.TypeCompletionProvider$complete$2$1.invoke(TypeCompletionProvider.kt:18)
	at com.github.lppedd.cc.CCExtensionsKt$sam$i$java_util_concurrent_Callable$0.call(CCExtensions.kt)
	at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$1(ApplicationUtil.java:43)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$2(ApplicationUtil.java:41)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)

Unsure if any configuration is required (I just grabbed this from the marketplace, restarted, and started typing my commit message).

Provide inspections and quick-fixes

Let's try to understand what's the better way to do this.

See BaseCommitMessageInspection
See EditChangelistSupport.EP_NAME
See CommitMessage.InspectionCustomization
See InspectionProfileWrapper.CUSTOMIZATION_KEY

How to define public scopes in cc_defaults.json ?

Thank you for your good job first ! This plugin is exactly what I need, It effectively improved my work.

I have some problems at work:

  1. I want to know how to use cc_defaults.json define some public scopes.
  2. Have you considered automatically loading cc_defaults.json in the project root directory and taking effect by default ? I expect it to work like .editorconfig.

For the first question, my current config is:

{
  "fix": {
    "description": "xxx",
    "scopes": {
      "common": {
        "description": "xxx"
      },
      "config": {
        "description": "xxx"
      }
    }
  },
  "feat": {
    "description": "xxx",
    "scopes": {
      "common": {
        "description": "xxx"
      },
      "config": {
        "description": "xxx"
      }
      // ... balabala
    }
  }
  // ... balabala
}

This is not convenient, I want to define some public scopes, like:

{
  "types": {
    "fix": {
      "description": "xxx",
      "scopes": {
        "customScope": {
          "description": "xxx"
        }
        // ... balabala
      }
    },
    "feat": {
      "description": "xxx"
    }
    // ... balabala
  },
  "scopes": {
    "common": {
      "description": "xxx"
    },
    "config": {
      "description": "xxx"
    }
    // ... balabala
  }
}

Documentation doesn't work

In WebStorm 2021.1.1 Preview, pressing F1 or clicking the tooltip button to display documentation for a type, does not have any action.

RuntimeException: java.lang.reflect.InvocationTargetException

WebStorm encountered this issue and said I should report it to you 😉

grafik

Steps to reproduce

I guess this happened, like this:

  1. I wrote a commit message. (and selected one of one file from a changeset)
  2. I used WebStorm's cock wheel there to set a different commit author than myself.
  3. Switched branch to main branch, updated from origin and finally created a new branch with / i.e. git-directory-like as example/hereWegGo.

Then this happened.

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:132)
	at com.intellij.util.EventDispatcher.throwExceptions(EventDispatcher.java:158)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:402)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:379)
	at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:178)
	at com.sun.proxy.$Proxy118.dirtyUnder(Unknown Source)
	at git4idea.annotate.GitRepositoryForAnnotationsListener$1.repositoryChanged(GitRepositoryForAnnotationsListener.java:18)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:674)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:649)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:422)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:397)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:379)
	at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:185)
	at com.sun.proxy.$Proxy117.repositoryChanged(Unknown Source)
	at git4idea.repo.GitRepositoryUpdater.filesChanged(GitRepositoryUpdater.java:105)
	at com.intellij.vfs.AsyncVfsEventsPostProcessorImpl$processEvents$1.run(AsyncVfsEventsPostProcessorImpl.kt:64)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:254)
	at com.intellij.vfs.AsyncVfsEventsPostProcessorImpl.processEvents(AsyncVfsEventsPostProcessorImpl.kt:63)
	at com.intellij.vfs.AsyncVfsEventsPostProcessorImpl.access$processEvents(AsyncVfsEventsPostProcessorImpl.kt:32)
	at com.intellij.vfs.AsyncVfsEventsPostProcessorImpl$queue$1.consume(AsyncVfsEventsPostProcessorImpl.kt:34)
	at com.intellij.vfs.AsyncVfsEventsPostProcessorImpl$queue$1.consume(AsyncVfsEventsPostProcessorImpl.kt:32)
	at com.intellij.util.concurrency.QueueProcessor.lambda$wrappingProcessor$0(QueueProcessor.java:81)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
	at com.intellij.util.concurrency.QueueProcessor.lambda$wrappingProcessor$1(QueueProcessor.java:81)
	at com.intellij.util.concurrency.QueueProcessor.lambda$startProcessing$3(QueueProcessor.java:214)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
	at com.intellij.util.concurrency.QueueProcessor.lambda$startProcessing$4(QueueProcessor.java:214)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.github.lppedd.cc.vcs.CCVcsHandler.readMetadataComp(CCVcsHandler.kt:143)
	at com.github.lppedd.cc.vcs.CCVcsHandler.fetchCommitsFromLogProvider(CCVcsHandler.kt:127)
	at com.github.lppedd.cc.vcs.CCVcsHandler.access$fetchCommitsFromLogProvider(CCVcsHandler.kt:29)
	at com.github.lppedd.cc.vcs.CCVcsHandler$fetchCommits$1.invoke(CCVcsHandler.kt:103)
	at com.github.lppedd.cc.vcs.CCVcsHandler$fetchCommits$1.invoke(CCVcsHandler.kt:29)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:752)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:782)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:773)
	at com.github.lppedd.cc.vcs.CCVcsHandler.fetchCommits(CCVcsHandler.kt:104)
	at com.github.lppedd.cc.vcs.CCVcsHandler.refreshCachedValues(CCVcsHandler.kt:91)
	at com.github.lppedd.cc.vcs.CCVcsHandler.access$refreshCachedValues(CCVcsHandler.kt:29)
	at com.github.lppedd.cc.vcs.CCVcsHandler$MyVcsLogRefresher.refresh(CCVcsHandler.kt:211)
	at git4idea.log.GitLogProvider.lambda$subscribeToRootRefreshEvents$4(GitLogProvider.java:397)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:674)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:649)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:422)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:393)
	... 42 more
Caused by: com.intellij.openapi.vcs.VcsException: not a git repository (or any of the parent directories): .git
	at git4idea.commands.GitCommandResult.throwOnError(GitCommandResult.java:151)
	at git4idea.history.GitLogUtil.collectMetadata(GitLogUtil.java:137)
	at git4idea.log.GitLogProvider.readMetadata(GitLogProvider.java:347)
	... 64 more

System

WebStorm 2021.1
Build #WS-211.6693.108, built on April 5, 2021
Runtime version: 11.0.10+9-b1341.35 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1996M
Cores: 4
Registry: ide.intellij.laf.enable.animation=true, debugger.watches.in.variables=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: com.berzanmikaili.intellij.monokai_pro (2.0.2c), com.github.lppedd.idea-conventional-commit (0.18.0), com.intellij.ideolog (203.0.27.0), com.mallowigi.idea (13.1), com.tylerthrailkill.intellij.solarized (3.0.0), mobi.hsz.idea.gitignore (4.1.0), com.intellij.swagger (211.6693.108), izhangzhihao.rainbow.brackets (6.17)

CJK language support

If I use Korean on the scope, a warning phrase occurs.

i.g. fix(메뉴): do something

-> warning: Naming convention violation. Illegal characters used

Can you improve it?

I'm getting a lot of help from you and thank you.

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class

STR

I do have gittoolbox installed and emoji completion in commits enabled (as Unicode) and I tried to use : to search and enter an emoji.
grafik

It could not find any emoji, altghough it worked for the previous coimmit (already committed and was auto-suggested to me).

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @33bffa79)
	at com.github.lppedd.cc.parser.FooterTokens.getContext(FooterTokens.kt:18)
	at com.github.lppedd.cc.completion.CommitCompletionContributor.fillCompletionVariants(CommitCompletionContributor.kt:151)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:60)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:133)
	at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:41)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$12(CompletionProgressIndicator.java:863)
	at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:163)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:574)
	at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:162)
	at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:43)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:859)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:847)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:353)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
	at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:345)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:95)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)

system

WebStorm 2021.1.3
Build #WS-211.7628.25, built on June 30, 2021

Runtime version: 11.0.11+9-b1341.60 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: debugger.watches.in.variables=false, ide.balloon.shadow.size=15
Non-Bundled Plugins: com.github.lppedd.idea-conventional-commit (0.18.0), zielu.gittoolbox (203.5.10), mobi.hsz.idea.gitignore (4.1.0), com.crunch42.openapi (1.18), com.intellij.swagger (211.7142.14), izhangzhihao.rainbow.brackets (6.19)

Align template mode with context mode

The items arranger is created in this block of code.

val lookup = LookupManager.getInstance(project).createLookup(
  editor,
  LookupElement.EMPTY_ARRAY,
  "",
  LookupArranger.DefaultArranger()
) as LookupImpl

Exception on Auto-Suggest :: PhpStorm / Commit Changes screen

When writing a commit message in PhpStorm, I get the following error any time the auto-suggest list for types or footerTypes appears. (I've checked this a few times, and the only difference I've seen is the line number reference for ensureItemIterator (I've see Sequences.kt:269 and Sequences.kt:278.)

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @11f0a234)
	at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:97)
	at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:25)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:133)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
	at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:278)
	at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:265)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:716)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:746)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:737)
	at com.github.lppedd.cc.api.DefaultCommitTokenProvider.getCommitFooterValues(DefaultCommitTokenProvider.kt:77)
	at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:44)
	at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:27)
	at com.github.lppedd.cc.CCExtensionsKt$sam$i$java_util_concurrent_Callable$0.call(CCExtensions.kt)
	at com.intellij.openapi.application.ex.ApplicationUtil.lambda$null$1(ApplicationUtil.java:62)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:625)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:570)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$2(ApplicationUtil.java:60)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

I don't know if this would be helpful (say, if the issue is specific to my setup in some way), but here are the contents of my Help > About screen:

PhpStorm 2020.1
Build #PS-201.6668.153, built on April 13, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-59-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry:
    run.processes.with.pty=TRUE,
    debugger.valueTooltipAutoShowOnSelection=true,
    localHistory.daysToKeep=30,
    ide.tooltip.initialDelay=209,
    ide.balloon.shadow.size=0
Non-Bundled Plugins:
    com.github.lppedd.idea-conventional-commit,
    ru.adelf.idea.dotenv,
    me.mbolotov.cypress,
    intellij.prettierJS
Current Desktop: KDE

Make CoAuthors file path configurable

Hi there
First of all. Great work with this plugin.
I work in a Team with allot of projects. Since we try to work with Pair-Programming as much as possible almost every commit has a coauthor assigned to it. Thats why i would love to be able to configure the destination of the file that contains the known CoAuthors. If i could define the Path of the CoAuthors file i would only need to populate it once and i could reuse it for every project.
Thanks

Add better support for footer issue references

Currently, when autocompleting a footer token, a colon is always added. While this is the desired behavior in most cases, the conventional commit specification states that this should not be done, if followed by an issue reference, e.g. Closes #123:

Each footer MUST consist of a word token, followed by either a :<space> or <space># separator, followed by a string value (this is inspired by the git trailer convention).

~ Conventional Commit Spec, Point 8

Possible Implementation

First of all, when linting the commit message, a warning should be shown, if the footer's value starts with ": #". This could be paired with the option to auto-fix this, depending on whether the footer's value is an issue reference or plain text, to remove the colon or the '#`, respectively.

Additionally, an "issue reference" option could be added to the footer types settings. This should be turned on for Closes, Implements, and Refs. If turned on, " #" will be inserted after the token, instead of ": ". This should cover most cases, as issue refs are mostly used for those three.

Translate properties values to Chinese

I've created those new properties

cc.config.fileDialog.description=Only JSON files are allowed
cc.config.defaults.exportToPath=Export built-in defaults to path
cc.config.defaults.exportToPath.completed=Export completed correctly
cc.config.defaults.exportToPath.error=Could not write the file
cc.config.exportDialog.title=Select Export Path
cc.notifications.schema=Error reading custom defaults file. Using built-in ones.

@ymind ping, if you've got some time and you'd like to translate. Feedback on english strings is welcome too if necessary.

Display most recently used tokens when completing

As of now we display scopes which are strictly attached to a type.
Until we implement an independent extension which looks at the full VCS history, we can show the most recently used scopes without considering the inputted type. Obviously this mechanism is not precise, but it's still something worth adding.

It is important to highlight those items come from the (renamed) DefaultVcsCommitTokenProvider so we could display "Recently used" on the right.

A quick implementation shows this result:

image

Idea from #35
@Gerrit-K what do you think?

Commitlint compativility

Hey,

this is more of a feature request then a bug, but it would be awesome if this plugin could understand the .commitlintrc.json commitlint files.
Instead of having two files besides each other for projects.

greetings

Add support for IJ 2021.1 EAP

Plugin stopped working after upgrading to the latest EAP

IntelliJ IDEA 2021.1 EAP (Ultimate Edition)
Build #IU-211.4961.30, built on January 26, 2021
Runtime version: 11.0.9.1+11-b1257.1 x86_64
macOS 10.15.7

Support commit body and footer

One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a : or # separator, followed by a string value (this is inspired by the git trailer convention).

A footer’s token MUST use - in place of whitespace characters, e.g., Acked-by (this helps differentiate the footer section from a multi-paragraph body). An exception is made for BREAKING CHANGE, which MAY also be used as a token.

A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.

Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.

If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g., BREAKING CHANGE: environment variables now take precedence over config files.


"Support" means completion for the BREAKING CHANGE token is available in the right contexts, as per specification.

The : (colon) character will be automatically inserted and the caret will be placed one space after it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.