Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b6ea297
Add diagnostics for cells
vezwork Apr 29, 2026
0ccb875
move document listeners to diagnostics manager
seeM May 5, 2026
82be173
clear diagnostics when vdocs are closed
seeM May 5, 2026
85a2c7f
cleanup vdoc after receiving its diagnostics
seeM May 5, 2026
4728a19
use existing tempfile vdocs
seeM May 5, 2026
402bdc4
remove unused filter
seeM May 5, 2026
bbbfc48
use a local tempfile when the vscode-R extension is handling diagnostics
seeM May 5, 2026
2af58e1
forgot to remove this
seeM May 7, 2026
9be178e
add some logs
seeM May 7, 2026
e58bd97
fix files not deleting because of an unknown language
seeM May 7, 2026
43bfdfe
wip: diagnostics tests
seeM May 7, 2026
8d8847e
add disposablestore.clear and format
seeM May 11, 2026
14b5174
refining tests + cleaning up the implementation
seeM May 11, 2026
5b4e140
don't inject for diagnostic vdocs; rename to `diagnostics.ts`
seeM May 12, 2026
07d8eff
extract `allLanguages` helper function
seeM May 12, 2026
6c2c6c1
cleaning up
seeM May 13, 2026
98bc2fb
extract createVirtualDocFile from virtualDocUriFromTempFile
seeM May 13, 2026
2cdf912
rewrite diagnostics manager with flat per-language sessions
seeM May 13, 2026
e8652cc
simplify: add warmup parameter to virtualDocUriFromTempFile instead o…
seeM May 13, 2026
6a5a97b
add JSDoc to diagnostics interfaces, class, and constant
seeM May 13, 2026
185a2d5
add timeout test for non-responsive language servers
seeM May 13, 2026
4d5306d
fix async handling
seeM May 13, 2026
4ac0bff
delete all vdocs before tests
seeM May 13, 2026
32be98b
test that vdocs are cleaned up after no response timeout
seeM May 13, 2026
7f867c2
cleaner test output via QUIET env var
seeM May 13, 2026
02c04bc
don't log when vdocs are already deleted
seeM May 13, 2026
2484368
typo
seeM May 13, 2026
ff0fddb
add test coverage for vdoc cleanup, error-fix clearing, and line offsets
seeM May 13, 2026
dc22869
test that multiple cells of the same language each produce diagnostics
seeM May 13, 2026
d66b780
activate sessions concurrently
seeM May 15, 2026
c7331ac
parse tokens once per document open instead of once per language
seeM May 15, 2026
0c1229e
fix type
seeM May 15, 2026
7f1bb55
this code path was no longer used
seeM May 15, 2026
75e3682
fix type
seeM May 15, 2026
efc5bf4
revert formatting
seeM May 15, 2026
68569b1
simplify test log verbosity setting for claude
seeM May 15, 2026
6f0d4ad
clarify
seeM May 15, 2026
405fa60
move diagnostic local tempfiles to `.quarto` dir
seeM May 15, 2026
4f4b2d8
hook up quarto.cells.diagnostics.enabled setting
seeM May 15, 2026
8f8a7d1
rename
seeM May 15, 2026
4f8274d
renames
seeM May 15, 2026
aa1b744
flatten test helpers: replace withEmbeddedDiagnostics callback with n…
seeM May 15, 2026
995d7bc
cleaning up tests
seeM May 15, 2026
a4e77d1
fix stale diagnostics when last cell is removed
seeM May 15, 2026
5df2ada
fix jsdoc
seeM May 15, 2026
9691c54
add test fixture for julia-only diagnostics tests
seeM May 15, 2026
4cc2e96
simplify active vdoc cleanup
seeM May 15, 2026
4de82bc
await vdoc cleanup on extension deactivation
seeM May 15, 2026
45b3236
move event utils
seeM May 15, 2026
d37d4d0
remove unused function
seeM May 15, 2026
5a1df0f
refactor sessions to nested Map<docUri, Map<langId, session>>
seeM May 15, 2026
bfaa7a9
test vsdoc locations
seeM May 15, 2026
db96447
move toDelete into helpers
seeM May 15, 2026
4c5804f
more directly check for leaked vdocs
seeM May 15, 2026
51b6bb5
simplify test
seeM May 15, 2026
005ec5e
fix diagnostics not clearing after timeout
seeM May 15, 2026
69c07e6
dispose during deactivate
seeM May 15, 2026
3d3b10e
concurrently dispose vdocs
seeM May 15, 2026
dd37e0c
dont need this
seeM May 15, 2026
aa0671f
build new test folders too
seeM May 15, 2026
9cbebc3
convert test language server to plain JS
seeM May 18, 2026
9a63bb1
add missing typescript diagnostics test fixture
seeM May 18, 2026
eb288f5
Update changelog
vezwork May 20, 2026
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
1 change: 1 addition & 0 deletions apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.133.0

- Added diagnostics (i.e. squiggly underlines) to code cells in qmds (<https://github.com/quarto-dev/quarto/pull/980>)
- Added custom pair colorization and highlighting for divs in qmds (<https://github.com/quarto-dev/quarto/pull/973>).


Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as glob from "glob";
const args = process.argv;
const dev = args[2] === "dev";
const test = args[2] === "test";
const testFiles = glob.sync("src/test/*.ts");
const testFiles = glob.sync("src/test/{*.ts,fixtures/*.ts,utils/*.ts}");

const testBuildOptions = {
entryPoints: testFiles,
Expand Down
16 changes: 15 additions & 1 deletion apps/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,20 @@
"default": true,
"markdownDescription": "Show parameter help when editing function calls."
},
"quarto.cells.diagnostics.enabled": {
"order": 25,
"scope": "window",
"type": "boolean",
"default": true,
"markdownDescription": "Enable diagnostics (linting) for code blocks from language servers."
},
"quarto.cells.diagnostics.debounceDelay": {
"order": 26,
"scope": "window",
"type": "number",
"default": 500,
"markdownDescription": "Delay in milliseconds before updating diagnostics after document changes."
},
"quarto.cells.background.enabled": {
"type": "boolean",
"description": "Enable coloring the background of executable code cells.",
Expand Down Expand Up @@ -1049,7 +1063,7 @@
"markdownDescription": "Millisecond delay between background color updates."
},
"quarto.cells.useReticulate": {
"order": 25,
"order": 27,
"scope": "window",
"type": "boolean",
"default": true,
Expand Down
24 changes: 1 addition & 23 deletions apps/vscode/src/lsp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
Definition,
LogOutputChannel,
Uri,
Diagnostic,
window,
ColorThemeKind
} from "vscode";
Expand All @@ -49,7 +48,6 @@ import {
ProvideHoverSignature,
ProvideSignatureHelpSignature,
State,
HandleDiagnosticsSignature
} from "vscode-languageclient";
import { MarkdownEngine } from "../markdown/engine";
import {
Expand All @@ -58,7 +56,6 @@ import {
virtualDoc,
withVirtualDocUri,
} from "../vdoc/vdoc";
import { isVirtualDoc } from "../vdoc/vdoc-tempfile";
import { activateVirtualDocEmbeddedContent } from "../vdoc/vdoc-content";
import { vdocCompletions } from "../vdoc/vdoc-completion";

Expand All @@ -79,7 +76,7 @@ export async function activateLsp(
context: ExtensionContext,
quartoContext: QuartoContext,
engine: MarkdownEngine,
outputChannel: LogOutputChannel
outputChannel: LogOutputChannel,
) {

// The server is implemented in node
Expand All @@ -105,7 +102,6 @@ export async function activateLsp(
const config = workspace.getConfiguration("quarto");
activateVirtualDocEmbeddedContent();
const middleware: Middleware = {
handleDiagnostics: createDiagnosticFilter(),
provideCompletionItem: embeddedCodeCompletionProvider(engine),
provideDefinition: embeddedGoToDefinitionProvider(engine),
provideDocumentFormattingEdits: embeddedDocumentFormattingProvider(engine),
Expand Down Expand Up @@ -363,21 +359,3 @@ function isWithinYamlComment(doc: TextDocument, pos: Position) {
const line = doc.lineAt(pos.line).text;
return !!line.match(/^\s*#\s*\| /);
}

/**
* Creates a diagnostic handler middleware that filters out diagnostics from virtual documents
*
* @returns A handler function for the middleware
*/
export function createDiagnosticFilter() {
return (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => {
// If this is not a virtual document, pass through all diagnostics
if (!isVirtualDoc(uri)) {
next(uri, diagnostics);
return;
}

// For virtual documents, filter out all diagnostics
next(uri, []);
};
}
8 changes: 8 additions & 0 deletions apps/vscode/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { tryAcquirePositronApi } from "@posit-dev/positron";
import { MarkdownEngine } from "./markdown/engine";
import { kQuartoDocSelector } from "./core/doc";
import { activateLsp, deactivate as deactivateLsp } from "./lsp/client";
import { activateEmbeddedDiagnostics, type EmbeddedDiagnosticsService } from "./providers/diagnostics";
import { cellCommands } from "./providers/cell/commands";
import { quartoCellExecuteCodeLensProvider } from "./providers/cell/codelens";
import { activateQuartoAssistPanel } from "./providers/assist/panel";
Expand Down Expand Up @@ -51,6 +52,8 @@ import { activateDivBracketDecorations } from "./providers/div-brackets";
import { CommandManager } from "./core/command";
import { createQuartoExtensionApi, QuartoExtensionApi } from "./api";

let embeddedDiagnostics: EmbeddedDiagnosticsService | undefined;

/**
* Entry point for the entire extension! This initializes the LSP, quartoContext, extension host, and more...
*/
Expand Down Expand Up @@ -118,6 +121,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<Quarto
// deno config
activateDenoConfig(context, engine);

// embedded diagnostics
embeddedDiagnostics = activateEmbeddedDiagnostics(engine, outputChannel);
context.subscriptions.push(embeddedDiagnostics);

// lsp
const lspClient = await activateLsp(context, quartoContext, engine, outputChannel);

Expand Down Expand Up @@ -283,5 +290,6 @@ function registerQuartoPathConfigListener(context: vscode.ExtensionContext, outp
}

export async function deactivate() {
await embeddedDiagnostics?.deactivate();
return deactivateLsp();
}
Loading
Loading