lppedd / idea-conventional-commit

Context and template-based completion for conventional/semantic commits.
https://plugins.jetbrains.com/plugin/13389-conventional-commit
MIT License
327 stars 19 forks source link

Don't lowercase recently used tokens in autocompletion #80

Closed OptimumDev closed 2 years ago

OptimumDev commented 2 years ago

Hi! Great plugin, I love it)

I'm experimenting on what to use in scope field and currently using either couple of words (written in camel case) describing task's subject (for example "EntityFramework" or "MissedCalls") or JIRA's task number (capital letters + numbers, for example "ABS-123" or "CORS-2284"). But when I's trying to use autocompletion for scope, everything there is in lowercase.

image image

Is it possible to preserve case there?

lppedd commented 2 years ago

Hi! This is a bug in RecentCommitTokenProvider

https://github.com/lppedd/idea-conventional-commit/blob/072d1471f17e0b66616bf8773a67ba8218fc6043/src/main/kotlin/com/github/lppedd/cc/vcs/RecentCommitTokenProvider.kt#L67

I'm re-implementing the handling of recent tokens, so you can expect this issue to be solved in the next release, next week!

lppedd commented 2 years ago

Also, I'm planning on adding new providers for GitHub/Jira issue trackers. I'm still trying to define how to deliver them. I'd like to have the core plugin (this one) always open-source, while the additional providers as another "product".

OptimumDev commented 2 years ago

Wow, great news, thanks!

lppedd commented 2 years ago

Wow, great news, thanks!

You can see an example for GitHub here. The concept is the same for any other issue trackers. https://github.com/lppedd/idea-conventional-commit-github/issues/1#issue-715540797

lppedd commented 2 years ago

Quick update relating to this issue, and #73.

I've cleaned up the exposed API, along with simplifying the handling of completion tokens. So it will be one big commit. Probably the update will be ready by the end of the week.

lppedd commented 2 years ago

Futher update.

What I'm doing now is re-evaluating the PSI layer. Basically this is the what happens when you invoke completion:

  1. A CommitTokenProvider is called
  2. For each token, a LookupElement is created
  3. For each LookupElement, an associated FakePsiElement is created, which contains the original CommitToken from step 1
  4. (Optional) the FakePsiElement is used to provide the CommitToken to the DocumentationProvider

Now, this makes sense up to a certain point. ConventionalCommit isn't a language yet, so it doesn't need to have a PSI layer. What I'm trying to do instead is:

  1. A CommitTokenProvider is called
  2. For each token, a LookupElement is created, which contains the original CommitToken from step 1
  3. (Optional) When DocumentationProvider is called, the LookupElement is asked for the CommitToken, and a FakePsiElement is created on-the-fly.

Less code, better distribution of responsibilities.

lppedd commented 2 years ago

New settings' option "Prioritize recently used tokens".

image

Now the token's documentation is always displayed.

image

Humorloos commented 2 years ago

For me after updating to 0.21.0, recently used tokens in autocompletion still don't preserve their case. Could it be that this bug is still there?

lppedd commented 2 years ago

@Humorloos hi! If I may ask, could you post a couple screenshot to show the issue? It's purely to understand better which tokens you're using.

Humorloos commented 2 years ago

@lppedd Hi! Thanks for fast reply! Of course, here is a screenshot of my git log (see last commit message where I used scope "runConfigurations"): image And here is a screenshot of my commit window, where I want to use this scope again and conventional commit autocompletes with all lowercase: image

lppedd commented 2 years ago

@Humorloos yep, there was still the issue with the VCS provider. See commit 3a334d20f693664d624f964fc19f04ce77cea607