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

Exporting defaults should warn in case of missing authorizations #8

Closed tad3j closed 4 years ago

tad3j commented 4 years ago

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?

lppedd commented 4 years ago

@tad3j hi! I think the problem is that you're trying to use the Schema file as the JSON defaults file. Use the "Export built-in defaults to path" feature to export the file, modify it, and than use that one.

lppedd commented 4 years ago

And what do you mean by "Export does nothing"? Are there errors in IDE console?

tad3j commented 4 years ago

I meant that IDE doesn't show any errors and file can't be found at specified location after I choose its location in plugin and click OK. Checking now if I can see anything in logs.

EDIT: got saving of file working by storing to "C:\Users\Me", but didn't work when storing to my project or C: root, so I guess there may be an issue with permissions.

Loading the exported file works as it should. The only small issue I notice that scope dropdown is never populated, although I see some types in json contain scopes.

lppedd commented 4 years ago

@tad3j thanks a lot for the info! I'll see what I can do about permissions, I think maybe what I could do is show a warning at least. Have you tried by starting it as Administrator?

Let me check the other one.

lppedd commented 4 years ago

The scope thing works correctly here. The exported file has scopes only for build, have you checked that one?

lppedd commented 4 years ago

I have checked file export and it's indeed a permissions issue. Starting IDEA as Administrator makes it work.

tad3j commented 4 years ago

@tad3j thanks a lot for the info! I'll see what I can do about permissions, I think maybe what I could do is show a warning at least. Have you tried by starting it as Administrator?

Let me check the other one.

Np. I haven't, I assumed that it will work that way, since writing to a folder where user has permission works.

If nothing else maybe it may be useful to add a note to readme about it, so new users won't be confused.

The scope thing works correctly here. The exported file has scopes only for build, have you checked that one?

I can see that file content is read when I'm under settings: image

But I can't see the scopes on commit screen: image

lppedd commented 4 years ago

@tad3j it seems you're using another plugin too, that commit window isn't standard

tad3j commented 4 years ago

Hm...I think it is standard, I was just showing the plugin popup (to show that chore/build type has no scopes in dropdown).

Here is the full commit window: image

What I've noticed is that on commit screen plugin is still using default json, but on settings external json is used. I've tried running WebStorm as administrator but doesn't solve it. image

EDIT: That's what I have in json, but description on commit screen is different.

lppedd commented 4 years ago

@tad3j that windows come from an external plugin, I know that because I've used it too.

tad3j commented 4 years ago

Ah, I'm so sorry. :) It's https://plugins.jetbrains.com/plugin/9861-git-commit-template that I've installed before this plugin. Autocompletion works perfect!

lppedd commented 4 years ago

@tad3j no problem. I made this plugin explicitly to ERASE that one hahaha

tad3j commented 4 years ago

Great attempt in doing so. :)

I think this 2 improvements would make it even more usable:

  1. template support for long description, breaking changes and closed issues (so instead of stopping at "short description", you continue with template. In case that user doesn't need these extra fields he can stop template by pressing escape)
  2. option to switch between modes (autocomplete vs template) on the fly (Jetbrains IDE's allow that for code completion) - although can't imagine a user friendly way to do it though

Good luck!

lppedd commented 4 years ago

@tad3j template one is feasible, the other I prefer to keep it simple :)

lppedd commented 4 years ago

Fixed with commit 588374ea5f97821259044434d9bc6c6f0cf6c299

I'll open another issue for the template enhancement soon.