Skip to content
Andrei Montchik edited this page Apr 29, 2024 · 22 revisions

Install

  1. Download deb archive
  2. Install: sudo dpkg -i code_xxx.deb

Configure

  1. Create or replace the ~/.config/Code/User/settings.json file contents with the following:
{
    "workbench.colorTheme": "Visual Studio Light",
    "workbench.colorCustomizations": {
        "editor.lineHighlightBackground": "#F3EFEE"
    },
    "editor.rulers": [],
    "editor.hover.delay": 2000,
    "editor.fontFamily": "Consolas, 'Courier New', monospace",
    "editor.fontLigatures": true,
    "editor.fontWeight": "400",
    "editor.fontSize": 14,
    "editor.formatOnSave": true,
    "rust-analyzer.rustfmt.extraArgs": [
        "+nightly"
    ],
    "git.enableSmartCommit": true,
    "git.confirmSync": false,
    "terminal.integrated.fontWeight": "normal",
}
  1. Restart VSCode.

Support Rust

Install and configure Rust extensions

  • Install the rust-analyzer extension to support Rust.
  • Install the CODELLDB plugin for debugging.
  • Enable imports formatting:
    1. Switch to the nightly rust: rustup default nightly
    2. Create or replace the rustfmt.toml file in the root project directory with the following:
      imports_granularity = "One"
      group_imports = "One"
      use_field_init_shorthand = true
      
      # Maximum line length
      max_width=105
      
    3. Add the following to the Global ~/.config/Code/User/settings.json.
      "rust-analyzer.rustfmt.extraArgs": ["+nightly"]
      
    4. Restart VSCode.

Debug Rust library

Create Launch configuration to run application that uses the library. Example:

   {
     "type": "lldb",
     "request": "launch",
     "name": "Debug Test Validator",
     "program": "solana-test-validator",
     "args": [
        "--geyser-plugin-config",
        "/home/andrei/.config/solana/plugin_config.localnet.json"
     ],
     "cwd": "/home/andrei/work/playground",
     "sourceLanguages": [
         "rust"
     ],
   }

Support C++

  • Install the C/C++ Extension Pack from Microsoft
  • Enable the C++20 support:a dd "-std=c++20", to the build task in tasks.json
  • C++ source formatting:
    • save curly brackets on the same line and set number of symbols in the line to 130: Settings -> search for C_CPP.clang_format_fallbackStyle and save with { BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 130 }

Support MD files

  • install the Markdown Preview Github Styling plugin

Clone this wiki locally