Skip to content

ts-inject.nvim 0.3.0

Choose a tag to compare

@MysticalDevil MysticalDevil released this 02 May 22:23
· 16 commits to main since this release

ts-inject.nvim v0.3.0

This release completes the migration of all host languages to generated runtime queries, introduces GraphQL and Regex injection support across multiple hosts, and significantly refactors the builder architecture for maintainability.

Changelog (v0.2.0 → v0.3.0)

Core architecture

  • Migrated all 19 host languages to fully generated runtime queries (up from 5 in v0.2.0).
  • New generated builders: c, cpp, bash, perl, php, c_sharp, kotlin, elixir, java, scala, xml, zig.
  • Extracted shared engine modules:
    • _util.lua — dispatch, prefix, and builder utilities
    • _concat.lua — binary, native, and recursive string concatenation
    • _c_family.lua — shared C/C++ injection engine
  • Unified builder signatures to build(rules, _opts) and replaced hand-written dispatch with util.build_dispatcher() across all 17 generated builders.
  • Replaced for depth = 2, MAX_CONCAT_DEPTH loops with concat.expand() in 9 builders.
  • Unified arg-index prefix generation via util.arg_prefix().
  • Rewrote rules.name_pattern_for() as lookup tables instead of 13 repetitive if branches.
  • Added early rule-kind validation in query_builder.lua with clear errors for unknown kinds.
  • Split config resolution into mode_resolver and rule_resolver.

New injection support

  • GraphQL across 9 hosts:
    • JavaScript / TypeScript: gql / graphql / gqlRequest template tags
    • Rust: *_gql / *Graphql naming suffix, content prefix, and graphql! / gql! macros
    • Python, Go, Java, Kotlin, C#, PHP, Scala: content-prefix or call-site based
  • Regex across 6 hosts:
    • Java: Pattern.compile(...) and String.matches(...) arguments
    • C#: Regex.Match(...) / Regex.Replace(...) and new Regex(...) arguments
    • PHP: preg_match / preg_replace / preg_split first argument
    • Scala: "...".r suffix and new Regex(...) arguments
    • C: regcomp(...) second argument
    • C++: std::regex(...) constructor arguments
  • C inline assembly: asm, __asm__, __asm__ volatile via gnu_asm_expression.
  • Elixir SQL: strings, sigils, <> concatenation, Ecto calls, # sql comment marker.
  • Perl SQL: strings, heredocs, DBI call sites.
  • XML MyBatis: mapper SQL tag injection.
  • Bash heredoc expansion: delimiter mappings for SQL, Python, Lua, JavaScript, TypeScript, Ruby, Perl, GraphQL, JSON, Regex.

Diagnostics and UX

  • :TSInjectDebug and :TSInjectHealth now open in centered floating windows with q / <Esc> to close.
  • Enriched :TSInjectHealth output with warnings for unsupported host/rule combinations.
  • Added generated query syntax validation before runtime installation.

Testing

  • Added tests/comprehensive.lua: 200-assertion headless suite covering all 19 hosts, custom rules, debug, and health commands.
  • Refactored smoke tests into modular structure:
    • tests/smoke/init.lua — shared utilities
    • tests/smoke/lang/*.lua — per-language assertion modules
    • tests/smoke/integration/*.lua — integration tests
  • Expanded fixture coverage: DDL, CTE, JOIN, subquery, aggregate, window functions, and GraphQL/Regex assertions.

Fixes

  • Corrected build_dispatcher static_preamble ordering (; extends now placed before preamble).
  • Fixed health.lua crash when generated query errors contained newlines.
  • Fixed PHP nowdoc SQL injection via (nowdoc_string)+ fragment matching.
  • Corrected Kotlin annotation injection rules.

Tooling and docs

  • Added scripts/preview-inject.sh (moved from tmp/) with --list, --line, parser checks, and colorized output.
  • Reorganized README/help docs: installation front-loaded, verification sections removed, configuration boundaries documented.
  • Added AGENTS.md with project conventions and validation rules.
  • Updated PLAN.md to mark 0.2 as completed.

Commits

72 commits since v0.2.0