Skip to content

Analyzer back#361

Merged
ErikEJ merged 2 commits into
mainfrom
analyzer-back
Jun 10, 2026
Merged

Analyzer back#361
ErikEJ merged 2 commits into
mainfrom
analyzer-back

Conversation

@ErikEJ

@ErikEJ ErikEJ commented Jun 10, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 10, 2026 05:49
@ErikEJ ErikEJ merged commit 6bac6f6 into main Jun 10, 2026
1 check passed
@ErikEJ ErikEJ deleted the analyzer-back branch June 10, 2026 05:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reintroduces/extends live T-SQL static analysis in the SSMS VSIX by adding editor squiggles (tagger) and Error List integration backed by a shared analysis cache, plus small supporting project/UX updates across the solution.

Changes:

  • Added SSMS-side live linting pipeline: SqlAnalysisCache + editor tagger + Error List table data source/listeners.
  • Added configuration/UX support for analyzer usage (new option to disable live analysis; updated rules-package messaging; broadened rules package detection/installation).
  • Updated project settings/dependencies (LangVersion alignment; DacFx/SqlClient version adjustments; minor PackageReference metadata tweak).

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Vsix/Vsix.csproj Aligns C# language version setting with repo build props.
src/SsmsVsix/SsmsVsix.csproj Aligns language version; adjusts a PackageReference ExcludeAssets value casing.
src/SsmsVsix/Linter/Tagging/SqlLintTaggerProvider.cs MEF tagger provider that conditionally enables SQL lint tagger per options/project settings.
src/SsmsVsix/Linter/Tagging/SqlLintTagger.cs Tagger that converts cached analysis results into editor error/warning squiggles.
src/SsmsVsix/Linter/Tagging/LintResult.cs Tracks lint violations via tracking spans for snapshot translation.
src/SsmsVsix/Linter/Linting/SqlAnalyzerDiagnosticInfo.cs Diagnostic DTO for analyzer results (range/message/code/link).
src/SsmsVsix/Linter/Linting/SqlAnalysisCache.cs Shared analysis cache with immediate + debounced analysis triggering.
src/SsmsVsix/Linter/Linting/PendingAnalysis.cs Tracks pending analysis CTS + snapshot version per buffer.
src/SsmsVsix/Linter/Linting/DiagnosticSeverity.cs Defines severity levels for lint diagnostics.
src/SsmsVsix/Linter/Linting/CachedAnalysisResult.cs Stores cached violations tied to a snapshot version.
src/SsmsVsix/Linter/Linting/AnalyzerUtilities.cs Runs tsqlanalyze, parses output, returns diagnostics.
src/SsmsVsix/Linter/Linting/AnalysisUpdatedEventArgs.cs Event args for publishing updated analysis results.
src/SsmsVsix/Linter/ErrorList/TableEntriesSnapshot.cs Error List snapshot implementation for SQL lint errors.
src/SsmsVsix/Linter/ErrorList/SqlLintTableDataSource.cs Error List table source; manages per-file snapshots and sink subscriptions.
src/SsmsVsix/Linter/ErrorList/SqlLintError.cs Maps diagnostics to Error List entry fields/severity.
src/SsmsVsix/Linter/ErrorList/SqlDocumentListener.cs Hooks document creation to attach an Error List handler.
src/SsmsVsix/Linter/ErrorList/SinkManager.cs Manages sink subscription lifetime.
src/SsmsVsix/Linter/ErrorList/DocumentHandler.cs Listens to shared cache updates and pushes entries to Error List.
src/SsmsVsix/Dialogs/ManageRulesDialog.xaml Updates UI text to mention additional rules package.
src/SqlServer.Rules.Report/SqlServer.Rules.Report.csproj Adjusts DacFx package version.
src/Shared/Options/ToolOptions.cs Adds option to disable live code analysis.
src/Shared/Extensions/ProjectExtension.cs Recognizes/installs both SQL rules packages (SqlServer.Rules + TSQLSmellSCA).
src/DacFXToolLib/DacFXToolLib.csproj Adjusts SqlClient and DacFx package versions (including a preview DacFx).

Comment on lines +76 to +95
private async Task PerformAnalysisAsync(ITextBuffer buffer, string filePath, string sqlVersion, string rules, string projectName, ITextSnapshot snapshot, string text, CancellationToken cancellationToken)
{
try
{
await Task.Delay(_debounceDelayMs, cancellationToken);

if (!cancellationToken.IsCancellationRequested)
{
PerformAnalysis(buffer, snapshot, text, filePath, sqlVersion, rules, projectName, cancellationToken);
}
}
catch (OperationCanceledException)
{
// Expected when user types again before delay expires
}
catch (ObjectDisposedException)
{
// CancellationTokenSource was disposed - this is fine, just stop
}
}
Comment on lines +18 to +26
public SqlAnalyzerDiagnosticInfo(Range range, string message, string errorCode, Uri helpLink)
{
this.Range = range;
this.Message = message;
this.ErrorCode = errorCode;
this.HelpLink = helpLink;
}

public Uri HelpLink { get; set; }
Comment on lines +78 to +92
lock (_snapshots)
{
if (_snapshots.TryGetValue(filePath, out TableEntriesSnapshot oldSnapshot))
{
_snapshots.Remove(filePath);
NotifySinks(sink => sink.RemoveSnapshot(oldSnapshot));
}

if (errors.Count > 0)
{
var snapshot = new TableEntriesSnapshot(filePath, errors);
_snapshots[filePath] = snapshot;
NotifySinks(sink => sink.AddSnapshot(snapshot));
}
}
Comment on lines +55 to +62
// Send existing snapshots to new sink
lock (_snapshots)
{
foreach (TableEntriesSnapshot snapshot in _snapshots.Values)
{
sink.AddSnapshot(snapshot);
}
}
Comment on lines +102 to +109
lock (_snapshots)
{
if (_snapshots.TryGetValue(filePath, out TableEntriesSnapshot snapshot))
{
_snapshots.Remove(filePath);
NotifySinks(sink => sink.RemoveSnapshot(snapshot));
}
}
Comment on lines +114 to +122
lock (_snapshots)
{
foreach (TableEntriesSnapshot snapshot in _snapshots.Values)
{
NotifySinks(sink => sink.RemoveSnapshot(snapshot));
}

_snapshots.Clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants