Skip to content

VS Code extension PoC#85

Open
gaborcsardi wants to merge 2 commits into
mainfrom
feature/vscode
Open

VS Code extension PoC#85
gaborcsardi wants to merge 2 commits into
mainfrom
feature/vscode

Conversation

@gaborcsardi

Copy link
Copy Markdown
Member
  • Live validation of data-dict.yaml files. (Or you can configure a glob to live validate.)
  • Data validation command, call it from the command palette.

We'll need to improve some of the error locations, because e.g. a missing top-level tag currently marks the whole document, which is ok for a cli error, but does not look good in the live validation.

@gaborcsardi gaborcsardi requested a review from hadley June 24, 2026 14:11
@hadley

hadley commented Jul 2, 2026

Copy link
Copy Markdown
Member

Would you mind updating this against main? I did a bunch of work to expose better context, and the individual problems now expose a location that you should be able to use.

gaborcsardi and others added 2 commits July 4, 2026 12:41
Editors and the language server need to validate an unsaved buffer, but
`validate_spec` only takes a path and reads the file itself. Factor the
parse + `SourceContext` construction out of `load` into `load_str`, and
expose `validate_spec_str(content, filename)` as the content twin of
`validate_spec` (no I/O, so it never reports `Io`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Re-add the editor tooling on top of the current spec/meta/data
validation API. A new `data-dict-lsp` crate wraps the core validator in
a `tower-lsp` server: it publishes live spec squiggles from
`validate_spec_str` as you type, and a `data-dict.validateData` command
compares each table against its parquet `source` via `validate_data`.
Every failure is already a `Problem` carrying its severity, code, and
0-based location, so mapping to LSP diagnostics is a single path.

The CLI gains a hidden `lsp` subcommand (behind an `lsp` feature) that
serves over stdio; the VS Code extension in `editors/vscode` spawns
`data-dict lsp` and speaks standard LSP.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gaborcsardi

Copy link
Copy Markdown
Member Author

Would you mind updating this against main? I did a bunch of work to expose better context, and the individual problems now expose a location that you should be able to use.

Done.

@gaborcsardi

Copy link
Copy Markdown
Member Author

You'll probably want to merge these for easier testing:
hadley/dabstep#1
hadley/elevators#1
hadley/foodbank#1
hadley/loan-application#1
hadley/otters#2

@gaborcsardi gaborcsardi added this to the July sprint milestone Jul 6, 2026
@hadley

hadley commented Jul 6, 2026

Copy link
Copy Markdown
Member

Now merged those, and updated the examples here. Thanks!

@hadley

hadley commented Jul 7, 2026

Copy link
Copy Markdown
Member

This looks good! I'd suggest we merge and then iterate on the errors:

  • I think https://github.com/posit-dev/quarto-yaml needs some tweaks to better report locations when something is missing
  • There's something weird going on with strings? Like the span is ignoring the quotes
  • We need to tweak the rendering of "actual" in these hints as the messages currently rely on context that's not shown, i.e. the second line isn't right here:
Screenshot 2026-07-07 at 10 15 20

Then can you take a look at autocomplete? Maybe start with type? It's probably not super important since I imagine these files will mostly be created by AI (with help from the cli) but if it's not too hard to add it would be nice.

Can we add a button somewhere to make the data validation more obvious?

@hadley

hadley commented Jul 7, 2026

Copy link
Copy Markdown
Member

We should also bundle the cli in the extension like air, quarto etc, posit-dev/air#504, since I think that's a useful distribution mechanism.

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