Skip to content

feat: add VHDL language support#213

Merged
blopker merged 1 commit intoblopker:mainfrom
AmbatiThrinay:feat/add-vhdl-support
Feb 25, 2026
Merged

feat: add VHDL language support#213
blopker merged 1 commit intoblopker:mainfrom
AmbatiThrinay:feat/add-vhdl-support

Conversation

@AmbatiThrinay
Copy link
Contributor

Summary

Add VHDL as a supported language for spell checking using the tree-sitter-vhdl grammar (v1.3.1).

Changes

File Change
Cargo.toml Added tree-sitter-vhdl git dependency (not on crates.io)
crates/codebook/Cargo.toml Added workspace dependency
crates/codebook/src/queries.rs Added VHDL enum variant, language setting, match arm
crates/codebook/src/queries/vhdl.scm Tree-sitter query capturing comments, strings, identifiers
examples/example.vhd Example file with intentional spelling errors
crates/codebook/tests/test_vhdl.rs 2 tests: simple spell check + byte-position verification
README.md Added VHDL to supported languages table

Query Captures

  • Comments: line_comment, block_comment (via comment_content)
  • Strings: string_literal
  • Identifiers: entity, architecture, signal, variable, constant, function, procedure, component, type, subtype, alias declarations
  • Ports: interface_declaration, interface_signal_declaration, interface_variable_declaration, interface_constant_declaration
  • Labels: label

Testing

  • cargo test -p codebook --lib — 32/32 pass (including test_all_queries_are_valid)
  • cargo test -p codebook --test test_vhdl — 2/2 pass
  • make test — full suite passes with 0 failures

Add VHDL as a supported language for spell checking using tree-sitter-vhdl
grammar from jpt13653903/tree-sitter-vhdl (v1.3.1, git dependency).

Changes:
- Add tree-sitter-vhdl workspace and crate dependencies
- Add VHDL variant to LanguageType enum with language setting
- Create vhdl.scm query capturing comments, strings, identifiers
  (entity, architecture, signal, variable, constant, function,
  procedure, component, type, subtype, port, label, alias)
- Add example.vhd with intentional spelling errors
- Add test_vhdl.rs with simple and location verification tests
- Add VHDL to supported languages table in README
"#;
let expected = vec![
"calculatr",
"clk",
Copy link
Contributor

Choose a reason for hiding this comment

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

imho clk is a quite common term for the clock and shouldn't be an error. It should perhaps be added to word_lists/

Copy link
Owner

Choose a reason for hiding this comment

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

Very true! If you add clk to one of the word lists I'd merge that too :) Generally any common technical terms that are unlikely to be misspellings I'm happy to add to the word lists.

@blopker blopker merged commit e58a5e9 into blopker:main Feb 25, 2026
10 checks passed
@blopker
Copy link
Owner

blopker commented Feb 25, 2026

This is awesome! Thank you!

@blopker
Copy link
Owner

blopker commented Feb 26, 2026

Hm, sadly this tree-sitter parser has a few thread safety issues and is causing flaky tests in Codebook. I've opened a PR in that repo, but can't actually put this out until that's fixed: jpt13653903/tree-sitter-vhdl#61

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.

3 participants