Skip to content

Commit

Permalink
Merge pull request #13 from syuii/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatzhiro authored Apr 17, 2023
2 parents fca5be1 + b9ebc3f commit 21706c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions contents/vscode.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Setting up Visual Studio Code Environment
# Setting up the Visual Studio Code Environment

Visual Studio Code is the editor of choice for many people (and most of our team members also use it), so we decided to make a guide on how to setup your workspace so you can get the most functionality out of VSCode (e.g. code formatting, linting, intellisense, etc) and developing QuISP is smooth as possible.

Expand All @@ -9,12 +9,14 @@ Visual Studio Code is the editor of choice for many people (and most of our team
## Setup Dev Container

The Dev Containers extension lets you use a Docker container as a full-featured development environment.
Since we recommend docker container as the development environment, we provide a tutorial for the VSCode setup using Dev Container.
Since we recommend using a docker container as the development environment, we have provided a tutorial for the VSCode setup using Dev Container.

1. Open quisp (not quisp/quisp) in VSCode.
2. Choose View –> Extensions, then search for “Dev Containers” and install it.
3. From the command palette (keyboard shortcut: command shift p in macOS), select Dev Containers: Rebuild and Reopen in Container
4. If the VSCode terminal of the new window looks like this, you have successfully set up the dev container.
4. Pull up the terminal inside your VSCode by dragging from the blue bar at the bottom. If the VSCode terminal of the new window looks something like this, you have successfully set up the dev container.

![simu](../img/vsBuild.png)

If you encounter errors when building the dev container, update docker and docker desktop and try step 3 again.

Expand All @@ -25,11 +27,11 @@ We recommend using clangd since it has VSCode integration via official extension

1. **Disable official C/C++ extension from Microsoft**
When you start the dev container, the official C/C++ extension from Microsoft is not installed.
To make sure, choose View –> Extensions and check if the C/C++ extension from Microsoft is uninstalled or disabled. This extension can have weird interaction with the clangd extension.
To make sure, choose View –> Extensions and check if the C/C++ extension from Microsoft is uninstalled or disabled. This extension may have weird and unprecedented interactions with the clangd extension.
2. **Install clangd VSCode Extension**
Once you confirmed that the C/C++ extension from Microsoft is disabled or not installed. Choose View –> Extensions, then search for “clangd” and install it.
Once you have confirmed that the C/C++ extension from Microsoft is disabled or not installed. Choose View –> Extensions, then search for “clangd” and install it.
3. **Install clangd language server**
By default, the dev container does not have clangd language server installed. When you install the “clangd” VSCode extension, you will be prompted to download clangd.
By default, the dev container does not have the clangd language server installed. When you install the “clangd” VSCode extension, you will be prompted to download clangd.
If you are not prompted to download clangd, you need to install it manually. Execute the following code in the VSCode terminal.

```bash
Expand All @@ -45,7 +47,7 @@ We need to make a clean build of QuISP. At project root directory (quisp),
`$ make distclean; bear -- make run-unit-test`
clangd relies on compiled_command.json to support code completion. compiled_command.json contains the compiling information of the project.
5. **Confirm that compiled_command.json was created successfully**
The file should contain something like snippets below. It will create one compile arguments for each file as one json object in the array.
The file should contain something like the snippets below. It will create one compile arguments for each file as one json object in the array.

```json
[
Expand Down Expand Up @@ -84,7 +86,7 @@ The file should contain something like snippets below. It will create one compil
]
```

Done! Navigate to code file in QuISP (e.g. QuantumChannel.cc), and you should see all the errors are gone.
Done! Navigate to code file in QuISP (e.g. QuantumChannel.cc), and you should see that all the errors are now gone.

## Reference

Expand Down
Binary file added img/vsBuild.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 21706c8

Please sign in to comment.