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
14 changes: 8 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ This extension provides syntax highlighting and navigation for Serilog message t
- **Syntax highlighting** for Serilog.Expressions filter syntax and expression templates
- **Navigation** support (Go to Definition) between template properties and arguments
- **Brace matching** for template property delimiters and expression templates
- **Property-argument highlighting** shows connections between properties and arguments on cursor position

### Technical Stack
- **Roslyn Classification API** - For syntax highlighting via `IClassifier`
Expand Down Expand Up @@ -194,14 +195,15 @@ The extension includes these components:
3. **Classification/SerilogClassifierProvider.cs** - MEF export for classifier
4. **Navigation/SerilogNavigationProvider.cs** - Navigation from properties to arguments via light bulb
5. **Tagging/SerilogBraceMatcher.cs** - Implements `ITagger<TextMarkerTag>` for brace matching
6. **Utilities/SerilogCallDetector.cs** - Centralized Serilog call detection logic
7. **Utilities/LruCache.cs** - Thread-safe LRU cache for parsed templates
6. **Tagging/PropertyArgumentHighlighter.cs** - Implements `ITagger<TextMarkerTag>` for property-argument highlighting
7. **Utilities/SerilogCallDetector.cs** - Centralized Serilog call detection logic
8. **Utilities/LruCache.cs** - Thread-safe LRU cache for parsed templates

#### Serilog.Expressions Support
8. **Expressions/ExpressionTokenizer.cs** - Tokenizes Serilog.Expressions syntax
9. **Expressions/ExpressionParser.cs** - Parses expressions and templates into classified regions
10. **Expressions/ExpressionDetector.cs** - Detects expression contexts (filter, template, etc.)
11. **Classification/SyntaxTreeAnalyzer.cs** - Roslyn-based analysis for expression contexts
9. **Expressions/ExpressionTokenizer.cs** - Tokenizes Serilog.Expressions syntax
10. **Expressions/ExpressionParser.cs** - Parses expressions and templates into classified regions
11. **Expressions/ExpressionDetector.cs** - Detects expression contexts (filter, template, etc.)
12. **Classification/SyntaxTreeAnalyzer.cs** - Roslyn-based analysis for expression contexts

### Performance Considerations
- LRU cache for parsed templates (10x improvement for repeated templates)
Expand Down
4 changes: 2 additions & 2 deletions Example/ExampleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ExampleService(ILogger<ExampleService> logger)
{
private static readonly string[] consoleLoggerScopes = [nameof(RunExamplesAsync), nameof(ConsoleLoggerEmulationExample)];
private static readonly string[] ConsoleLoggerScopes = [nameof(RunExamplesAsync), nameof(ConsoleLoggerEmulationExample)];

public async Task RunExamplesAsync()
{
Expand Down Expand Up @@ -512,7 +512,7 @@ private async Task ConsoleLoggerEmulationExample()
program.Information("Host listening at {ListenUri}", "https://hello-world.local");

program
.ForContext("Scope", consoleLoggerScopes)
.ForContext("Scope", ConsoleLoggerScopes)
.Information("HTTP {Method} {Path} responded {StatusCode} in {Elapsed:0.000} ms", "GET", "/api/hello", 200, 1.23);

program.Warning("We've reached the end of the line");
Expand Down
1 change: 1 addition & 0 deletions Example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Open `Program.cs` in Visual Studio with the Serilog Syntax extension installed t
### Interactive Features
- **Brace matching** when cursor is on `{` or `}`
- **Light bulb navigation** from properties to arguments
- **Property-argument highlighting** when cursor is on either a property or argument
- **Immediate highlighting** as you type (before closing quotes)
- **Multi-line support** for verbatim and raw strings

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ A Visual Studio 2022 extension that provides syntax highlighting, brace matching
- **Navigate to argument** - jump from template properties to their corresponding arguments
- Click the light bulb and select "Navigate to 'PropertyName' argument"

### 🔦 Property-Argument Highlighting
- **Interactive highlighting** of property-argument connections
- When cursor is on a template property (e.g., `{UserId}`), both the property and its corresponding argument are highlighted
- When cursor is on an argument, both the argument and its template property are highlighted
- Works across all string literal types (regular, verbatim `@"..."`, raw `"""..."""`)
- Supports complex scenarios including multi-line templates, collection expressions, and LogError with exception parameters

### 🔍 Brace Matching
- Highlight matching braces when cursor is positioned on `{` or `}`
- Visual indication of brace pairs in complex templates
Expand Down Expand Up @@ -246,6 +253,7 @@ Key components:
- `SerilogClassifier` - Handles syntax highlighting with smart cache invalidation
- `SerilogBraceMatcher` - Provides brace matching
- `SerilogNavigationProvider` - Enables property-to-argument navigation
- `PropertyArgumentHighlighter` - Highlights property-argument connections on cursor position
- `SerilogCallDetector` - Optimized Serilog call detection with pre-check optimization
- `SerilogThemeColors` - Theme-aware color management with WCAG AA compliance
- `TemplateParser` - Parses Serilog message templates
Expand Down
Loading
Loading