terragrunt-ls This Week: values Block, commands Variables and LSP Protocol Fixes

terragrunt-ls is the language server behind Terragrunt editor support, with completion, hover and go to definition for HCL config files. I looked at the last week of activity: nine commits, with new language features for the values block and commands variables, and three protocol level fixes that matter to anyone editing large or non ASCII files.

The terragrunt-ls repository saw most of its changes between December 1 and December 3.

New variable and block support

Three feature changes landed, all in the same area: teaching the server about names that Terragrunt exposes inside config files.

The result is that completion now covers attribute and block names, the fields of path and commands, and values.<name>. The updated server capabilities doc says exactly this. After typing path. the server suggests the fields the file can read. The same idea now applies to commands..

The commands work arrived as three commits, including a data update for the variables. A new snapshot doc, internal/docs/snapshot/variables/commands.md, backs the hover text.

The test change in the last commit is a nice detail. The old check only compared the length of locking_commands. The newer one compares the actual values to config.TerraformCommandsNeedLocking. A length check would pass with the wrong contents.

unit "vpc" {
  values = {
    locking_commands = commands.locking
  }
}

Treat that snippet as an illustration of the shape, not a copy of the tests.

Position handling and large messages

Two fixes touch the LSP transport and positions, and both are the kind of bug that shows up only on real projects.

Counting LSP positions in UTF 16 code units (#209) is the more subtle one. The LSP specification measures character offsets in UTF 16 code units by default. A server that counts bytes or runes drifts as soon as a line has a non ASCII character. Diagnostics, hover and completion then land a few columns off. If you keep comments or strings with accents or emoji in your terragrunt.hcl, this fix is for you.

Reading LSP messages larger than 64 KiB (#218) fixes a classic buffer limit. A large file sent in a didOpen or didChange message could exceed a default scanner size. Large generated configs are the likely trigger.

Go to definition guard

A guard for a non string config_path (#219) covers go to definition on dependency blocks. If config_path is not a plain string, for example an expression that evaluates to something else, the server now stops instead of failing on the value. The change touches internal/tg/definition/definition.go. It is a small guard, but language servers should never crash on half typed input.

Internal parsing and dependency bumps

There is also a refactor that parses unit buffers through the config Store (#212). It is mostly internal. The most touched files, internal/tg/state.go, internal/tg/parse.go and internal/tg/completion/completion.go, show where the work happened.

Two Dependabot updates went in as well: an npm group bump for the VS Code extension (#214) and jdx/mise-action 5.2.7 to 5.3.0 (#210). Routine.

What to watch

  • Check completion after values. and commands. in your editor. Hover text for the new variables comes from embedded Terragrunt docs, so gaps there are likely doc snapshot gaps.
  • If you saw misplaced diagnostics on lines with non ASCII text, retest after updating.
  • Expect follow ups on other Terragrunt variables, since each feature so far added one more name family to the same completion path.

← All updates