Herb is a new command-line tool and Rust library designed to improve the developer experience of working with ERB (Embedded Ruby) templates. It focuses on accurate and efficient parsing of HTML-aware ERB, addressing issues like incorrect syntax highlighting and code completion in existing tools. Herb offers features such as syntax highlighting, formatting, linting (with custom rules), and symbolic renaming within ERB templates, enabling more productive development and refactoring of complex view logic. By understanding the underlying HTML structure, Herb can provide more contextually relevant results and prevent issues common in tools that treat ERB as plain text or simple HTML. It aims to become an essential tool for Ruby on Rails developers and anyone working extensively with ERB.
The Postgres Language Server, now in its initial release, brings rich IDE features like auto-completion, hover hints, go-to-definition, and diagnostics to PostgreSQL development. Built using Rust and Tree-sitter, it parses SQL and PL/pgSQL, offering improved developer experience within various code editors and IDEs via the Language Server Protocol (LSP). While still early in its development, the project aims to enhance PostgreSQL coding workflows with intelligent assistance and real-time feedback.
Hacker News users generally expressed enthusiasm for the Postgres Language Server, praising its potential and the effort put into its development. Some highlighted its usefulness for features like auto-completion, go-to-definition, and hover information within SQL editors. A few commenters compared it favorably to existing tools, suggesting it could be a superior alternative. Others discussed specific desired features, such as integration with pgTAP for testing and improved support for PL/pgSQL. There was also interest in the project's roadmap, with inquiries about planned support for other PostgreSQL features.
This blog post details how to implement custom syntax highlighting in Emacs using tree-sitter. The author demonstrates creating a minor mode for highlighting TODO items and FIXMEs in comments within C++ code. This involves defining specific queries that target the comment nodes in the tree-sitter parse tree and then associating faces (colors and styles) with the captured nodes. The example provides a practical illustration of leveraging tree-sitter's structured code understanding to achieve more precise and context-aware highlighting than traditional regular expression-based approaches. The post also briefly covers how to incorporate these queries into a theme for broader application and includes a troubleshooting tip for ensuring tree-sitter highlighting is active.
HN commenters largely praised the integration of tree-sitter into Emacs, highlighting the significant improvements in syntax highlighting accuracy and performance. Some expressed excitement over the potential for more advanced features like semantic highlighting and code navigation enabled by tree-sitter's deeper understanding of code structure. A few users shared their personal experiences with setting up and using tree-sitter in Emacs, offering tips and workarounds for common issues. One commenter noted the wider adoption of tree-sitter across various editors and its positive impact on the developer experience. Others discussed the technical details of tree-sitter's implementation, comparing it to traditional regular expression-based highlighting. A couple of comments touched on the potential for future improvements, such as asynchronous parsing and better support for more obscure languages.
Summary of Comments ( 3 )
https://news.ycombinator.com/item?id=43704853
Hacker News users generally praised Herb for its innovative approach to templating, particularly its HTML-awareness and the potential for improved refactoring capabilities. Some expressed excitement about its ability to parse and manipulate ERB templates more effectively than existing tools. A few commenters questioned the long-term viability of the project given its reliance on Tree-sitter, citing potential maintenance challenges and parser bugs. Others were curious about specific use cases and integration with existing Ruby tooling. Performance concerns and the overhead introduced by parsing were also mentioned, but overall the reception was positive, with many expressing interest in trying out Herb.
The Hacker News post titled "Herb: Powerful and seamless HTML-aware ERB parsing and tooling" has generated several comments discussing the merits and potential drawbacks of the Herb tool.
Several commenters express enthusiasm for the project, praising its ability to address the challenges of working with ERB templates, particularly within complex HTML structures. One user highlights the difficulty of refactoring ERB and how Herb seems to offer a solution to this long-standing problem. Another appreciates the ability to rename components and the potential time savings this feature offers. The clean and appealing design of the website is also mentioned positively.
Some users raise concerns and questions. One commenter questions the performance implications of parsing HTML and ERB simultaneously, expressing a preference for precompiling ERB to avoid runtime parsing overhead. This sparks a discussion about the performance characteristics of various templating approaches, with another user suggesting that the performance concerns might be negligible in many real-world scenarios. The maintainability of generated code is also raised as a potential issue.
Another thread of discussion revolves around the choice of Ruby as the implementation language for Herb. One commenter expresses a desire for similar tooling in other languages, specifically mentioning Elixir. This leads to a brief discussion about the availability (or lack thereof) of comparable tools in different ecosystems.
A few users share their personal experiences and workflows related to templating languages, offering alternative approaches and suggesting potential integrations with other tools. One user mentions using a custom DSL for templates, highlighting the benefits of a domain-specific approach.
Overall, the comments reflect a generally positive reception of Herb, acknowledging its potential to improve the developer experience when working with ERB templates. However, some pragmatic concerns regarding performance and the broader applicability of the tool are also voiced.