HeadlinesBriefing favicon HeadlinesBriefing.com

Building a FreeMarker Extension for Zed

DEV Community •
×

After switching from VS Code to the faster Zed editor, a developer encountered a problem: lack of FreeMarker support. FreeMarker, despite its age, remains prevalent in Java and enterprise environments, especially within projects like Keycloak. The absence of syntax highlighting and directive understanding in Zed prompted a solution: creating a custom extension to fill the gap.

Developing the extension involved learning Zed's extension model and utilizing tree-sitter for syntax highlighting. The developer leveraged an existing FreeMarker extension for VS Code as a starting point. While the Zed extension model proved clean, the flexible nature of FreeMarker syntax presented challenges. The result of the effort is a usable extension with syntax highlighting and directive support.

The resulting Zed extension is available on GitHub. It's a testament to how open source thrives on small, niche tools solving real problems. The extension isn't perfect, but it's functional. Future improvements include better grammar coverage and error handling, with a possible Language Server Protocol (LSP) implementation down the road.

This project reflects a broader trend of developers customizing their tools to fit their workflows. It shows how the open-source community, often built on individual needs, creates specialized utilities. While FreeMarker might not be the trendiest technology, it remains essential in many projects, and this extension helps make the developer's daily work a bit easier.