Skip to content

Instantly share code, notes, and snippets.

@3DRaven
Last active September 14, 2025 20:20
Show Gist options
  • Select an option

  • Save 3DRaven/bbb81cbeeb1e5d208834ce18782e119f to your computer and use it in GitHub Desktop.

Select an option

Save 3DRaven/bbb81cbeeb1e5d208834ce18782e119f to your computer and use it in GitHub Desktop.
rust-analyzer and vscode settings for fast code navigation and building

Base system

16Gb RAM laptop with 16 cpu kernels

settings.json for vscode in project

{
    // "rust-analyzer.completion.limit": 10,
    // "rust-analyzer.workspace.symbol.search.limit": 50,
    "rust-analyzer.workspace.symbol.search.scope": "workspace_and_dependencies",
    "rust-analyzer.imports.preferPrelude": true,
    "rust-analyzer.imports.preferNoStd": false,
    "rust-analyzer.imports.merge.glob": false,
    "rust-analyzer.imports.granularity.group": "crate",
    "rust-analyzer.imports.granularity.enforce": false,
    "rust-analyzer.hover.actions.enable": true,
    "rust-analyzer.hover.actions.implementations.enable": true,
    "rust-analyzer.hover.actions.references.enable": true,
    "rust-analyzer.hover.actions.run.enable": false,
    "rust-analyzer.hover.actions.debug.enable": false,
    "rust-analyzer.completion.privateEditable.enable": true,
    "rust-analyzer.diagnostics.experimental.enable": false,
    "rust-analyzer.diagnostics.enable": true,
    "rust-analyzer.lens.enable": true,
    "rust-analyzer.check.command": "check",
    "rust-analyzer.runnables.extraTestBinaryArgs": [
        "--nocapture",
        "--test-threads=1"
    ],
    "rust-analyzer.cargo.features": "all",
    "rust-analyzer.completion.autoself.enable": true,
    "rust-analyzer.completion.autoimport.enable": true,
    "rust-analyzer.server.extraEnv": {
        "CARGO_TARGET_DIR": "target/rust-analyzer",
        "RA_PROFILE": "IntelliJ"
    },
    "rust-analyzer.lru.capacity": 1024,
    "rust-analyzer.cachePriming.enable": true,
    "rust-analyzer.checkOnSave": true,
    "rust-analyzer.check.workspace": true,
    "rust-analyzer.check.allTargets": true,
    "rust-analyzer.cargo.buildScripts.enable": true,
    "rust-analyzer.procMacro.enable": true,
    // "rust-analyzer.check.extraArgs": [
    //     // "--lib",
    //     "--bins"
    // ],
    /////////////////////////
    "editor.hover.sticky": true,
    "editor.hover.delay": 100,
    "editor.hover.enabled": true,
    "editor.parameterHints.cycle": true,
    "editor.suggest.filterGraceful": false,
    "editor.gotoLocation.multipleDefinitions": "goto",
    "editor.gotoLocation.multipleTypeDefinitions": "goto",
    "editor.gotoLocation.multipleImplementations": "peek",
    "editor.gotoLocation.multipleReferences": "peek",
    "editor.inlineSuggest.enabled": true,
    "editor.peekWidgetDefaultFocus": "editor",
    "search.searchOnType": true,
    "search.searchOnTypeDebouncePeriod": 300,
    "files.watcherExclude": {
        "**/target/**": true,
        "**/node_modules/**": true,
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/build/**": true,
        "**/dist/**": true
    },
    "search.exclude": {
        "**/target": true,
        "**/node_modules": true,
        "**/.git": true
    },
    "editor.minimap.enabled": false,
    "breadcrumbs.enabled": true,
    "editor.renderWhitespace": "none",
    "editor.renderControlCharacters": true,
    "editor.renderLineHighlight": "all",
    "problems.decorations.enabled": true,
    "editor.quickSuggestions": {
        "other": true,
        "comments": true,
        "strings": true
    },
    "editor.quickSuggestionsDelay": 100,
    "editor.suggest.insertMode": "replace",
    "editor.suggest.localityBonus": true,
    "editor.suggest.shareSuggestSelections": false,
    "git.enabled": false,
    "git.autorefresh": false,
    "git.decorations.enabled": false,
    "terminal.integrated.gpuAcceleration": "auto",
    /////////////////////////
    "lldb.displayFormat": "auto",
    "lldb.showDisassembly": "never",
    "lldb.dereferencePointers": true,
    "lldb.consoleMode": "evaluate",
    "java.autobuild.enabled": false,
    "java.errors.incompleteClasspath.severity": "ignore",
    "java.server.launchMode": "LightWeight",
    "java.project.sourcePaths": [
        "client"
    ],
    "markdown-preview-enhanced.plantumlJarPath": "/home/i3draven/fun/Rust/degu/tools/plantuml.jar"
}

cat /etc/sysctl.d/99-rust-dev.conf

vm.swappiness=1
vm.vfs_cache_pressure=50
vm.dirty_ratio=15
vm.dirty_background_ratio=5
vm.max_map_count=2097152

swap (as I remember it, check)

For ubuntu 25.10, installation steps

Compressed RAM

sudo apt install zram-config

Compressed swap volume

sudo apt install vdo lvm2
sudo systemctl enable vdo.service
sudo systemctl start vdo.service
sudo lvcreate --type vdo -L 31G -V 31G --compression y --deduplication n vg/lv_swap
sudo mkswap /dev/vg/lv_swap
sudo blkid /dev/vg/lv_swap

/etc/fstab


#/swapfile                                 none            swap    sw              0       0
UUID=${your_swap_id} none swap sw 0 0

LMV volume starts before fstab

sudo systemctl edit dev-vg-lvol0-swap.service

[Unit]
Description=Activate LVM volumes before mounting filesystems
DefaultDependencies=no
Before=local-fs-pre.target
After=systemd-udev-settle.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/vgchange -ay

[Install]
WantedBy=local-fs-pre.target

Cargo preferences

install sccache

cargo install sccache

Add sccache as wraper around rustc

nano ~/.cargo/config.toml

[build]
jobs = 12  # 3/4 CPU kernels
rustc-wrapper = "sccache"

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

[profile.dev]
debug = 1
incremental = true

[profile.release]
lto = "thin"
codegen-units = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment