wakatime / jetbrains-wakatime

IntelliJ IDEA, PyCharm, RubyMine, PhpStorm, AppCode, AndroidStudio, Goland, Rider, & WebStorm plugin for quantifying your coding.
https://wakatime.com/intellij-idea
BSD 3-Clause "New" or "Revised" License
1.14k stars 168 forks source link

Use git remote as project instead of repo folder name #249

Closed szczepaan closed 1 year ago

szczepaan commented 1 year ago

Is it possible to change the plugin to get remote URL to be default project name, or maybe full path to the project name. If so how to do it? I'm looking for a scenario where no local changes are needed by the developer.

The problem is that many projects can have the same name, so its impossible to identify them just by the project name on git.

alanhamlett commented 1 year ago

You have many git repos with the same name? Historically we solved this by creating a .wakatime-project file in the repo to customize the project name. Git repo takes precedence, then we fall back to the IDE's solution/project name if the Git repo isn't detected. That's to standardize the project name across all IDEs including ones that don't know about the Jetbrains IDE project.

For your use case, we could add a setting to ~/.wakatime.cfg that changes the default behavior. I'm not aware of a remote URL in Jetbrains projects. Do you mean the Git remote?

szczepaan commented 1 year ago

@alanhamlett

You have many git repos with the same name?

I think it's a common case when repos are called popular names like cms, android, etc. for example in some project groups.

Do you mean the Git remote?

yes

Can You tell me if I understood correctly the project name is calculated with this priorities

  1. .wakatime-project file (controlled by the user)
  2. repo name if .wakatime-project is detected.

?

New setting in .wakatime.cfg file wouldn't solve the problem, because the problem is repo name itself, that why I suggested git remote as default project name (maybe setting for that, if it should be git remote or repo folder name (like now))

Please let me know if this feature could be added ?

Kind regards

alanhamlett commented 1 year ago

2. repo name if .wakatime-project is detected.

The repo name is always used when no .wakatime-project file is detected. That file is just a way to overwrite the detected project with a custom user-defined project name.

We can definitely add this feature, so if enabled the project name would be for ex: wakatime/jetbrains-wakatime because github.com:wakatime/jetbrains-wakatime is too long imo.

szczepaan commented 1 year ago

yes wakatime/jetbrains-wakatime that's exactly what I'm thinking about. It would be great. Please do let me know when it's available.

Many thanks

alanhamlett commented 1 year ago

Restarting your IDE should get the updated wakatime-cli, then add these lines to your ~/.wakatime.cfg file to use the Git Remote as your project name for all projects:

[git]
project_from_git_remote = true
szczepaan commented 1 year ago

hello, thank You, will it also work in Android Studio etc?

Kind regards

alanhamlett commented 1 year ago

Yes, the ~/.wakatime.cfg is used by all Jetbrains WakaTime plugins including Android Studio.