Skip to content

natterstefan/vscode-toggl-extension

Repository files navigation

Toggl Extension for VSCode

Build Status Marketplace Version Installs downloads

Track your working hours with Toggl directly in Visual Studio Code ⌚

Features and Commands

Commands

  • toggl.startEntry: starts a new entry on toggl.com with the provided input
  • toggl.startExistingEntry starts an existing entry on toggl
  • toggl.stopEntry: stops the current entry
  • toggl.openToggl: opens toggl.com in the browser
  • toggl.fetchToggl: fetch current toggl entry from toggl.com

Features

  • add new entries or choose from existing entries from your toggl account
  • text for new entry can be selected in editor (just select the text and execute the "Toggl: Start with new entry." command)
  • status bar shows current task and opens toggl.com when clicked
  • clicks on the status bar can execute custom command (see toggl.statusBarCommand setting below)
  • polling: fetches data periodically from toggl to show the current task in the status bar

Extension Settings

Currently the extension does provide the following settings:

  • toggl.apiKey: your private Toggl API key
  • toggl.defaultProjectId: all created tasks will use this as assigned project. You can get the id from the projects overview. Simply select the project and obtain the id from the url. Example: the id of https://www.toggl.com/app/projects/xxxxx/edit/12345678 would be 12345678
  • toggl.pollingTimeout: timeout between polling intervals, when the extension fetchs the latest current task from toggl. In order to not hit toggl's rate limit you cannot set it below 3 seconds (default: 3).
  • toggl.maxChars: Max. number of chars of the entry title shown in the status bar (default: 50).
  • toggl.statusBarCommand: Choose command to be executed when Toggl status bar item is clicked (default: toggl.openToggl).

Development & Contribution

Requirements

node ^12.12.0
vscode ^1.27.1

How to develop

In order to run the VS Code in debugger mode execute the View: Show Debug command and start the Extension task (see configuration in .vscode/launch.json).

A new VS Code Window in debugger mode will open. When you changed something in the code, you have to execute Reload Window to see the changes.

A guide about "Creating a VS Code Extension" can be found here.

How to test

Either open the debug tab in your VS Code and start the Extension Test task, or run npm t in the terminal. When you run it in the terminal, make sure no other VS Code instance is running.

Jest is used for testing, and the implementation is inspired by the Unibeautify/vscode package.

Helpful links

Tutorials

Configuration and API

Commands

Publishing

Simple execute the commands below or read more about Publishing first.

npx vsce package
npx vsce publish

Tools

I have not yet tested these tools, but I'll keep them here for the future.

Todos and Ideas

There are some further ideas and tasks left to make this extension better. You can take a look at the projects tab to see what I have in mind, planned and what is still left. Feel free to contribute! 💪

Licence

Apache 2.0

This extension is not affiliated, associated, authorized, endorsed by or in any way officially connected to Toggl (toggl.com).

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Stefan Natter

💻 📖 🤔 ⚠️

Pavel Suk

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!