PhpStorm 2022.3 Help

Manage tasks and contexts

When you work on a project, you can organize your work in smaller tasks that you need to complete.

These can be tasks that you set yourself. In PhpStorm, you can divide a large piece of work into smaller tasks and associate them with changelists.

These also can be tasks coming from your issue tracker. For example, you can work with tasks and bugs assigned to you directly from PhpStorm. To be able to do so, connect the IDE and your tracker account.

Configure integration with issue trackers

PhpStorm supports integration with:

Connect the IDE to your tracker

  1. In the Settings dialog Ctrl+Alt+S, select Tools | Tasks | Servers.

  2. Click the Add button and select the necessary issue tracker from the list.

  3. Enter connection details. Note that settings differ depending on your issue tracker.

    Normally, you have to specify the server URL and connection credentials: Username and Password.

    In some cases, you need to enter an API token instead of your password. For example, if you're connecting your IDE to YouTrack, the Password field is replaced with Token. For more information, refer to Manage Permanent Tokens.

  4. Select the Share URL option to allow access to the server for other members of your team. When this option is enabled, a server URL and its type are saved to the .idea/misc.xml file, which can be shared between development team members through version control.

  5. Click Proxy settings if you want to access the server via a proxy server. You can find more information on proxy settings in the HTTP Proxy section.

    Setting on the General tab of the Servers page
  6. On the Commit Message tab, you can enable adding a commit message for a changelist and configure a message template.

    Configuring a commit message on the Commit Message tab
  7. On the Server Configuration tab, configure advanced parameters for connecting to your issue tracker.

    This tab is only available for some trackers (for example, for trackers that are not supported out of the box).

Server Configuration tab parameters

Item

Description

Login URL

The resource for authentication. The IDE sends requests to this resource every time before retrieving the list of issues from the server, for example: {serverUrl}/rest/user/login?login={username}&password={password}.

The field is disabled if you have selected the Use HTTP authentication checkbox on the General tab.

Tasks List URL

The resource for retrieving the list of issues from the server, for example: {serverUrl}/rest/api/2/search.

Single Task URL

The resource for retrieving detailed information about an issue by its ID, for example: {serverUrl}/rest/api/2/issue/{id}.

This field is optional unless you select the Each task in separate request checkbox.

GET or POST

Select the necessary type of HTTP requests.

Each task in separate request

Enabling this option allows the IDE to send several requests in order to retrieve the list of issues with their IDs first, and then to obtain detailed information on each issue separately using the resource specified in the Single Task URL field.

This option is for issue trackers with restricted REST APIs that cannot send all the required information in a single response.

Response type

Select the format in which your issue tracker responses: XML for XPath, JSON for JSONPath, or Text for regular expressions.

The table of selectors

Selectors allow you to specify which information about an issue is going to be retrieved from the server response.

tasks

The path to the list of issues in the server response. This field is mandatory.

id

The path to the issue ID in the server response. This field is mandatory.

summary

The path to the issue title in the server response. This field is mandatory.

The Server Configuration tab shown in the settings

Specify additional integration options

  1. In the Settings dialog Ctrl+Alt+S, select Tools | Tasks.

  2. Configure the necessary options:

    • Changelist name format: when you open or create a new task, PhpStorm prompts you to create a new changelist associated with this task. In this field, you can specify a template that will be used for generating names for new changelists.

      Click the Add placeholder button to select placeholders from the list.

    • Feature branch name format: when you create or open a new task, PhpStorm prompts you to create a new feature branch. In this field, you can configure the template for generating names of new feature branches.

      Click the Add placeholder button to select placeholders from the list.

      Use the Lowercased and Replace spaces with options to configure prompted feature branch names.

      These settings are useful if your IDE is integrated with an issue tracker. For example, the DSGN-0001 Add new icon task name is going to be converted to the dsgn-0001add-new-icon feature branch name.

    • Task history length: the number of tasks that PhpStorm stores.

    • Save context on commit: every time you commit changes, PhpStorm creates a new closed local task that keeps files, bookmarks, and breakpoints that you have worked with. This way, you can quickly restore all tabs associated with the task any time in the future.

    • Enable issue cache: optimize synchronization between PhpStorm and your issue tracker. Synchronization is especially recommended if you work with "slow" issue tracking systems.

      PhpStorm caches the list of issues loaded from the tracker and updates them repeatedly. You can specify how many issues should be cached and how often PhpStorm should update information about them.

      Task settings

Tasks

In PhpStorm, there are two types of tasks:

  • Tasks that were loaded to PhpStorm from your issue tracker. These are tracker tasks. Tracker tasks are linked with the corresponding issues in your issue tracker. This allows you to monitor and update them directly from PhpStorm.

  • Tasks that were originally created in PhpStorm. These are local tasks. Local tasks are not related to an issue tracker.

If you have created at least one task of either type, a list called task combo becomes available on the toolbar.

Open tracker tasks

Tracker tasks are loaded to your PhpStorm once you connect it to your issue tracker.

  1. From the main menu, select Tools | Tasks & Contexts | Open Task Alt+Shift+N, or click the task combo on the toolbar.

  2. Select the necessary task from the list.

  3. In the Open Task dialog, you can update issue state.

    If you want to close all tabs that are currently opened in the editor, select the Clear current context checkbox.

  4. In the VCS operations section, you can create a new changelist, select an existing branch to which you want to contribute, or create a new one.

    You can also shelve the current changes to return to them later.

    Opening a tracker task

Create local tasks

In PhpStorm, you can create local tasks that do not originate from your issue tracker.

  1. From the main menu, select Tools | Tasks & Contexts | Open Task. You can also use the task combo or press Alt+Shift+N.

  2. In the Enter task name dialog, select Create New Task.

  3. Enter a name for the new task.

    If you want to close all tabs that are currently opened in the editor, select the Clear current context checkbox.

  4. In the VCS operations section, you can create a new changelist, select an existing branch to which you want to contribute, or create a new branch.

    You can also shelve the current changes to return to them later.

View task description

When you are choosing a task to switch to, the list of tasks shows only task IDs. This information is not always sufficient, because it reflects neither the steps that lead to the problem nor the related discussion.

  1. Go to Tools | Tasks & Contexts | Open Task.

  2. Open the necessary task and press Ctrl+Q to open the task description in PhpStorm, or Alt+Shift+B to view the description in a browser.

Alternatively, go to Tools | Tasks & Contexts and click Show 'task ID' Description or Open 'task ID' in Browser.

View closed tasks

A closed local task is a task that is not associated with a changelist if the entire project or the affected directory is under a version control.

A closed tracker task is a task that has the closed status in your issue tracker.

  1. Click the task combo and then click Open Task.

  2. Select the Include closed tasks checkbox, or press Alt+Shift+N.

Close tasks

  • Go to Tools | Tasks & Contexts and click Close Active Task.

This will close the current context in the PhpStorm. Select the necessary checkboxes to commit changes and, optionally, merge the branch that was created. For tracker tasks, you can also change their state. The new state will be propagated to your issue tracker.

Closing a task

Delete tasks

If you do not need a task to appear in PhpStorm, you can remove it from the list of tasks.

  1. Click the task combo on the main toolbar.

  2. Select one or more tasks you want to delete.

    Use Shift (for adjacent items) or Ctrl (for non-adjacent items) keys for multiple selection.

  3. Click the right-arrow button, and select Remove.

When you are deleting tracker tasks, you remove them from the IDE. They will remain in your issue tracker. Local tasks in this case will be completely removed, since they are not connected to your issue tracker.

Time tracking

With PhpStorm, you can track the amount of time you spend on a task working in the editor. For local tasks, this information might be helpful if you want to know how much time exactly you need to compete a task as you work on a project.

For tracker tasks, this option is useful if your issue tracker configuration requires that you log the time you spend on tasks. In this case, you can send your time log from PhpStorm to the tracker.

Enable time tracking

  1. Press Ctrl+Alt+S to open the IDE settings and select Tools | Tasks | Time Tracking.

  2. Select the Enable Time Tracking checkbox.

  3. (Optionally) Change the Suspend delay value.

    Here you can specify how long you have to stay inactive before the task will be considered suspended.

Track time

  • Click Auto Mode for automatic time logging.

    For manual time tracking, click Start time for the active task. To stop manual time tracking, click Stop time for the active task.

    Time Tracking tool window with two ongoing tasks

Send time log to tracker

  1. Click Post work item to bugtracker Export an item to the bug tracker in the Time Tracking tool window.

  2. Specify time interval you want to log and add a comment if necessary. Click OK.

    Send the log to the tracker

Contexts

A context is a set of bookmarks, breakpoints, and tabs opened in the editor. Contexts are linked to tasks, but you can work with contexts without associating them with specific tasks.

Having separate contexts lets you work on several things and switch between them without mixing the changes.

Save a context

  1. From the main menu, select Tools | Tasks & Contexts | Save Context.

  2. In the Save Context dialog, enter the name of the context and click OK.

Add items to existing contexts

  1. From the main menu, select Tools | Tasks & Contexts | Load Context.

  2. Add the necessary items (bookmarks or breakpoints) or open the necessary files and save the context: Tools | Tasks & Contexts | Save Context.

Switch between contexts

When you switch between tasks, the IDE automatically switches related contexts. However, if the contexts that you work with are not associated with tasks, you can switch between them manually.

  1. From the main menu, select Tools | Tasks & Contexts | Load Context.

  2. In the Load Context popup, select the necessary context from the list.

    Alternatively, click the right arrow and select Load.

    Loading a context

Clear a context

  • To clear the current context without loading another one, select Tools | Tasks & Contexts| Clear Context from the main menu, or press Alt+Shift+X.

Delete a context

When a task is finished, or if you do not need a context anymore, you can remove it.

  1. From the main menu, select Tools | Tasks & Contexts | Load Context.

  2. In the Load Context popup, click the right arrow and select Remove.

Last modified: 07 February 2023