README.md 15.8 KB
Newer Older
F
Fatih Acet 已提交
1
# <img src="https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/logo.png" width="64" align="center" /> [GitLab VSCode Extension](https://gitlab.com/fatihacet/gitlab-vscode-extension)
F
Fatih Acet 已提交
2

F
Fatih Acet 已提交
3
[![Marketplace Version](https://vsmarketplacebadge.apphb.com/version/fatihacet.gitlab-workflow.svg)](https://marketplace.visualstudio.com/items?itemName=fatihacet.gitlab-workflow) [![Installs](https://vsmarketplacebadge.apphb.com/installs/fatihacet.gitlab-workflow.svg)](https://marketplace.visualstudio.com/items?itemName=fatihacet.gitlab-workflow) [![Downloads](https://vsmarketplacebadge.apphb.com/downloads/fatihacet.gitlab-workflow.svg)](https://marketplace.visualstudio.com/items?itemName=fatihacet.gitlab-workflow) [![Rating](https://vsmarketplacebadge.apphb.com/rating/fatihacet.gitlab-workflow.svg)](https://marketplace.visualstudio.com/items?itemName=fatihacet.gitlab-workflow)
F
Fatih Acet 已提交
4

F
Fatih Acet 已提交
5
This extension integrates GitLab to VSCode by adding a new GitLab sidebar where you can find issues and merge requests created by you or assigned to you. It also extends VSCode command palette and status bar to provide more information about your project.
F
Fatih Acet 已提交
6 7


F
Fatih Acet 已提交
8 9 10 11 12
## Screencast

[![video-cover](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/screencast-cover.jpg)](https://www.youtube.com/watch?v=XcxsF0lWBhA)


F
Fatih Acet 已提交
13 14
## Features

F
Fatih Acet 已提交
15 16 17 18
- See your issues and MRs on a dedicated panel in the VSCode sidebar. [Read more](#sidebar)
- See pipeline status, open MR and closing issue links in the status bar. [Read more](#status-bar).
- Automatically updates pipeline status on the status bar so you don't need to open GitLab to see your pipeline status.
- Advanced pipeline actions allow you to view pipeline on GitLab, create a new pipeline, retry or cancel current pipeline. [Read more](#pipeline-actions).
F
Fatih Acet 已提交
19 20
- Issue and MR search including simple and advanced search. [Read more](#advanced-search).
- View MR and closing issue on GitLab with a single click from your status bar.
F
Fatih Acet 已提交
21
- Create public, internal or private snippet from entire file or selection. [Read more](#create-snippet).
F
Fatih Acet 已提交
22
- Compare your branch with master and view changes on GitLab. [Read more](#compare-with-master).
F
Fatih Acet 已提交
23
- View active file on GitLab with highlighting active line number and selected text block. [Read more](#open-active-file).
F
Fatih Acet 已提交
24
- Validate GitLab CI configuration file `.gitlab-ci.yml`. [Read more](#validate-gitlab-ci-configuration).
F
Fatih Acet 已提交
25 26 27 28 29
- Open MR of current branch on GitLab.
- Open issues assigned to you on GitLab.
- Open MRs assigned to you on GitLab.
- Open pipeline on GitLab.
- Open project on GitLab.
30
- Open issue page to create a new issue.
F
Fatih Acet 已提交
31
- Open the merge request page to create a merge request.
F
Fatih Acet 已提交
32 33
- Set and remove your GitLab Personal Access Token. _Required step, see [Setup](#setup) section below._
- Supports multiple GitLab instances [Read more](#multiple-gitlab-instances).
F
Fatih Acet 已提交
34

F
Fatih Acet 已提交
35 36 37 38 39 40 41 42
## Experimental Features

Experimental features are behind a feature flag. To enable them, you can set `gitlab.enableExperimentalFeatures` to `true` in your VSCode settings.

#### View issue details and comments in VSCode

![_issues-in-vscode](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_issues-in-vscode.png)

F
Fatih Acet 已提交
43
GitLab Workflow allows you to view issue details and comments right in the VSCode. Click an issue link from the sidebar and VSCode will open a new tab to show the issue details. You can also comment to the issue from VSCode. Currently, replying to discussions are not supported.
F
Fatih Acet 已提交
44

J
Typos  
Justin Parker 已提交
45
Updating assignees and labels are also not implemented. However, you can use [GitLab Slash Commands](https://docs.gitlab.com/ee/integration/slash_commands.html) to perform actions directly from VSCode. For example, to assign an issue to `@fatihacet`, simply add a comment `/assign @fatihacet` inside VSCode.
46

F
Fatih Acet 已提交
47

F
Fatih Acet 已提交
48
## Setup
F
Fatih Acet 已提交
49

F
Fatih Acet 已提交
50
To use this extension, you need to create a GitLab Personal Access Token and give it to the extension.
F
Fatih Acet 已提交
51

F
Fatih Acet 已提交
52
##### Step 1: Create your Personal Access Token
53 54
- If you are using
  - GitLab.com [click to open Personal Access Tokens page](https://gitlab.com/profile/personal_access_tokens).
F
Fatih Acet 已提交
55
  - Self-hosted GitLab instance go to "Settings" and click "Access Tokens" on the left navigation menu
F
Fatih Acet 已提交
56 57
- On "Add a personal access token" form
  - Give a name to your token.
T
Tom Quirk 已提交
58
  - Select an expiry date.
F
Fatih Acet 已提交
59 60
  - Select "api" and "read_user" permissions.
  - Hit "Create personal access token" button.
F
Fatih Acet 已提交
61
- Copy the token. _Remember you won't be able to see the value of this token ever again for security reasons._
F
Fatih Acet 已提交
62

F
Fatih Acet 已提交
63 64 65
##### Step 2: Add token to GitLab Workflow Extension
- Open up Command Palette by pressing `Cmd+Shift+P`.
- Search for "GitLab: Set GitLab Personal Access Token" and hit Enter.
66
- Enter the URL to the Gitlab instance the PAT should apply to and hit Enter.
M
Matthias Wirtz 已提交
67
- Extension will ask for your PAT. Paste your PAT and hit Enter. _It won't be visible and accessible to others._
68 69 70
- If you want to connect to GitLab hosted on a custom domain, additionally set
  `gitlab.instanceUrl` in your user or workspace settings, otherwise the extension
  will try to connect to gitlab.com. See [Configuration Options](#configuration-options) for more information.
F
Fatih Acet 已提交
71

F
Fatih Acet 已提交
72
That's it. 🏁
F
Fatih Acet 已提交
73

F
Fatih Acet 已提交
74
You can start using this extension right away. If your project has a pipeline for last commit and a MR from your current branch, you should see them on VSCode status bar. 🎉
F
Fatih Acet 已提交
75

F
Fatih Acet 已提交
76 77 78 79 80 81 82 83 84
#### Multiple Gitlab instances

If you want to use multiple GitLab instances you may want to configure each workspace separately. See `gitlab.instanceUrl` config option in [Configuration Options](#configuration-options) section.


## Configuration options

**`gitlab.instanceUrl`** _(required: false, default: "https://gitlab.com")_

85
If you are using GitLab on a custom domain, you must add this to your user settings file. Example: `"gitlab.instanceUrl": "https://my-gitlab-domain.com"`
F
Fatih Acet 已提交
86 87 88

To enable Gitlab Workflow extension to work with different Gitlab instances, each token is assigned to a Gitlab instance URL. For the extension to selected the correct token for a specific workspace, the option [`gitlab.instanceUrl`](#configuration-options) can be used. This option can be set in the current workspace's `.vscode/settings.json` file.

89 90 91 92
**`gitlab.showStatusBarLinks`** _(required: false, default: true)_

If you don't want to see GitLab related links on the status bar, you can set this option to `false`. If you are using version 1.0.0 or above you can also find the same links in sidebar. You should restart your VSCode after updating this option.

F
Fatih Acet 已提交
93 94
**`gitlab.showIssueLinkOnStatusBar`** _(required: false, default: true)_

95
If you are not using GitLab's issue tracker, you can set this option to `false` to remove related issue link on the status bar. You should restart your VSCode after updating this option.
F
Fatih Acet 已提交
96

F
Fatih Acet 已提交
97 98 99 100
**`gitlab.showMrStatusOnStatusBar`** _(required: false, default: true)_

You can toggle visibility of MR link in your sidebar. You can always find MR link in GitLab Workflow sidebar. You should restart your VSCode after updating this option.

F
Fatih Acet 已提交
101 102
**`gitlab.ca`** _(required: false, default: null)_

F
Fatih Acet 已提交
103
If your self-hosted GitLab instance has a self-signed SSL certificate you would probably need to set this option in to point your certificate file. More discussion can be found [in this issue](https://gitlab.com/fatihacet/gitlab-vscode-extension/issues/26).
F
Fatih Acet 已提交
104

105 106 107 108 109 110 111 112
**`gitlab.cert`** _(required: false, default: null)_

If your self-hosted GitLab instance requires a custom cert/key pair you would probably need to set this option in to point your certificate file. Please also see `gitlab.certKey` option. More information [here](https://gitlab.com/fatihacet/gitlab-vscode-extension/merge_requests/29#note_132284448).

**`gitlab.certKey`** _(required: false, default: null)_

If your self-hosted GitLab instance requires a custom cert/key pair you would probably need to set this option in to point your certificate key file. Please also see `gitlab.cert` option. More information [here](https://gitlab.com/fatihacet/gitlab-vscode-extension/merge_requests/29#note_132284448).

F
Fatih Acet 已提交
113 114
**`gitlab.ignoreCertificateErrors`**  _(required: false, default: false)_

F
Fatih Acet 已提交
115
If you are using a self-hosted GitLab instance with no SSL certificate or having certificate issues and unable to use the extension you may want to set this option to `true` to ignore certificate errors. More information can be found [here](https://gitlab.com/fatihacet/gitlab-vscode-extension/issues/26#note_61312786).
F
Fatih Acet 已提交
116

F
Fatih Acet 已提交
117
> You can open User Settings file by pressing `Cmd+,` on Mac OS or following `Code > Preferences > User Settings`. You can simply add extension configuration values to your User Settings file. This won't break or change anything on your VSCode.
F
Fatih Acet 已提交
118

J
Julien Duponchelle 已提交
119 120
**`gitlab.remoteName`** _(required: false, default: null)_

121 122 123 124 125
The name of the git remote link corresponding to the GitLab repositiory with your MR and issues. If no setting is provided, the extension will detect it. For example: origin.

**`gitlab.pipelineGitRemoteName`** _(required: false, default: null)_

The name of the git remote link corresponding to the GitLab repositiory with your pipelines. If no setting is provided, the extension will detect it. For example: origin.
126

F
Fatih Acet 已提交
127 128 129 130 131 132

**`gitlab.enableExperimentalFeatures`**  _(required: false, default: false)_

To enable experimental features set this flag to `true`. List of experiemental features and details can be found [here](#experiemental-features)


F
Fatih Acet 已提交
133
## Usage
F
Fatih Acet 已提交
134
- Open up Command Palette by pressing `Cmd+Shift+P`.
F
Fatih Acet 已提交
135
- Search for `GitLab:` and you will see all the commands provided by the extension.
F
Fatih Acet 已提交
136 137

![https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/gitlab-vscode.png](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/gitlab-vscode.png)
F
Fatih Acet 已提交
138

F
Fatih Acet 已提交
139 140
![https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/pipeline-actions.png](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/pipeline-actions.png)

F
Fatih Acet 已提交
141

F
Fatih Acet 已提交
142
## Features in-depth
F
Fatih Acet 已提交
143

F
Fatih Acet 已提交
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173

### Sidebar
Extension will add a GitLab Workflow panel to sidebar of your VSCode. The dedicated panel will allow you to see the list of your issues and MRs. Also you will be able to see pipeline, MR and issue links for your current branch.

In the current version, clicking the links will open them on your default browser but the next version will allow you to interact with your issues and MRs right in your VSCode. With the upcoming versions, the extension will allow you to see the MR changes and discussions in VSCode.

![_sidebar.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_sidebar.gif)


### Pipeline actions
One of the real power features of this extension is pipeline actions. This feature can be accessible from the status bar by clicking the pipeline status text or command palette and allows you to,

- View the latest pipeline on GitLab
- Create a new pipeline for your current branch
- Retry the last pipeline
- Cancel the last pipeline

![_pipeline_actions.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_pipeline_actions.gif)


### Status bar
If your current project is a GitLab project, the extension will do the following things:

- Fetch pipeline of the last commit and show it on the status bar. Clicking this item will open the pipeline actions menu.
- Show open MR for current branch and show it on the status bar. Clicking this item will open MR on GitLab.
- Fetch closing issue of that MR and show it on the status bar. Clicking this item will open Issue on GitLab.

![_status_bar.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_status-bar.gif)


F
Fatih Acet 已提交
174 175
### Advanced Search
GitLab Workflow extension provides you two types of search. Basic and advanced search. Basic search is quick however advanced search is more powerful which allows you to filter issues by author, assignee, milestone, title etc.
F
Fatih Acet 已提交
176

F
Fatih Acet 已提交
177
To use the basic search, in the search input, you can type your search term and hit Enter. This will search issues/MRs against their title and description fields. Example: `Inconsistent line endings for HEX files` or `Pipelines should ignore retried builds`.
F
Fatih Acet 已提交
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195

You can perform advanced issue/MR search by using some predefined tokens. Full list below.

|Token|Description|Example|
|-|-|-|
|title|Search issues/MRs against their title and description. You don't need to add quotes around multiple words. See Important notes section.|discussions refactor|
|labels|Comma separated label list for multiple labels.|`labels: frontend, Discussion, performance`|
|label|To search with a single label. You can also have multiple `label` tokens.|`label: frontend` or `label:frontend label: Discussion`
|milestone|Milestone title without `%`.|`milestone: 9.5`|
|scope|Searches issues/MRs for the given scope. Values can be `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me`.|`scope: created-by-me` or `scope: assigned-to-me` or `scope: all`.|
|author|Username of the author without `@`.|`author: fatihacet`|
|assignee|Username of the assignee without `@`.|`assignee: timzallmann`|

**Examples**
- `title: new merge request widget author: fatihacet assignee: jschatz1 labels: frontend, performance milestone: 10.5`
- `title: multiple group page author: annabeldunstone assignee: timzallmann label: frontend`

**Important notes**
F
Fatih Acet 已提交
196
- `:` after the token name is necessary. `label :` is not a valid token name and may return parsing error. Hence `label:` should be used. However, space after the token name is optional. Both `label: frontend` and `label:frontend` is valid. This rule is valid for all tokens above.
F
Fatih Acet 已提交
197
- You don't need to add quotes around multiple words for `title` token. `title:"new merge request widget"` may return parsing error. `title: new merge request widget` should be used.
F
Fatih Acet 已提交
198
- You can have `labels` and `label` tokens at the same time. `labels: fronted discussion label: performance` is a valid query and all labels will be included in your search query. It's equal with `labels: fronted discussion performance`. You can also have multiple `label` tokens. `label: frontend label: discussion label: performance` is valid and equals to `labels: fronted discussion performance`.
F
Fatih Acet 已提交
199 200 201 202

![_advanced-search.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_advanced-search.gif)


F
Fatih Acet 已提交
203
### Create snippet
F
Fatih Acet 已提交
204
You can create a snippet from selection or entire file. You can also select visibility level of your snippet.
F
Fatih Acet 已提交
205 206 207 208

![_create-snippet.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_create-snippet.gif)


F
Fatih Acet 已提交
209 210 211 212 213
### Compare with master
You can see changes in your branch by comparing with `master` and see them on GitLab.

![_compare-with-master.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_compare-with-master.gif)

F
Fatih Acet 已提交
214
> Soon extension will support comparing your current branch with other branches.
F
Fatih Acet 已提交
215

F
Fatih Acet 已提交
216

F
Fatih Acet 已提交
217 218 219 220 221
### Open active file
This command allows you to see active file on GitLab. Extension sends active line number and selected text block to GitLab UI so you can see them highlighted.

![_open_active_file.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_open_active_file.gif)

F
Fatih Acet 已提交
222

F
Fatih Acet 已提交
223 224 225 226 227
### Validate GitLab CI Configuration
Using this command, you can quickly validate GitLab CI configuration.

![_validate-ci-config.gif](https://gitlab.com/fatihacet/gitlab-vscode-extension/raw/master/src/assets/_validate-ci-config.gif)

F
Fatih Acet 已提交
228

229
### Caveats and known issues
230
- The current version of the extension doesn't support multi-root workspaces. If you want to know more about limitations and read recent developments, please check [multi-root-workspace](https://gitlab.com/fatihacet/gitlab-vscode-extension/issues?scope=all&utf8=%E2%9C%93&state=all&label_name[]=multi-root-workspace) labeled issues.
231

F
Fatih Acet 已提交
232

F
Fatih Acet 已提交
233
-----
F
Fatih Acet 已提交
234 235 236


## Contribution
F
Fatih Acet 已提交
237
This extension is open source and [hosted on GitLab](https://gitlab.com/fatihacet/gitlab-vscode-extension). Contributions are more than welcome. Feel free to fork and add new features or submit bug reports.
F
Fatih Acet 已提交
238 239

[Here](https://gitlab.com/fatihacet/gitlab-vscode-extension/blob/master/CONTRIBUTORS.md) is the list of great people who contributed this project and make it even more awesome. Thank you all 🎉