Skip to content

Commit 5fa7422

Browse files
committed
feat: replace brace matching with property-argument highlighting
- Remove redundant brace matching feature - Add property-argument highlighting that visually connects template properties with their corresponding arguments when cursor is positioned - Update documentation to reflect the feature change
1 parent e27ceed commit 5fa7422

File tree

9 files changed

+947
-658
lines changed

9 files changed

+947
-658
lines changed

CLAUDE.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ The extension follows a modular architecture designed for performance and mainta
2020
- `expressionTokenizer.ts` - Tokenizes Serilog.Expressions syntax
2121
- `stringLiteralParser.ts` - Detects C# string literals (regular, verbatim, raw)
2222

23-
2. **Decorations** (`src/decorations/`) ✅
23+
2. **Providers** (`src/providers/`) ✅
24+
- `navigationProvider.ts` - Code actions for navigating from properties to arguments
25+
- `propertyArgumentHighlighter.ts` - Highlights template properties and their corresponding arguments
26+
27+
3. **Decorations** (`src/decorations/`) ✅
2428
- `decorationManager.ts` - Manages text decorations for highlighting (replaces semantic tokens)
2529

26-
3. **Utilities** (`src/utils/`) ✅
30+
4. **Utilities** (`src/utils/`) ✅
2731
- `serilogCallDetector.ts` - Identifies Serilog method calls in C# code
2832
- `cacheManager.ts` - LRU cache for parsed templates (max 100 entries)
2933
- `themeManager.ts` - Theme-aware color management
@@ -84,6 +88,8 @@ vsce publish
8488
- **Theme Management**: Automatic theme detection and WCAG AA compliant colors
8589
- **Testing Infrastructure**: Jest setup with comprehensive test coverage
8690
- **Configuration**: Extensive user customization options
91+
- **Property-Argument Highlighting**: Cursor-based highlighting showing connection between properties and arguments
92+
- **Navigation Provider**: Code actions to jump from properties to their arguments
8793

8894
### 🚫 Not Implemented (by design)
8995
- **Semantic Tokens Provider**: Replaced with decoration-based approach for better control

Example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Open `Program.cs` in Visual Studio with the Serilog Syntax extension installed t
9494
Colors automatically adapt for light themes with WCAG AA compliant contrast ratios - darker variants of the same color families for optimal readability on light backgrounds.
9595

9696
### Interactive Features
97-
- **Brace matching** when cursor is on `{` or `}`
97+
- **Property-Argument highlighting** when cursor is on a property or argument
9898
- **Light bulb navigation** from properties to arguments
9999
- **Immediate highlighting** as you type (before closing quotes)
100100
- **Multi-line support** for verbatim and raw strings

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ A Visual Studio Code extension that provides syntax highlighting and enhanced su
4747
- **Navigate to argument** - jump from template properties to their corresponding arguments
4848
- Click the light bulb and select "Navigate to 'PropertyName' argument"
4949

50-
### 🔍 Brace Matching
51-
- **Highlight matching braces** when cursor is positioned on `{` or `}`
52-
- Visual indication of brace pairs in complex templates
53-
- **Multi-line support** - matches braces across line boundaries in verbatim and raw strings
54-
- Press **ESC** to temporarily dismiss highlights
55-
- Helps identify mismatched or nested braces
50+
### 🎯 Property-Argument Highlighting
51+
- **Synchronous highlighting** of template properties and their corresponding arguments
52+
- Position cursor on a property like `{UserId}` to highlight both the property (including braces) and its argument
53+
- Position cursor on an argument to highlight it and its template property
54+
- Includes quotes when highlighting string arguments (e.g., `"userId"`)
55+
- Helps visualize the connection between template properties and their values
5656

5757
## Installation
5858

@@ -72,6 +72,7 @@ A Visual Studio Code extension that provides syntax highlighting and enhanced su
7272

7373
### Basic Settings
7474
- `serilog.enabled` - Enable/disable Serilog syntax highlighting
75+
- `serilog.propertyArgumentHighlighting` - Enable/disable property-argument pair highlighting when cursor is positioned on either
7576

7677
### Theme-Aware Colors & Accessibility
7778
The extension automatically adapts to your VS Code theme with **WCAG AA compliant colors**:

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
"default": true,
4343
"description": "Enable/disable Serilog syntax highlighting"
4444
},
45+
"serilog.propertyArgumentHighlighting": {
46+
"type": "boolean",
47+
"default": true,
48+
"description": "Enable property-argument pair highlighting when cursor is positioned on either"
49+
},
4550
"serilog.colors.property": {
4651
"type": "string",
4752
"default": "#569CD6",

src/extension.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { DecorationManager } from './decorations/decorationManager';
77
import { CacheManager } from './utils/cacheManager';
88
import { Debouncer } from './utils/debouncer';
99
import { ThemeManager } from './utils/themeManager';
10-
import { SerilogBraceMatchProvider } from './providers/braceMatchProvider';
1110
import { SerilogNavigationProvider, registerNavigationCommand } from './providers/navigationProvider';
11+
import { PropertyArgumentHighlighter } from './providers/propertyArgumentHighlighter';
1212

1313
export function activate(context: vscode.ExtensionContext) {
1414
// Create output channel for logging
@@ -35,8 +35,6 @@ export function activate(context: vscode.ExtensionContext) {
3535
const debouncer = new Debouncer(100); // 100ms delay
3636

3737
// Initialize brace matching provider
38-
const braceMatchProvider = new SerilogBraceMatchProvider();
39-
context.subscriptions.push(braceMatchProvider);
4038

4139
// Initialize navigation provider
4240
const navigationProvider = new SerilogNavigationProvider();
@@ -53,6 +51,10 @@ export function activate(context: vscode.ExtensionContext) {
5351
// Register navigation command
5452
context.subscriptions.push(registerNavigationCommand());
5553

54+
// Initialize property-argument highlighter
55+
const propertyArgumentHighlighter = new PropertyArgumentHighlighter();
56+
context.subscriptions.push(propertyArgumentHighlighter);
57+
5658
function updateDecorations() {
5759
const config = vscode.workspace.getConfiguration('serilog');
5860
const enabled = config.get<boolean>('enabled', true);
@@ -373,15 +375,13 @@ export function activate(context: vscode.ExtensionContext) {
373375
// Listen for cursor position changes to update brace matching
374376
vscode.window.onDidChangeTextEditorSelection(event => {
375377
if (event.textEditor === vscode.window.activeTextEditor) {
376-
braceMatchProvider.updateBraceMatching(event.textEditor);
377378
}
378379
}, null, context.subscriptions);
379380

380381
// Listen for active editor changes
381382
vscode.window.onDidChangeActiveTextEditor(editor => {
382383
if (editor) {
383384
updateDecorations();
384-
braceMatchProvider.updateBraceMatching(editor);
385385
}
386386
}, null, context.subscriptions);
387387

0 commit comments

Comments
 (0)