Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,12 @@
"c-cpp-pro.discovery.detectExternalSdks": {
"type": "boolean",
"default": true,
"description": "Auto-detect common external SDKs (Vulkan SDK, raylib, CUDA Toolkit, Boost, SDL) for fallback IntelliSense flags and flag synthesis."
"description": "Auto-detect common external SDKs (Qt, Vulkan SDK, raylib, CUDA Toolkit, Boost, SDL) for fallback IntelliSense flags and flag synthesis."
},
"c-cpp-pro.discovery.qtToolchain": {
"type": "string",
"default": "",
"description": "Preferred Qt toolchain kit subfolder (e.g. 'mingw_64', 'msvc2022_64', 'gcc_64'). If empty, automatically selects the best matching desktop toolchain based on the active compiler."
},
"c-cpp-pro.default.forcedInclude": {
"type": "array",
Expand Down
52 changes: 52 additions & 0 deletions scripts/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const fs = require('fs');
const path = require('path');

const repoRoot = path.resolve(__dirname, '..');
const pkgPath = path.join(repoRoot, 'package.json');
const lockPath = path.join(repoRoot, 'package-lock.json');
const cargoPath = path.join(repoRoot, 'crates', 'c-cpp-pro-native', 'Cargo.toml');

if (!fs.existsSync(pkgPath)) {
console.error(`Error: package.json not found at ${pkgPath}`);
process.exit(1);
}

const pkgContent = fs.readFileSync(pkgPath, 'utf8');
const pkg = JSON.parse(pkgContent);

const currentVersion = pkg.version || '0.0.0';
const versionParts = currentVersion.split('.');

const major = parseInt(versionParts[0] || '0', 10);
const minor = parseInt(versionParts[1] || '0', 10);
const patch = parseInt(versionParts[2] || '0', 10) + 1;

const newVersion = `${major}.${minor}.${patch}`;

pkg.version = newVersion;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');

if (fs.existsSync(lockPath)) {
try {
const lockContent = fs.readFileSync(lockPath, 'utf8');
const lock = JSON.parse(lockContent);
lock.version = newVersion;
if (lock.packages && lock.packages['']) {
lock.packages[''].version = newVersion;
}
fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + '\n', 'utf8');
} catch (err) {
console.warn(`Warning: failed to update package-lock.json: ${err.message}`);
}
}

if (fs.existsSync(cargoPath)) {
let cargoContent = fs.readFileSync(cargoPath, 'utf8');
cargoContent = cargoContent.replace(
/^version\s*=\s*"[^"]+"/m,
`version = "${newVersion}"`
);
fs.writeFileSync(cargoPath, cargoContent, 'utf8');
}

console.log(`Bumped version: ${currentVersion} -> ${newVersion}`);
104 changes: 104 additions & 0 deletions scripts/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@echo off
setlocal enabledelayedexpansion

echo ===================================================
echo C/C++ Pro - Local Development Installer
echo ===================================================

set "SCRIPT_DIR=%~dp0"
set "REPO_ROOT=%SCRIPT_DIR%.."
cd /d "%REPO_ROOT%"

REM Parse flags
set "DO_BUMP=1"
set "DO_BUILD=1"

for %%A in (%*) do (
if /i "%%A"=="--no-bump" set "DO_BUMP=0"
if /i "%%A"=="-NoBump" set "DO_BUMP=0"
if /i "%%A"=="--skip-build" set "DO_BUILD=0"
if /i "%%A"=="-SkipBuild" set "DO_BUILD=0"
)

REM 1. Check for npm
where npm >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Error: npm is not found in PATH.
exit /b 1
)

REM 2. Locate VS Code executable (code, code-insiders, or codium)
set "CODE_BIN=code"
where code >nul 2>nul
if %ERRORLEVEL% neq 0 (
where code-insiders >nul 2>nul
if %ERRORLEVEL% equ 0 (
set "CODE_BIN=code-insiders"
) else (
where codium >nul 2>nul
if %ERRORLEVEL% equ 0 (
set "CODE_BIN=codium"
) else (
echo Error: VS Code executable was not found in PATH.
exit /b 1
)
)
)

REM 3. Bump patch version
if "%DO_BUILD%"=="1" (
if "%DO_BUMP%"=="1" (
echo [1/4] Bumping extension patch version...
call node "%SCRIPT_DIR%bump-version.js"
if !ERRORLEVEL! neq 0 (
echo Error: Failed to bump version.
exit /b !ERRORLEVEL!
)
) else (
echo [1/4] Skipping version bump: --no-bump requested...
)
) else (
echo [1/4] Skipping version bump: --skip-build requested...
)

REM 4. Package VSIX extension
if "%DO_BUILD%"=="1" (
echo [2/4] Packaging VSIX bundle: clean, native Rust build, production esbuild...
call npm run package
if !ERRORLEVEL! neq 0 (
echo Error: Failed to package VSIX bundle.
exit /b !ERRORLEVEL!
)
) else (
echo [2/4] Skipping packaging step: --skip-build requested...
)

REM 5. Locate packaged VSIX extension
echo [3/4] Locating packaged VSIX extension...
set "VSIX_FILE="
for /f "delims=" %%F in ('dir /b /o:-d c-cpp-pro-*.vsix 2^>nul') do (
set "VSIX_FILE=%%F"
goto :found_vsix
)

:found_vsix
if "%VSIX_FILE%"=="" (
echo Error: Could not locate packaged VSIX file in %REPO_ROOT%.
exit /b 1
)

echo Target VSIX: %VSIX_FILE%

REM 6. Install VSIX into VS Code
echo [4/4] Installing %VSIX_FILE% into %CODE_BIN%...
call %CODE_BIN% --install-extension "%VSIX_FILE%" --force
if %ERRORLEVEL% neq 0 (
echo Error: Failed to install VSIX into %CODE_BIN%.
exit /b %ERRORLEVEL%
)

echo ---------------------------------------------------
echo Successfully installed %VSIX_FILE% into %CODE_BIN%.
echo To activate, reload your VS Code window: 'Developer: Reload Window'.
echo ---------------------------------------------------
exit /b 0
87 changes: 87 additions & 0 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# C/C++ Pro - Local Extension Builder & Installer
# Bumps version, builds native addon, compiles extension bundle, packages VSIX, and installs locally into VS Code.

[CmdletBinding()]
param(
[switch]$SkipBuild,
[switch]$NoBump,
[switch]$PreRelease,
[string]$CodeBin = "code"
)

$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$RepoRoot = Split-Path -Parent $ScriptDir

Set-Location $RepoRoot

Write-Host "===================================================" -ForegroundColor Cyan
Write-Host " C/C++ Pro - Local Development Installer" -ForegroundColor Cyan
Write-Host "===================================================" -ForegroundColor Cyan

# 1. Verify prerequisite tooling
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
Write-Error "npm is not installed or not available in PATH."
}

$VscodeCli = Get-Command $CodeBin -ErrorAction SilentlyContinue
if (-not $VscodeCli) {
# Check fallback editors: code-insiders, codium
$FallbackCli = @("code", "code-insiders", "codium") | Where-Object { Get-Command $_ -ErrorAction SilentlyContinue } | Select-Object -First 1
if ($FallbackCli) {
$CodeBin = $FallbackCli
$VscodeCli = Get-Command $CodeBin
Write-Host "Using discovered VS Code CLI: $CodeBin" -ForegroundColor Yellow
} else {
Write-Error "VS Code executable ($CodeBin) not found in PATH. Please ensure 'code' command is in your PATH."
}
}

# 2. Bump patch version
if (-not $NoBump -and -not $SkipBuild) {
Write-Host "[1/4] Bumping extension patch version..." -ForegroundColor Green
node (Join-Path $ScriptDir "bump-version.js")
if ($LASTEXITCODE -ne 0) {
Write-Error "Version bump failed with exit code $LASTEXITCODE."
}
} else {
Write-Host "[1/4] Skipping version bump (NoBump or SkipBuild specified)..." -ForegroundColor Yellow
}

# 3. Package VSIX extension
if (-not $SkipBuild) {
Write-Host "[2/4] Packaging VSIX bundle (clean, native Rust build, production esbuild)..." -ForegroundColor Green
if ($PreRelease) {
npm run package:pre
} else {
npm run package
}
if ($LASTEXITCODE -ne 0) {
Write-Error "Packaging failed with exit code $LASTEXITCODE."
}
} else {
Write-Host "[2/4] Skipping build/packaging step (-SkipBuild requested)..." -ForegroundColor Yellow
}

# 4. Locate generated VSIX file
Write-Host "[3/4] Locating packaged VSIX extension..." -ForegroundColor Green
$VsixFile = Get-ChildItem -Path $RepoRoot -Filter "c-cpp-pro-*.vsix" | Sort-Object LastWriteTime -Descending | Select-Object -First 1

if (-not $VsixFile -or -not (Test-Path $VsixFile.FullName)) {
Write-Error "Could not find packaged VSIX file in $RepoRoot."
}

Write-Host "Target VSIX: $($VsixFile.Name) ($([math]::Round($VsixFile.Length / 1MB, 2)) MB)" -ForegroundColor Cyan

# 5. Install VSIX into VS Code
Write-Host "[4/4] Installing $($VsixFile.Name) into $CodeBin..." -ForegroundColor Green
& $CodeBin --install-extension $VsixFile.FullName --force

if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install VSIX into VS Code (exit code $LASTEXITCODE)."
}

Write-Host "---------------------------------------------------" -ForegroundColor Cyan
Write-Host "Successfully installed $($VsixFile.Name) into $CodeBin." -ForegroundColor Green
Write-Host "To activate, reload your VS Code window: 'Developer: Reload Window' (Ctrl+R / Cmd+R)." -ForegroundColor Cyan
Write-Host "---------------------------------------------------" -ForegroundColor Cyan
87 changes: 87 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"

cd "${REPO_ROOT}"

echo "==================================================="
echo " C/C++ Pro - Local Development Installer"
echo "==================================================="

# Parse flags
DO_BUMP=1
DO_BUILD=1

for arg in "$@"; do
case "${arg}" in
--no-bump|-NoBump)
DO_BUMP=0
;;
--skip-build|-SkipBuild)
DO_BUILD=0
;;
*)
;;
esac
done

# 1. Verify npm presence
if ! command -v npm &>/dev/null; then
echo "Error: npm is not installed or not available in PATH." >&2
exit 1
fi

# 2. Locate VS Code CLI executable
CODE_BIN="code"
if ! command -v "${CODE_BIN}" &>/dev/null; then
if command -v code-insiders &>/dev/null; then
CODE_BIN="code-insiders"
elif command -v codium &>/dev/null; then
CODE_BIN="codium"
else
echo "Error: VS Code executable ('code') not found in PATH." >&2
exit 1
fi
fi

# 3. Bump patch version
if [ "${DO_BUILD}" -eq 1 ]; then
if [ "${DO_BUMP}" -eq 1 ]; then
echo "[1/4] Bumping extension patch version..."
node "${SCRIPT_DIR}/bump-version.js"
else
echo "[1/4] Skipping version bump (--no-bump requested)..."
fi
else
echo "[1/4] Skipping version bump (--skip-build requested)..."
fi

# 4. Package extension VSIX
if [ "${DO_BUILD}" -eq 1 ]; then
echo "[2/4] Packaging VSIX bundle (clean, native Rust build, production esbuild)..."
npm run package
else
echo "[2/4] Skipping build/packaging step (--skip-build requested)..."
fi

# 5. Locate the latest generated VSIX file
echo "[3/4] Locating packaged VSIX extension..."
VSIX_FILE=$(ls -t c-cpp-pro-*.vsix 2>/dev/null | head -n 1 || true)

if [ -z "${VSIX_FILE}" ] || [ ! -f "${VSIX_FILE}" ]; then
echo "Error: Could not find packaged VSIX file in ${REPO_ROOT}." >&2
exit 1
fi

echo "Target VSIX: ${VSIX_FILE}"

# 6. Install VSIX into VS Code
echo "[4/4] Installing ${VSIX_FILE} into ${CODE_BIN}..."
"${CODE_BIN}" --install-extension "${VSIX_FILE}" --force

echo "---------------------------------------------------"
echo "Successfully installed ${VSIX_FILE} into ${CODE_BIN}."
echo "To activate, reload your VS Code window: 'Developer: Reload Window'."
echo "---------------------------------------------------"
2 changes: 1 addition & 1 deletion src/intelligence/header-hover-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ export function getCachedWorkspaceSdkIncludes(wsRoot: string): string[] {
if (cached && (now - cached.timestamp) < SDK_INCLUDE_CACHE_TTL_MS) {
return cached.paths;
}
const paths = ExternalSdkDetector.getWorkspaceIncludePaths(wsRoot);
const paths = ExternalSdkDetector.getWorkspaceIncludePaths(wsRoot, { workspaceRoot: wsRoot });
workspaceSdkIncludeCache.set(canon, { timestamp: now, paths });
return paths;
}
Expand Down
Loading
Loading