Skip to content

Use StatementRangeSyntaxError#919

Draft
DavisVaughan wants to merge 3 commits intoquarto-dev:mainfrom
DavisVaughan:feature/statement-range-rejection
Draft

Use StatementRangeSyntaxError#919
DavisVaughan wants to merge 3 commits intoquarto-dev:mainfrom
DavisVaughan:feature/statement-range-rejection

Conversation

@DavisVaughan
Copy link
Collaborator

@DavisVaughan DavisVaughan commented Feb 18, 2026

It feels to me like we should still use the "old" hooks.d.ts system for this, because StatementRange is already tied up in that hooks.d.ts file. Mixing hooks.d.ts and types from @posit-dev/positron doesn't feel like it would be a very good idea for this extension of an existing feature, IIUC.

IIUC, we can technically go ahead and merge this even without the next Positron release due to the version guard.

To resolve

```
quarto:dev: ✘ [ERROR] Could not resolve "positron"
quarto:dev:
quarto:dev:     src/host/hooks.ts:19:23:
quarto:dev:       19 │ import * as hooks from 'positron';
```
Comment on lines +218 to +226
// TODO: Remove this once `apps/vscode/package.json` bumps to `"positron": "^2026.03.0"` or higher.
// For now we avoid aggressive bumping due to https://github.com/posit-dev/positron/issues/11321.
if (semver.gte(hooks.version, "2026.03.0")) {
if (err instanceof hooks.StatementRangeSyntaxError) {
// Rethrow syntax error with unadjusted line number, so Positron's notification will
// jump to the correct line
throw new hooks.StatementRangeSyntaxError(err.line ? unadjustedLine(vdoc.language, err.line) : undefined);
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Version guarding on the expected next positron release of "2026.03.0"

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.

1 participant

Comments