'WakaTime project map settings WIndows 11 and VSCode

I want to configure my projects in the wakatime.cfg file in the project map section. I am using Windows 11 and VSCode. I already tried some things, but it's not working. In the WakaTime dashboard, it says “Unknown Project” no matter what I do.

My project paths are like

  • C:\Users\User\OneDrive - XXX\projects\test1 (Test Project 1)
  • C:\Users\User\OneDrive - XXX\projects\test2 (Test Project 2)
  • C:\Users\User\projects\project-1 (Project X)
  • C:\Users\User\projects\project-2 (Project Y)

How can I configure WakaTime to use these paths and names for my WakaTime dasboard?



Solution 1:[1]

In your ~/.wakatime.cfg:

[projectmap]
projects/test1 = Test Project 1
^C:/Users/User/OneDrive - XXX/projects/test1(\d+)/ = project{0}
projects/test2 = Test Project 2
^C:/Users/User/OneDrive - XXX/projects/test2(\d+)/ = project{0}

Alternatively:

Add a .wakatime-project file in each project folder, and inside that file, add that project's name

C:\Users\User\OneDrive - XXX\projects\test1
.wakatime-project (contains the text: Test Project 1)
C:\Users\User\OneDrive - XXX\projects\test2
.wakatime-project (contains the text: Test Project 2)

Why?

The FAQ states:

WakaTime detects the project’s name these 3 ways:

  1. Revision control software (git init)

  2. A .wakatime-project file inside your root project folder. Type the project’s name as the first line of your .wakatime-project file and any future coding inside that folder will use the new project name.

  3. A [projectmap] section in your ~/.wakatime.cfg file matching a directory path.

[projectmap]
projects/foo = new project name
^/home/user/projects/bar(\d+)/ = project{0}

If that fails, rename OneDrive - XXX to onedrive_xxx

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tgrrr