-
Notifications
You must be signed in to change notification settings - Fork 57
UsingVSCode
The following summarizes our experience of using Visual Studio Code (VS Code) IDE for developing ADDA. This guide has been tested with VS Code versions 1.95.2 and 1.95.3 on Ubuntu.
Before starting, ensure the following tools are installed on your system:
- VS Code: Download and install Visual Studio Code.
-
C Compiler: Install GCC (
sudo apt install gcc
). -
Make: Ensure Make is installed (
sudo apt install make
). -
Clang-Format: Install (
sudo apt install clang-format
).
To optimize VS Code, install these extensions:
- C/C++ Extension Pack: Provides IntelliSense, debugging, and more.
- Code Spell Checker: Highlights typos in code and comments.
- Clang-Format: Automates consistent code formatting.
- Makefile Tools: Provides IntelliSense for Makefile projects.
- Markdown Preview Enhanced: Provides many useful functionalities (PDF export, preview, etc.).
You can install extensions from the Extensions view (Ctrl+Shift+X
).
Open the ADDA Project Folder:
- Launch VS Code.
- Use
File -> Open Folder...
to select the root directory of the ADDA project.
- Create a
tasks.json
file in the.vscode
folder.- Use the menu:
Terminal -> Configure Tasks -> Create tasks.json file from template
. - Select
Others
from the prompt. - Copy the following tasks.json file inside.
- Use the menu:
- Run the tasks
Terminal -> Run Task...
and select one. - The
Terminal -> Run Build Task...
menu runs the default task (e.g.,make clean
).
Configuring debugging in VS Code for ADDA allows you to execute the program directly from the editor, step through code, and inspect variables.
- Open the Command Palette (
Ctrl+Shift+P
) ->C/C++: Edit Configurations (JSON)
.- Set
"cStandard":
to"c99"
.
- Set
- Create a
launch.json
file in the.vscode
folder.- Use the menu:
Run -> Add Configuration...
- Select
C++ (GDB/LLDB)
- Copy the following launch.json file inside.
- Use the menu:
- Run and debug the configurations:
- Open the
Run and Debug
view in the left bar (Ctrl+Shift+D
). - Select the desired configuration.
- Start debugging (
F5
)
- Open the
VS Code includes built-in Git support, enabling basic functionality. Files in the project tree that differ from the previous committed revision are marked by U
. In the left-click menu, the Source Control
window (Ctrl+Shift+G
) provides options to compare files with previous revisions, revert changes, or commit and push them.
Add the following local ignore entry to the .gitignore file
in the ADDA repository to exclude VS Code-specific files:
# VS Code
.vscode
ADDA adheres to a specific code style, which can be enforced in VS Code using Clang-Format. To set this up:
- Download the .clang-format configuration file to the root of the ADDA project:
New File... -> .clang-format
. - (Optional) Specify files to ignore in a
.clang-format-ignore
file. - Update your
settings.json
to enable Clang formatting on save and type:- Open Command Palette (
Ctrl+Shift+P
). - Select Preferences: Open Settings (JSON).
- Add:
{ "editor.defaultFormatter": "xaver.clang-format", "[c]": { "editor.defaultFormatter": "xaver.clang-format", "editor.formatOnType": true, "editor.formatOnSave": true } }
-
editor.formatOnSave
: Automatically formats your code when you save the file. -
editor.formatOnType
: Automatically formats your code as you type (triggered by typing characters like semicolons or curly braces).
- Open Command Palette (
To set up user dictionary for spelling checks:
- Use the Code Spell Checker extension to catch typos in comments and variable names.
- Add a custom dictionary file
userdic.txt
:- Open
Settings,json
. - Edit the path to your custom dictionary file:
{ "cSpell.dictionaryDefinitions": [ { "name": "custom", "path": "${workspaceFolder}/userdic.txt" } ], "cSpell.userWords": ["adda", "DDA", "electricField"] }
- Open
VS Code's integrated terminal can be opened in any folder (in Project Explorer) via Terminal -> New Terminal
. You can also add multiple terminals and split them.
Key outputs visible in the terminal include:
- Problems: Errors and warnings from Clang-Format and the compiler.
- Debug Console: Displays debugging logs.
- Spell Checker: Highlights typos flagged by your dictionary.
VS Code is suitable for editing ADDA wiki pages (Markdown files) offering live preview functionality. The Markdown Preview Enhanced extension allows for advanced features like exporting to PDF and previewing Markdown files in split windows (Ctrl+K V
).
Home (Getting started)
Frequently asked questions
Features
Tutorial
Comparison with other codes
Largest simulations
Compiling ADDA
Installing FFTW3
Installing MPI
Using OpenCL
Installing clFFT
Installing clBLAS
Using sparse mode
Installing MinGW
Using MSYS2
Papers that use ADDA
Awards
References
Links
Acknowledgements
Instruction for committers
Code design & structure
Style guide
Using VS Code
Using Eclipse
Early development history
Adding new ...