This extension integrates the PC-Lint Plus static code analysis tool with Visual Studio Code, making it easy to lint C/C++ files and view the results directly in the VS Code interface with comprehensive diagnostic support and intelligent include path management.
- Single File & Workspace Linting: Lint individual files or entire workspaces with progress tracking
- Smart Diagnostic Management: Results displayed in VS Code's Problems panel with accumulation across workspace files
- Auto-Lint on Save: Configurable automatic linting when files are saved
- Multiple Include Path Sources: Integrates with VSCode C++ extension and custom configurations
- Advanced Configuration: Support for custom PC-Lint configuration files and preprocessor definitions
- Command Line Length Fix: Uses temporary configuration files to avoid Windows command line limitations
- Real-time Progress: Workspace linting with cancellation support and progress reporting
- System Header Filtering: Automatically filters out system header issues (TASKING compiler, etc.)
- Summary Diagnostics: Shows summary information for issues in included files
- PC-Lint Plus must be installed on your system
- Visual Studio Code 1.60.0 or newer
- C/C++ source files (.c, .cpp, .h, .hpp)
- Install the extension from the Visual Studio Code Marketplace
- Configure the extension settings (see Configuration section below)
- Set up your PC-Lint Plus executable path
- Configure include paths and preprocessor definitions as needed
| Setting | Description | Default |
|---|---|---|
pclintplus.executablePath |
Path to the PC-Lint Plus executable | "" |
pclintplus.repositoryPath |
Root path for the repository being analyzed | Workspace folder |
pclintplus.configFiles |
List of PC-Lint configuration files (.lnt) | Predefined config files |
pclintplus.outputFormat |
Output format for PC-Lint Plus | "xml" |
| Setting | Description | Default |
|---|---|---|
pclintplus.includePaths |
List of include paths for the linter | Extensive default paths |
pclintplus.compilerIncludePath |
Path to compiler-specific include files | "C:\\TASKING\\TriCore v6.3r1\\ctc\\include" |
pclintplus.useVSCodeIncludes |
Enable integration with VSCode C++ extension paths | true |
| Setting | Description | Default |
|---|---|---|
pclintplus.preprocessorDefinitions |
List of preprocessor definitions | [] |
pclintplus.additionalArgs |
Additional command line arguments | ["-b", "-width(240,4)"] |
pclintplus.autoLintOnSave |
Enable automatic linting on file save | false |
pclintplus.filePatterns |
File patterns to include when linting workspace | ["**/*.c", "**/*.h"] |
pclintplus.excludePatterns |
File patterns to exclude when linting workspace | ["**/node_modules/**", "**/build/**"] |
The extension uses a sophisticated multi-source include path system:
{
"pclintplus.includePaths": [
"${workspaceFolder}/src/rte_gen",
"${workspaceFolder}/input/swc_bsw/core",
// ... extensive predefined paths
]
}Automatically reads from .vscode/c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/Program Files/Microsoft Visual Studio/**"
]
}
]
}{
"pclintplus.compilerIncludePath": "C:\\TASKING\\TriCore v6.3r1\\ctc\\include"
}- β
Variable substitution:
${workspaceFolder}β actual workspace path - β Existence validation: Only existing paths are included
- β Duplicate filtering: Prevents redundant paths from multiple sources
- β Platform awareness: Chooses correct configuration for Windows/Mac/Linux
- β Temporary config files: Avoids command line length limitations
{
"pclintplus.executablePath": "C:\\pclint_plus\\windows\\pclp64.exe",
"pclintplus.repositoryPath": "z:\\SW\\Development\\Deploy",
"pclintplus.autoLintOnSave": true,
"pclintplus.useVSCodeIncludes": true
}{
"pclintplus.executablePath": "C:\\pclint_plus\\windows\\pclp64.exe",
"pclintplus.repositoryPath": "z:\\SW\\Development\\Deploy",
"pclintplus.configFiles": [
"cfg/pclint_plus/co-tasking.lnt",
"cfg/pclint_plus/base.lnt",
"cfg/pclint_plus/au-misra3.lnt",
"cfg/pclint_plus/options.lnt",
"cfg/pclint_plus/env-xml.lnt",
"cfg/pclint_plus/tricore.lnt"
],
"pclintplus.preprocessorDefinitions": [
"DEBUG",
"PLATFORM_X86",
"APPL_BUILD"
],
"pclintplus.autoLintOnSave": true,
"pclintplus.useVSCodeIncludes": true
}| Command | Description | Shortcut |
|---|---|---|
PC-Lint Plus: Lint Current File |
Lint the currently open file | Command Palette |
PC-Lint Plus: Lint Workspace |
Lint all C/C++ files in the workspace | Command Palette |
PC-Lint Plus: Clear Diagnostics |
Clear all lint diagnostics from Problems panel | Command Palette |
Access commands via:
- Command Palette:
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(Mac) - Custom Keybindings: Bind commands to your preferred shortcuts
- Progress Tracking: Real-time progress with file count and percentage
- Cancellation Support: Cancel long-running workspace lints
- Diagnostic Accumulation: Issues from all files collected in Problems panel
- Summary Report: Final statistics on processed files and found issues
Enable pclintplus.autoLintOnSave to automatically lint C/C++ files when saved:
- Only processes lintable files (.c, .cpp, .h, .hpp)
- Respects file type detection
- Provides immediate feedback on code changes
The extension provides comprehensive logging in the PC-Lint Plus output channel:
- Open View β Output
- Select PC-Lint Plus from the dropdown
- Review detailed execution logs and error messages
| Issue | Cause | Solution |
|---|---|---|
| "PC-Lint Plus executable not found" | Invalid executable path | Check pclintplus.executablePath setting |
| "Config file not found" | Missing .lnt configuration files | Verify files exist in specified locations |
| "Unable to open include file" | Missing include directory | Add directory to pclintplus.includePaths |
| "Command line too long" error | Excessive include paths | Enable temporary config files (default) |
| No diagnostics in workspace lint | Diagnostic clearing issue | Fixed in latest version |
| System header warnings | TASKING/compiler headers | Automatically filtered out |
- Large Workspaces: Extension automatically limits to 2000 files for performance
- Include Path Optimization: Remove unnecessary paths to speed up linting
- File Exclusions: Use
pclintplus.excludePatternsto skip build directories
- Extension Entry Point: Command registration and VS Code integration
- LintRunner Class: Core linting logic and PC-Lint Plus execution
- Configuration Manager: Multi-source include path resolution
- Diagnostic Processor: XML parsing and VS Code diagnostic creation
- Temporary Config Files: Eliminates command line length limitations
- Diagnostic Accumulation: Maintains issues across multiple files in workspace linting
- Smart Path Resolution: Combines multiple include path sources intelligently
- System Header Filtering: Automatically excludes compiler-specific warnings
- Large Workspaces: May take significant time to process thousands of files
- Compiler Constructs: Some advanced compiler-specific features may not be recognized
- File Limit: Workspace linting limited to 2000 files for performance
- Platform Dependencies: Paths and executable locations are platform-specific
- β Windows (Primary development platform)
- β macOS (Cross-platform support)
- β Linux (Cross-platform support)
- β C files (.c)
- β C++ files (.cpp)
- β Header files (.h, .hpp)
- β Fixed: Command line length errors with temporary config files
- β Fixed: Diagnostic accumulation in workspace linting
- β Added: Comprehensive Doxygen documentation
- β Added: Multi-source include path support
- β Added: VSCode C++ extension integration
- β Added: System header filtering
- β Added: Progress reporting and cancellation
- β Improved: Error handling and user feedback
- Initial release of the PC-Lint Plus extension
- Support for individual file and workspace linting
- Integration with VS Code Problems panel
- Configuration options for paths and settings
This extension is licensed under the MIT License.
Contributions are welcome! Please feel free to:
- π Submit Issues: Report bugs or request features
- π§ Pull Requests: Contribute code improvements
- π Documentation: Help improve documentation
- π§ͺ Testing: Test on different platforms and configurations
- Node.js 14.x or higher
- npm 6.x or higher (or yarn 1.x)
- Visual Studio Code 1.60.0 or newer
- TypeScript 4.4.0 or higher (installed globally recommended)
- Git for version control
# Clone the repository
git clone <repository-url>
cd vscode-pclint-plus
# Install dependencies
npm install
# Open in VS Code
code .
# Launch extension development host
# Press F5 or run "Extension: Start Debugging"vscode-pclint-plus/
βββ src/ # TypeScript source files
β βββ extension.ts # Main extension entry point
β βββ lintRunner.ts # Core linting functionality
βββ out/ # Compiled JavaScript output
βββ images/ # Extension icons and assets
βββ assets/ # Demo images and videos
βββ package.json # Extension manifest and dependencies
βββ tsconfig.json # TypeScript configuration
βββ .vscode/ # VS Code workspace settings
β βββ launch.json # Debug configuration
β βββ tasks.json # Build tasks
βββ .vscodeignore # Files excluded from packaging
βββ README.md # This documentation
# Install dependencies (if not done already)
npm install
# Compile TypeScript to JavaScript
npm run compile
# Watch mode for development (auto-recompile on changes)
npm run watch
# Clean and rebuild
npm run clean && npm run compile# Install TypeScript globally (if not installed)
npm install -g typescript
# Compile once
tsc -p ./
# Watch mode
tsc -watch -p ./
# Check for compilation errors
tsc --noEmit -p ./- Open Command Palette (
Ctrl+Shift+P) - Run
Tasks: Run Task - Select:
npm: compile- Single compilationnpm: watch- Continuous compilationtypescript: build- TypeScript build task
# Method 1: VS Code Debug
1. Open the project in VS Code
2. Go to Run and Debug view (Ctrl+Shift+D)
3. Select "Launch Extension" configuration
4. Press F5 or click the green play button
5. New Extension Development Host window opens
6. Test your extension in the development host
# Method 2: Command Line
npm run debug{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: compile"
}
]
}# Create test workspace
mkdir test-workspace
cd test-workspace
# Create sample C files
echo '#include <stdio.h>\nint main() { return 0; }' > test.c
echo '#ifndef TEST_H\n#define TEST_H\nint test_func();\n#endif' > test.h
# Configure PC-Lint Plus settings in VS Code
# Test single file and workspace lintingnpm install -g vsce# Package for distribution (.vsix file)
vsce package
# Package with specific version
vsce package --patch
vsce package --minor
vsce package --major
# Pre-release version
vsce package --pre-release# Install the .vsix file
code --install-extension vscode-pclint-plus-*.vsix
# Or via VS Code UI:
# 1. Open Extensions view (Ctrl+Shift+X)
# 2. Click "..." menu β "Install from VSIX..."
# 3. Select your .vsix fileAdd these scripts to your package.json:
{
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"clean": "rimraf out",
"lint": "eslint src --ext ts",
"lint:fix": "eslint src --ext ts --fix",
"package": "vsce package",
"publish": "vsce publish",
"debug": "code --extensionDevelopmentPath=${PWD}"
}
}# 1. Start development session
npm run watch # Terminal 1: Continuous compilation
code . # Open VS Code
# Press F5 # Launch Extension Development Host
# 2. Make changes to TypeScript files
# 3. Changes auto-compile (watch mode)
# 4. Reload Extension Development Host (Ctrl+R)
# 5. Test changes
# 6. Repeat steps 2-5
# 7. Before committing
npm run lint # Check code style
npm run compile # Final compilation check
npm test # Run tests (if available)# Install development dependencies
npm install --save-dev @types/vscode @types/node eslint typescript
# ESLint configuration (.eslintrc.json)
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/explicit-function-return-type": "off"
}
}# 1. Update version in package.json
npm version patch|minor|major
# 2. Update CHANGELOG.md
# Document new features, fixes, breaking changes
# 3. Build and test
npm run compile
npm run lint
vsce package
# 4. Test the packaged extension
code --install-extension vscode-pclint-plus-*.vsix
# 5. Publish to marketplace
vsce publish# .github/workflows/build.yml
name: Build and Test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm install
- run: npm run compile
- run: npm run lint
- run: npm run package# TypeScript compilation errors
tsc --noEmit -p ./ # Check for type errors
# Extension not loading
# Check VS Code Developer Console (Help β Toggle Developer Tools)
# Include path issues
# Test with absolute paths first
# Check file existence with fs.existsSync()
# PC-Lint Plus execution issues
# Test command manually in terminal
# Check executable permissions on Linux/Mac// Add debug logging to lintRunner.ts
this.outputChannel.appendLine(`Debug: Command = ${fullCommand}`);
this.outputChannel.appendLine(`Debug: Working Dir = ${process.cwd()}`);
this.outputChannel.appendLine(`Debug: Args = ${JSON.stringify(args)}`);- Always run in watch mode during development
- Test both single file and workspace linting after changes
- Use the output channel for debugging information
- Test with different PC-Lint Plus configurations
- Verify cross-platform compatibility (Windows/Mac/Linux paths)
- Profile performance with large workspaces
- Handle errors gracefully with user-friendly messages
- Document complex logic with JSDoc/Doxygen comments
- GitHub Repository: [Link to your repository]
- VS Code Marketplace: [Link to marketplace page]
- PC-Lint Plus Documentation: [Link to PC-Lint Plus docs]
- Issue Tracker: [Link to issues page]
Made for C/C++ developers using PC-Lint Plus