A Visual Studio Code extension that provides intelligent array variable completion for C/C++ files. Automatically detects array declarations and offers completions with pre-filled bracket notation, making array indexing faster and more efficient.
Features
Automatically detects array variables in your C/C++ code
Provides smart completions with bracket notation already included
Generates appropriate number of bracket pairs [][]...
Interactive snippet completion:
Tab through each array index
Default index value of 0 for quick editing
Prioritized sorting:
Array completions appear at the top of the suggestion list
Usage
Declare an array variable in your C/C++ file
Start typing the array variable name
Select the array completion from the suggestion list
Use Tab to navigate between index positions
Example
// Declare arrays
int numbers[10];
int matrix[5][5];
int tensor[3][4][5];
// Start typing and get completions
num // Type 'num' and select completion
// Result: numbers[0] (cursor on index, Tab to accept)
mat // Type 'mat' and select completion
// Result: matrix[0][0] (Tab through each index)
ten // Type 'ten' and select completion
// Result: tensor[0][0][0] (Tab through each index)
Array Declaration Examples
The extension detects various array declaration patterns:
// 1D arrays
int array1[10];
float values[SIZE];
// 2D arrays
int matrix[5][5];
char grid[10][20];
// 3D arrays
double cube[3][4][5];
// Arrays with named size constants
int data[MAX_SIZE];
char buffer[ROWS][COLS];
Supported File Types
The extension activates for the following languages:
C (.c)
C++ (.cpp)
Requirements
Visual Studio Code version 1.96.0 or higher
How It Works
Detection: Scans the entire document for array variable declarations
Analysis: Determines the number of dimensions for each array
Completion: Generates snippet completions with placeholder indices
Navigation: Allows Tab key navigation through each index position
Known Limitations
Only detects arrays declared in the currently open document
Basic pattern matching may not catch all complex array declarations
Does not track array scope (local vs global)
Arrays declared in header files must be included in the current file to be detected
Tips
The extension prioritizes array completions, so they appear at the top of the suggestion list
Default index value is 0 - simply press Tab to accept and move to the next index
Works with both numeric literals and constant names in array size declarations
Release Notes
1.0.0
Initial release
Multi-dimensional array detection
Intelligent bracket completion
Tab navigation through array indices
Support for C and C++ files
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.