Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Developer-Guide--Configure-environment-to-use-VSCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ To configure your development environment on VSCode the following steps are requ

Install the dev containers [extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) inside VSCode.

### Create a `devcontainer` Configuration

Devcontainer files define the vscode environment inside a docker container. It allows us to configure VSCode extensions, environment definitions, etc when running VSCode inside the docker container.

Place the following file: `devcontainer.json` at the root of your project inside a `.devcontainer` folder.
Expand Down Expand Up @@ -57,6 +59,22 @@ Brief explanation of what is happening above:
- We are installing `ruby-lsp` and `gitlens`, both VSCode extensions inside the dev container and specifying their configuration, such as ignoring certain folders from indexing specific paths. Notice that when we open up markus outside the dev container, these extensions will be absent.
- Force the `listen` gem to poll for changes by setting the `LISTEN_POLLING` flag. This removes flakyness in our autoreloading.

### Enable the `ruby-lsp` Gem

To enable modern programming features such as `go-to`, `code completion`, etc, an LSP server is required, which the default RubyMine IDE already comes preconfigured with. To work eficiently in VSCode we must enable the optionally defined `ruby-lsp` gem.

To install optional gem groups, we must pass in the `BUNDLE_WITH` enviroment variable with the optional groups we wish to install.

Inside the `docker-compose.override.yml`, we must define the following environment variable:

```yaml
deps-updater:
environment:
- BUNDLE_WITH=development_extra
```

When must then run: `docker compose run --rm deps-updater` to install the dependency.

## Execution

To run your code inside the dev container extension open up the command palette, either by pressing down `cmd + Shift + P` (on MAC OS) or by going to `view > Command Palette` and typing in `Dev Containers: Reopen in Container`