Skip to content

✨ feat(mq-lang): add ltrim and rtrim builtins for string/markdown whitespace trimming#1281

Merged
harehare merged 1 commit intomainfrom
feat/ltrim-rtrim-builtin
Feb 15, 2026
Merged

✨ feat(mq-lang): add ltrim and rtrim builtins for string/markdown whitespace trimming#1281
harehare merged 1 commit intomainfrom
feat/ltrim-rtrim-builtin

Conversation

@harehare
Copy link
Copy Markdown
Owner

  • Add ltrim and rtrim built-in functions to trim whitespace from the left/right of strings and Markdown nodes
  • Register new builtins in hash dispatch and documentation
  • Add integration tests for ltrim and rtrim builtins

…tespace trimming

- Add ltrim and rtrim built-in functions to trim whitespace from the left/right of strings and Markdown nodes
- Register new builtins in hash dispatch and documentation
- Add integration tests for ltrim and rtrim builtins

Closes #1279
Closes #1280
Copilot AI review requested due to automatic review settings February 15, 2026 14:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds two new built-in functions ltrim and rtrim for trimming whitespace from strings and Markdown nodes. The implementation follows established patterns in the codebase for string manipulation functions, providing consistent handling across String, Markdown, and None types.

Changes:

  • Adds LTRIM and RTRIM builtin function implementations using trim_start() and trim_end() respectively
  • Registers the new builtins in the hash dispatch system with constants and match arms
  • Adds comprehensive documentation for both functions in BuiltinFunctionDoc
  • Includes integration tests verifying correct behavior on string inputs with whitespace

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/mq-lang/src/eval/builtin.rs Adds LTRIM/RTRIM builtin implementations, hash constants, hash dispatch registration, and documentation entries
crates/mq-lang/tests/integration_tests.rs Adds integration test cases for ltrim() and rtrim() functions

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 15, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing feat/ltrim-rtrim-builtin (9692147) with main (420f006)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (d25771a) during the generation of this report, so 420f006 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@harehare harehare merged commit 8fa735f into main Feb 15, 2026
13 checks passed
@harehare harehare deleted the feat/ltrim-rtrim-builtin branch February 15, 2026 14:39
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.

2 participants