Skip to content

feat: HCL/Terraform + R language support, telemetry fix (#108, #215, #216)#257

Merged
justrach merged 1 commit intorelease/v0.2.57from
feat/language-support-and-telemetry
Apr 13, 2026
Merged

feat: HCL/Terraform + R language support, telemetry fix (#108, #215, #216)#257
justrach merged 1 commit intorelease/v0.2.57from
feat/language-support-and-telemetry

Conversation

@justrach
Copy link
Copy Markdown
Owner

Summary

  • Bug: php and ruby missing from telemetry reporting #216 — Fix PHP/Ruby (and new HCL/R) missing from telemetry writeLanguages array — names now match Language enum order exactly
  • Add HCL/Terraform language support #108 — HCL/Terraform language support: resource, data, module, variable, output, provider, locals, terraform block parsing; .tf/.tfvars/.hcl detection; #/////* */ comment handling; .terragrunt-cache added to skip_dirs
  • feat: Add R language support #215 — R language support: name <- function() / name = function() assignment, setClass()/setRefClass() class defs, library()/require() imports; .r/.R detection; # comment handling

Test plan

  • All existing tests pass (zig build test — exit 0)
  • 5 new HCL tests: resource, variable/output, module/provider, comment skipping, language detection
  • 5 new R tests: function assignment, library imports, setClass/setRefClass, language detection
  • Manual: codedb_outline on a .tf file returns resource/variable/output symbols
  • Manual: codedb_outline on an .R file returns function/class/import symbols

🤖 Generated with Claude Code

…ng (#108, #215, #216)

- #216: add missing php/ruby/hcl/r entries to telemetry writeLanguages array
- #108: add HCL language support — resource, data, module, variable, output,
  provider, locals, terraform blocks; .tf/.tfvars/.hcl detection; #//* block
  comment handling; .terragrunt-cache in skip_dirs
- #215: add R language support — function assignment (<-/=), setClass/setRefClass,
  library/require imports; .r/.R detection; # comment handling
- 10 new tests covering all HCL and R parser paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justrach justrach merged commit 3859284 into release/v0.2.57 Apr 13, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

Benchmark Regression Report

Threshold: 10.00%

Tool Base (ns) Head (ns) Delta Status
codedb_bundle 653114 669331 +2.48% OK
codedb_changes 108248 109008 +0.70% OK
codedb_deps 30683 29775 -2.96% OK
codedb_edit 23401 25943 +10.86% FAIL
codedb_find 140455 139946 -0.36% OK
codedb_hot 149311 152829 +2.36% OK
codedb_outline 458948 418889 -8.73% OK
codedb_read 148279 142395 -3.97% OK
codedb_search 287229 280161 -2.46% OK
codedb_snapshot 4260270 4215914 -1.04% OK
codedb_status 257225 262851 +2.19% OK
codedb_symbol 64325 64816 +0.76% OK
codedb_tree 85079 84407 -0.79% OK
codedb_word 91342 95020 +4.03% OK

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b25d92f270

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +95 to +96
hcl,
r,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve Language enum values used in snapshot serialization

Inserting .hcl and .r here shifts the numeric values of existing variants (markdown/json/yaml/unknown), but snapshot persistence stores Language as raw enum bytes (@intFromEnum when writing and intToEnum when reading in snapshot.zig) without a migration path, so pre-upgrade snapshots will silently deserialize to the wrong language tags after this change. Because the loader accepts older snapshots, this causes incorrect language metadata in restored outlines; new variants should be appended (or explicit discriminants/versioned migration should be used).

Useful? React with 👍 / 👎.

errdefer a.free(name_copy);
const detail_copy = try a.dupe(u8, line);
errdefer a.free(detail_copy);
try outline.symbols.append(a, .{ .name = name_copy, .kind = .struct_def, .line_start = line_num, .line_end = line_num, .detail = detail_copy });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compute line_end for HCL block symbols

HCL resource/data/locals/terraform entries are emitted as .struct_def, but computeSymbolEnds only expands block ranges for the existing brace-language set and does not include .hcl, so these symbols keep line_end == line_start. In practice, symbol body and enclosing-symbol queries on .tf/.hcl files will return only the declaration line instead of the full block.

Useful? React with 👍 / 👎.

Comment on lines +2071 to +2072
if (std.mem.indexOf(u8, line, "<- function(") != null or std.mem.indexOf(u8, line, "= function(") != null) {
const assign_pos = std.mem.indexOf(u8, line, "<-") orelse std.mem.indexOf(u8, line, "=") orelse return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Anchor R function parsing to top-level assignments

This condition matches = function( anywhere in the line, then splits at the first =; common R calls like lapply(x, FUN = function(...) ...) are therefore misindexed as top-level function definitions with invalid names (e.g. lapply(x, FUN). Restricting detection to lines where a standalone identifier is directly assigned to function( would avoid these false symbols.

Useful? React with 👍 / 👎.

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