debian-mirror-gitlab/doc/user/project/web_ide/index.md

463 lines
21 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
stage: Create
group: Editor
2022-03-02 08:16:31 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-10-24 23:57:45 +05:30
---
2021-03-11 19:13:27 +05:30
# Web IDE **(FREE)**
2018-05-09 12:01:36 +05:30
2022-03-02 08:16:31 +05:30
The Web Integrated Development Environment (IDE) editor streamlines the process
to contribute changes to your projects, by providing an advanced editor with
commit staging.
2018-05-09 12:01:36 +05:30
## Open the Web IDE
2021-12-11 22:18:48 +05:30
Use the <kbd>.</kbd> [keyboard shortcut](../../shortcuts.md) to open the Web IDE.
You can also open the Web IDE when viewing a file, from the repository file list,
2021-11-11 11:23:49 +05:30
and from merge requests:
- *When viewing a file, or the repository file list* -
1. In the upper right corner of the page, select **Edit in Web IDE** if it is visible.
1. If **Edit in Web IDE** is not visible:
1. Select the **(angle-down)** next to **Edit** or **Gitpod**, depending on your configuration.
1. Select **Edit in Web IDE** from the list to display it as the editing option.
1. Select **Edit in Web IDE** to open the editor.
- *When viewing a merge request* -
1. Go to your merge request, and select the **Overview** tab.
2021-11-18 22:05:49 +05:30
1. Scroll to the widgets section, after the merge request description.
2021-11-11 11:23:49 +05:30
1. Select **Edit in Web IDE** if it is visible.
1. If **Edit in Web IDE** is not visible:
1. Select the **(angle-down)** next to **Open in Gitpod**.
1. Select **Open in Web IDE** from the list to display it as the editing option.
1. Select **Open in Web IDE** to open the editor.
2018-05-09 12:01:36 +05:30
2018-11-08 19:23:39 +05:30
## File finder
2018-05-09 12:01:36 +05:30
2018-11-08 19:23:39 +05:30
The file finder allows you to quickly open files in the current branch by
2021-01-29 00:20:46 +05:30
searching for fragments of the file path. The file finder is launched using the keyboard shortcut
2021-03-11 19:13:27 +05:30
<kbd>Command</kbd>+<kbd>p</kbd>, <kbd>Control</kbd>+<kbd>p</kbd>, or <kbd>t</kbd>
2021-01-29 00:20:46 +05:30
(when editor is not in focus). Type the filename or file path fragments to
start seeing results.
## Command palette
You can see all available commands for manipulating editor content by pressing
2021-03-08 18:12:59 +05:30
the <kbd>F1</kbd> key when the editor is in focus. After that, the editor displays
a complete list of available commands for
2021-01-29 00:20:46 +05:30
manipulating editor content. The editor supports commands for multi-cursor
editing, code block folding, commenting, searching and replacing, navigating
editor warnings and suggestions, and more.
Some commands have a keyboard shortcut assigned to them. The command palette
displays this shortcut next to each command. You can use this shortcut to invoke
the command without having to select it in the command palette.
![Command palette](img/command_palette_v13_6.png)
2018-11-08 19:23:39 +05:30
2019-07-07 11:18:12 +05:30
## Syntax highlighting
2019-02-15 15:39:39 +05:30
2021-03-08 18:12:59 +05:30
As expected from an IDE, syntax highlighting for many languages in
2021-01-03 14:25:43 +05:30
the Web IDE makes your direct editing even easier.
2019-02-15 15:39:39 +05:30
The Web IDE currently provides:
2019-07-07 11:18:12 +05:30
- Basic syntax colorization for a variety of programming, scripting and markup
2020-04-08 14:13:33 +05:30
languages such as XML, PHP, C#, C++, Markdown, Java, VB, Batch, Python, Ruby,
2019-07-07 11:18:12 +05:30
and Objective-C.
- IntelliSense and validation support (displaying errors and warnings, providing
smart completions, formatting, and outlining) for some languages. For example:
2020-04-08 14:13:33 +05:30
TypeScript, JavaScript, CSS, LESS, SCSS, JSON, and HTML.
2019-02-15 15:39:39 +05:30
2019-07-07 11:18:12 +05:30
Because the Web IDE is based on the [Monaco Editor](https://microsoft.github.io/monaco-editor/),
you can find a more complete list of supported languages in the
2020-07-28 23:09:34 +05:30
[Monaco languages](https://github.com/Microsoft/monaco-languages) repository. Under the hood,
Monaco uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for syntax highlighting.
If you are missing Syntax Highlighting support for any language, we prepared a short guide on how to [add support for a missing language Syntax Highlighting.](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/ide/lib/languages/README.md)
2019-02-15 15:39:39 +05:30
2020-11-24 15:15:51 +05:30
### Themes
2021-04-17 20:07:23 +05:30
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2389) in GitLab 13.0.
2020-11-24 15:15:51 +05:30
> - Full Solarized Dark Theme [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/219228) in GitLab 13.1.
2021-04-17 20:07:23 +05:30
> - Full [Solarized Light](https://gitlab.com/gitlab-org/gitlab/-/issues/221035) and [Monokai](https://gitlab.com/gitlab-org/gitlab/-/issues/221034) Themes introduced in GitLab 13.6.
2020-11-24 15:15:51 +05:30
2021-04-17 20:07:23 +05:30
All the themes GitLab supports for syntax highlighting are applied to the Web IDE's entire screen.
2020-11-24 15:15:51 +05:30
You can pick a theme from your [profile preferences](../../profile/preferences.md).
2021-04-17 20:07:23 +05:30
| Solarized Dark Theme | Dark Theme |
|-------------------------------------------------------------|-----------------------------------------|
| ![Solarized Dark Theme](img/solarized_dark_theme_v13_1.png) | ![Dark Theme](img/dark_theme_v13_0.png) |
2020-11-24 15:15:51 +05:30
2021-04-29 21:17:54 +05:30
## Highlight lines
WebIDE is built with the [Web Editor](../repository/web_editor.md). This enables WebIDE to share the
same core features for highlighting and linking to particular lines in the edited files
[described for the Web Editor](../repository/web_editor.md#highlight-lines).
2020-11-24 15:15:51 +05:30
## Schema based validation
2020-10-24 23:57:45 +05:30
2021-12-11 22:18:48 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218472) validation based on predefined schemas in GitLab 13.2 [with a flag](../../../administration/feature_flags.md) named `schema_linting`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available for your entire instance, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named `schema_linting`.
This feature cannot be enabled or disabled per-project.
On GitLab.com, this feature is available.
You should not use this feature for production environments.
2020-10-24 23:57:45 +05:30
The Web IDE provides validation support for certain JSON and YAML files using schemas
2021-01-03 14:25:43 +05:30
based on the [JSON Schema Store](https://www.schemastore.org/json/).
2020-10-24 23:57:45 +05:30
2020-11-24 15:15:51 +05:30
### Predefined schemas
2020-10-24 23:57:45 +05:30
2020-11-24 15:15:51 +05:30
The Web IDE has validation for certain files built in. This feature is only supported for
the `*.gitlab-ci.yml` files.
### Custom schemas **(PREMIUM)**
2020-05-24 23:13:21 +05:30
2021-12-11 22:18:48 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/226982) in GitLab 13.4.
2020-05-24 23:13:21 +05:30
2020-11-24 15:15:51 +05:30
The Web IDE also allows you to define custom schemas for certain JSON/YAML files in your project.
You can do so by defining a `schemas` entry in the `.gitlab/.gitlab-webide.yml` file inside the
repository's root. Here is an example configuration:
2020-05-24 23:13:21 +05:30
2020-11-24 15:15:51 +05:30
```yaml
schemas:
- uri: https://json.schemastore.org/package
match:
- package.json
- uri: https://somewebsite.com/first/raw/url
match:
- data/release_posts/unreleased/*.{yml,yaml}
- uri: https://somewebsite.com/second/raw/url
match:
- "*.meta.json"
```
2020-05-24 23:13:21 +05:30
2020-11-24 15:15:51 +05:30
Each schema entry supports two properties:
2021-03-08 18:12:59 +05:30
- `uri`: please provide an absolute URL for the schema definition file here.
The schema from this URL is loaded when a matching file is open.
- `match`: a list of matching paths or glob expressions. If a schema matches a
particular path pattern, it is applied to that file. Please enclose the pattern
in quotes if it begins with an asterisk (`*`), it's be applied to that file.
If a pattern begins with an asterisk (`*`), enclose it in quotation marks.
Otherwise, the configuration file is not valid YAML.
2020-05-24 23:13:21 +05:30
2020-06-23 00:09:42 +05:30
## Configure the Web IDE
2022-03-02 08:16:31 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23352) in GitLab Free 13.1.
2020-06-23 00:09:42 +05:30
The Web IDE supports configuration of certain editor settings by using
[`.editorconfig` files](https://editorconfig.org/). When opening a file, the
Web IDE looks for a file named `.editorconfig` in the current directory
and all parent directories. If a configuration file is found and has settings
2021-01-03 14:25:43 +05:30
that match the file's path, these settings are enforced on the opened file.
2020-06-23 00:09:42 +05:30
The Web IDE currently supports the following `.editorconfig` settings:
- `indent_style`
- `indent_size`
- `end_of_line`
- `trim_trailing_whitespace`
- `tab_width`
- `insert_final_newline`
2020-04-08 14:13:33 +05:30
## Commit changes
2018-11-08 19:23:39 +05:30
2022-03-02 08:16:31 +05:30
> - Starting with [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/issues/33441), files are automatically staged.
> - In [GitLab 12.9](https://gitlab.com/gitlab-org/gitlab/-/issues/196609), support for staging files was removed to prevent loss of unstaged data. All of your current changes must be committed or discarded.
2018-11-08 19:23:39 +05:30
2022-03-02 08:16:31 +05:30
After making your changes, select **Commit** on the bottom-left to
2020-04-08 14:13:33 +05:30
review the list of changed files.
2018-05-09 12:01:36 +05:30
2021-03-08 18:12:59 +05:30
After you have finalized your changes, you can add a commit message, commit the
2020-04-08 14:13:33 +05:30
changes and directly create a merge request. In case you don't have write
2021-01-03 14:25:43 +05:30
access to the selected branch, you see a warning, but can still create
2019-12-04 20:38:33 +05:30
a new branch and start a merge request.
2022-03-02 08:16:31 +05:30
To discard a change in a particular file, select **Discard changes** on that
file in the changes tab. To discard all the changes, select the trash icon on the
2020-04-08 14:13:33 +05:30
top-right corner of the changes sidebar.
2021-04-29 21:17:54 +05:30
![Commit changes](img/commit_changes_v13_11.png)
2018-05-09 12:01:36 +05:30
2018-11-08 19:23:39 +05:30
## Reviewing changes
2018-05-09 12:01:36 +05:30
Before you commit your changes, you can compare them with the previous commit
2020-04-08 14:13:33 +05:30
by switching to the review mode or selecting the file from the list of changes.
2018-05-09 12:01:36 +05:30
An additional review mode is available when you open a merge request, which
shows you a preview of the merge request diff if you commit your changes.
2018-11-08 19:23:39 +05:30
## View CI job logs
2019-09-30 21:07:59 +05:30
You can use the Web IDE to quickly fix failing tests by opening
the branch or merge request in the Web IDE and opening the logs of the failed
2019-09-04 21:01:54 +05:30
job. You can access the status of all jobs for the most recent pipeline and job
traces for the current commit by clicking the **Pipelines** button in the top
right.
2018-11-08 19:23:39 +05:30
The pipeline status is also shown at all times in the status bar in the bottom
left.
## Switching merge requests
2019-09-30 21:07:59 +05:30
To switch between your authored and assigned merge requests, click the
2021-11-18 22:05:49 +05:30
dropdown in the top of the sidebar to open a list of merge requests. You must commit or discard all your changes before switching to a different merge
2019-09-04 21:01:54 +05:30
request.
2018-11-08 19:23:39 +05:30
2018-11-18 11:00:15 +05:30
## Switching branches
2019-09-30 21:07:59 +05:30
To switch between branches of the current project repository, click the dropdown
in the top of the sidebar to open a list of branches.
2021-11-18 22:05:49 +05:30
You must commit or discard all your changes before switching to a
2019-09-04 21:01:54 +05:30
different branch.
2018-11-18 11:00:15 +05:30
2020-06-23 00:09:42 +05:30
## Markdown editing
2022-03-02 08:16:31 +05:30
> - Support for pasting images [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/22822) in GitLab Free 13.1.
> - Side-by-side Markdown preview [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68274) in GitLab Free 14.3.
2020-06-23 00:09:42 +05:30
2021-10-27 15:23:28 +05:30
To edit Markdown files in the Web IDE:
2020-06-23 00:09:42 +05:30
2021-10-27 15:23:28 +05:30
1. Go to your repository, and navigate to the Markdown page you want to edit.
1. Select **Edit in Web IDE**, and GitLab loads the page in a tab in the editor.
1. Make your changes to the file. GitLab supports [GitLab Flavored Markdown](../../markdown.md#gitlab-flavored-markdown).
1. When your changes are complete, select **Commit** in the left sidebar.
1. Add a commit message, select the branch you want to commit to, and select **Commit**.
When editing, you can upload local images by pasting them directly in the Markdown file.
2020-06-23 00:09:42 +05:30
The image is uploaded to the same directory and is named `image.png` by default.
If another file already exists with the same name, a numeric suffix is automatically
2021-01-03 14:25:43 +05:30
added to the filename.
2020-06-23 00:09:42 +05:30
2021-11-11 11:23:49 +05:30
There are two ways to preview Markdown content in the Web IDE:
2021-10-27 15:23:28 +05:30
1. At the top of the file's tab, select **Preview Markdown** to preview the formatting
in your file. You can't edit the file in this view.
1. To add more changes to the file, select **Edit**.
1. Right-click or use the keyboard shortcut `Command/Control + Shift + P` and
select **Preview Markdown** to toggle a live Markdown preview panel.
2020-05-24 23:13:21 +05:30
## Live Preview
2018-11-18 11:00:15 +05:30
2022-03-02 08:16:31 +05:30
> [Renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/213853) from _Client Side Evaluation_ to _Live Preview_ in GitLab 13.0.
2018-11-18 11:00:15 +05:30
2019-09-04 21:01:54 +05:30
You can use the Web IDE to preview JavaScript projects right in the browser.
2018-11-18 11:00:15 +05:30
This feature uses CodeSandbox to compile and bundle the JavaScript used to
2018-11-20 20:47:30 +05:30
preview the web application.
2018-11-18 11:00:15 +05:30
2020-05-24 23:13:21 +05:30
![Web IDE Live Preview](img/live_preview_v13_0.png)
2018-11-18 11:00:15 +05:30
2019-09-04 21:01:54 +05:30
Additionally, for public projects an **Open in CodeSandbox** button is available
2018-11-20 20:47:30 +05:30
to transfer the contents of the project into a public CodeSandbox project to
quickly share your project with others.
2021-09-04 01:27:46 +05:30
### Enable Live Preview
2018-11-18 11:00:15 +05:30
2021-09-04 01:27:46 +05:30
With Live Preview enabled, you can preview projects with a `package.json` file and
a `main` entry point inside the Web IDE.
2021-01-29 00:20:46 +05:30
2021-09-04 01:27:46 +05:30
Live Preview is enabled for all projects on GitLab.com. If you are an administrator
of a self-managed GitLab instance, and you want to enable Live Preview:
2018-11-18 11:00:15 +05:30
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Settings > General**.
2021-09-04 01:27:46 +05:30
1. Scroll to **Web IDE** and select **Expand**:
![Administrator Live Preview setting](img/admin_live_preview_v13_0.png)
1. Select **Enable Live Preview** and select **Save changes**.
2018-11-18 11:00:15 +05:30
2021-09-04 01:27:46 +05:30
[In GitLab 12.9 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/268288),
third-party assets and libraries required for Live Preview are hosted at
`https://sandbox-prod.gitlab-static.net` when it is enabled. However, some libraries
are still served from other third-party services, which may or may not be desirable
in your environment.
An example `package.json`:
2018-11-18 11:00:15 +05:30
```json
{
"main": "index.js",
"dependencies": {
"vue": "latest"
}
}
```
2020-06-23 00:09:42 +05:30
## Interactive Web Terminals for the Web IDE
2019-07-31 22:56:46 +05:30
2022-03-02 08:16:31 +05:30
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/211685) to GitLab Free in 13.1.
2019-07-31 22:56:46 +05:30
2021-02-22 17:27:13 +05:30
WARNING:
2019-07-31 22:56:46 +05:30
Interactive Web Terminals for the Web IDE is currently in **Beta**.
2021-02-22 17:27:13 +05:30
GitLab.com shared runners [do not yet support Interactive Web Terminals](https://gitlab.com/gitlab-org/gitlab/-/issues/24674),
2021-11-18 22:05:49 +05:30
so you must use your own private runner to make use of this feature.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
[Interactive Web Terminals](../../../ci/interactive_web_terminal/index.md)
give the project [Maintainers](../../permissions.md#project-members-permissions)
2020-11-24 15:15:51 +05:30
user access to a terminal to interact with the runner directly from
2019-07-31 22:56:46 +05:30
GitLab, including through the Web IDE.
### Runner configuration
2021-11-18 22:05:49 +05:30
Some things must be configured in the runner for the interactive web terminal
2019-07-31 22:56:46 +05:30
to work:
2020-11-24 15:15:51 +05:30
- The runner needs to have
2019-07-31 22:56:46 +05:30
[`[session_server]` configured properly](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-session_server-section).
2020-07-28 23:09:34 +05:30
This section requires at least a `session_timeout` value (which defaults to 1800
seconds) and a `listen_address` value. If `advertise_address` is not defined, `listen_address` is used.
2021-11-18 22:05:49 +05:30
- If you are using a reverse proxy with your GitLab instance, web terminals must be
2021-03-11 19:13:27 +05:30
[enabled](../../../administration/integration/terminal.md#enabling-and-disabling-terminal-support). **(ULTIMATE SELF)**
2019-07-31 22:56:46 +05:30
If you have the terminal open and the job has finished with its tasks, the
2021-01-03 14:25:43 +05:30
terminal blocks the job from finishing for the duration configured in
2020-07-28 23:09:34 +05:30
[`[session_server].session_timeout`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-session_server-section)
2019-07-31 22:56:46 +05:30
until you close the terminal window.
2021-02-22 17:27:13 +05:30
NOTE:
2020-07-28 23:09:34 +05:30
Not all executors are
[supported](https://docs.gitlab.com/runner/executors/#compatibility-chart).
The [File Sync](#file-syncing-to-web-terminal) feature is supported on Kubernetes runners only.
2019-07-31 22:56:46 +05:30
### Web IDE configuration file
2021-11-18 22:05:49 +05:30
To enable the Web IDE terminals you must create the file
2019-07-31 22:56:46 +05:30
`.gitlab/.gitlab-webide.yml` inside the repository's root. This
2021-09-30 23:02:18 +05:30
file is fairly similar to the [CI configuration file](../../../ci/yaml/index.md)
2019-07-31 22:56:46 +05:30
syntax but with some restrictions:
2021-03-08 18:12:59 +05:30
- No global blocks (such as `before_script` or `after_script`) can be defined.
2019-07-31 22:56:46 +05:30
- Only one job named `terminal` can be added to this file.
- Only the keywords `image`, `services`, `tags`, `before_script`, `script`, and
2019-09-30 21:07:59 +05:30
`variables` are allowed to be used to configure the job.
2019-07-31 22:56:46 +05:30
- To connect to the interactive terminal, the `terminal` job must be still alive
2021-01-03 14:25:43 +05:30
and running, otherwise the terminal cannot connect to the job's session.
2019-09-30 21:07:59 +05:30
By default the `script` keyword has the value `sleep 60` to prevent
the job from ending and giving the Web IDE enough time to connect. This means
2021-01-03 14:25:43 +05:30
that, if you override the default `script` value, you have to add a command
2019-09-30 21:07:59 +05:30
which would keep the job running, like `sleep`.
2019-07-31 22:56:46 +05:30
In the code below there is an example of this configuration file:
```yaml
terminal:
2020-07-28 23:09:34 +05:30
# This can be any image that has the necessary runtime environment for your project.
image: node:10-alpine
2019-07-31 22:56:46 +05:30
before_script:
2021-04-29 21:17:54 +05:30
- apk update
2019-07-31 22:56:46 +05:30
script: sleep 60
variables:
RAILS_ENV: "test"
NODE_ENV: "test"
```
2021-03-08 18:12:59 +05:30
After the terminal has started, the console is displayed and we could access
2019-07-31 22:56:46 +05:30
the project repository files.
2021-10-27 15:23:28 +05:30
When you use the image keyword, a container with the specified image is created. If you specify an image, it has no effect. This is the case when you use the [shell executor](https://docs.gitlab.com/runner/executors/shell.html).
2019-12-04 20:38:33 +05:30
**Important**. The terminal job is branch dependent. This means that the
2021-01-03 14:25:43 +05:30
configuration file used to trigger and configure the terminal is the one in
2019-07-31 22:56:46 +05:30
the selected branch of the Web IDE.
2021-01-03 14:25:43 +05:30
If there is no configuration file in a branch, an error message is shown.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
### Running interactive terminals in the Web IDE
2019-07-31 22:56:46 +05:30
2021-01-03 14:25:43 +05:30
If Interactive Terminals are available for the current user, the **Terminal** button is visible in the right sidebar of the Web IDE. Click this button to open
2019-07-31 22:56:46 +05:30
or close the terminal tab.
2021-03-08 18:12:59 +05:30
After opening, the tab shows the **Start Web Terminal** button. This button may
2019-07-31 22:56:46 +05:30
be disabled if the environment is not configured correctly. If so, a status
2021-01-03 14:25:43 +05:30
message describes the issue. Here are some reasons why **Start Web Terminal**
2019-07-31 22:56:46 +05:30
may be disabled:
- `.gitlab/.gitlab-webide.yml` does not exist or is set up incorrectly.
- No active private runners are available for the project.
2021-01-03 14:25:43 +05:30
If active, clicking the **Start Web Terminal** button loads the terminal view
2019-07-31 22:56:46 +05:30
and start connecting to the runner's terminal. At any time, the **Terminal** tab
2021-01-03 14:25:43 +05:30
can be closed and reopened and the state of the terminal is not affected.
2019-07-31 22:56:46 +05:30
When the terminal is started and is successfully connected to the runner, then the
2021-01-03 14:25:43 +05:30
runner's shell prompt appears in the terminal. From here, you can enter
2021-03-08 18:12:59 +05:30
commands executed in the runner's environment. This is similar
2019-07-31 22:56:46 +05:30
to running commands in a local terminal or through SSH.
While the terminal is running, it can be stopped by clicking **Stop Terminal**.
2021-01-03 14:25:43 +05:30
This disconnects the terminal and stops the runner's terminal job. From here,
2019-07-31 22:56:46 +05:30
click **Restart Terminal** to start a new terminal session.
2019-09-30 21:07:59 +05:30
### File syncing to web terminal
2019-09-04 21:01:54 +05:30
2022-03-02 08:16:31 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5276) in GitLab Ultimate 12.0.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/211686) from GitLab Ultimate to GitLab Free in 13.1.
2019-09-04 21:01:54 +05:30
2019-09-30 21:07:59 +05:30
File changes in the Web IDE can be synced to a running web terminal.
2019-09-04 21:01:54 +05:30
This enables users to test their code changes in a preconfigured terminal
environment.
2021-02-22 17:27:13 +05:30
NOTE:
2019-09-04 21:01:54 +05:30
Only file changes in the Web IDE are synced to the terminal.
Changes made in the terminal are **not** synced to the Web IDE.
2020-11-24 15:15:51 +05:30
This feature is only available for Kubernetes runners.
2019-09-04 21:01:54 +05:30
2019-09-30 21:07:59 +05:30
To enable file syncing to the web terminal, the `.gitlab/.gitlab-webide.yml`
file needs to have a `webide-file-sync` service configured. Here is an example
2019-09-04 21:01:54 +05:30
configuration for a Node JS project which uses this service:
```yaml
terminal:
# This can be any image that has the necessary runtime environment for your project.
2019-09-30 21:07:59 +05:30
image:
2019-09-04 21:01:54 +05:30
name: node:10-alpine
services:
- name: registry.gitlab.com/gitlab-org/webide-file-sync:latest
alias: webide-file-sync
entrypoint: ["/bin/sh"]
command: ["-c", "sleep 5 && ./webide-file-sync -project-dir $CI_PROJECT_DIR"]
ports:
# The `webide-file-sync` executable defaults to port 3000.
- number: 3000
```
2019-09-30 21:07:59 +05:30
- The `webide-file-sync` executable must start **after** the project
2021-11-18 22:05:49 +05:30
directory is available. This is why we must add `sleep 5` to the `command`.
2020-06-23 00:09:42 +05:30
See [this issue](https://gitlab.com/gitlab-org/webide-file-sync/-/issues/7) for
2020-04-22 19:07:51 +05:30
more information.
2019-09-30 21:07:59 +05:30
- `$CI_PROJECT_DIR` is a
2021-04-17 20:07:23 +05:30
[predefined CI/CD variable](../../../ci/variables/predefined_variables.md)
2021-01-03 14:25:43 +05:30
for GitLab Runners. This is where your project's repository resides.
2019-09-30 21:07:59 +05:30
2021-03-08 18:12:59 +05:30
After you have configured the web terminal for file syncing, then when the web
2021-01-03 14:25:43 +05:30
terminal is started, a **Terminal** status is visible in the status bar.
2019-09-30 21:07:59 +05:30
![Web IDE Client Side Evaluation](img/terminal_status.png)
2021-01-03 14:25:43 +05:30
Changes made to your files via the Web IDE sync to the running terminal
2019-09-30 21:07:59 +05:30
when:
2021-03-08 18:12:59 +05:30
- <kbd>Control</kbd> + <kbd>S</kbd> (or <kbd>Command</kbd> + <kbd>S</kbd> on Mac)
2019-09-30 21:07:59 +05:30
is pressed while editing a file.
2022-01-26 12:08:38 +05:30
- You select any area outside the file editor after editing a file.
2019-09-30 21:07:59 +05:30
- A file or folder is created, deleted, or renamed.
2019-09-04 21:01:54 +05:30
2019-07-31 22:56:46 +05:30
### Limitations
2021-01-03 14:25:43 +05:30
The Web IDE has a few limitations:
2021-10-27 15:23:28 +05:30
- Interactive Terminals is in a beta phase and continues to be improved in upcoming releases. In the meantime, the user is limited to having only one
2021-01-03 14:25:43 +05:30
active terminal at a time.
2021-03-08 18:12:59 +05:30
- LFS files can be rendered and displayed but they cannot be updated and committed using the Web IDE. If an LFS file is modified and pushed to the repository, the LFS pointer in the repository is overwritten with the modified LFS file content.
2019-07-31 22:56:46 +05:30
### Troubleshooting
- If the terminal's text is gray and unresponsive, then the terminal has stopped
and it can no longer be used. A stopped terminal can be restarted by clicking
**Restart Terminal**.
- If the terminal displays **Connection Failure**, then the terminal could not
connect to the runner. Please try to stop and restart the terminal. If the
problem persists, double check your runner configuration.