[BUG] Syntax highlighting for Terraform/HCL (.tf, .tfvars) in desktop file viewer

Status Open
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I use Claude Code desktop daily for Azure infrastructure work in Terraform. When I open .tf or .tfvars files in the desktop app's file viewer, they render as plain monochrome text, even with a code theme selected (Monokai) under Settings > Claude Code > Code appearance. Other languages like .yaml and .json highlight correctly in the same viewer, so the theme is applied but HCL isn't recognized.

Terraform files are a large share of what Claude reads and writes in my sessions, and the file viewer is where I review its changes. Without highlighting it's much harder to scan blocks, spot strings vs. references, and see commented-out config (e.g., backend-config placeholders). I end up opening files in an external editor just to read them, which breaks the flow of reviewing Claude's work.

What Should Happen?

Add Terraform/HCL as a supported language in the desktop file viewer, mapped to .tf, .tfvars, and .hcl extensions (optionally .tftest.hcl and .terraform.lock.hcl). It should use the selected code theme like other languages, highlighting:

  • Block types and labels (resource, module, variable, terraform, backend, etc.)
  • Strings and ${} interpolation
  • Comments (#, //, / /)
  • Attribute names, numbers, booleans, and references (var., local., data., module.)

Ideally the same grammar would also apply to ``hcl and ``terraform fenced code blocks in chat, if those aren't already covered.

Error Messages/Logs

Steps to Reproduce

<img width="782" height="170" alt="Image" src="https://github.com/user-attachments/assets/af513f6a-61dc-4bc7-99c2-f0ae494fa22a" />

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude 2.16120.0 (801c07) 2026-09-29T05:47:21.000Z

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗