Skip to content

editors: units and Persian digits highlight as one number in components and pages, tree-sitter repeat track lists, LSP in pub component - #3685

Merged
BaseMax merged 7 commits into
mainfrom
fix/editor-units-in-components
Nov 19, 2026
Merged

BaseMax merged 7 commits into
mainfrom
fix/editor-units-in-components

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 19, 2026

Copy link
Copy Markdown
Member

Checked every editor surface with the same probe inside page: and inside a component body (en and fa). The regex grammars (TextMate, kate, sublime, gtksourceview, vim, emacs, nano), the LSP semantic tokens and the context free web highlighters already treated both alike. What was actually wrong, now fixed:

  • tree-sitter: columns = repeat(2, 1fr) was an ERROR node in page and component values because repeat is a keyword; a track_repeat rule parses it. New corpus test/corpus/component_values.txt (en, fa, pub component with parameters, nested elements). tree-sitter test passes 28 of 28 and a parse sweep of 6403 repo files has no regression.
  • micro: Persian digit units and percent (۱fr, ۵۰٪) were not one number (generator fixed, regenerated).
  • playground editor: Persian digits did not start a number, and 50% was 50 plus an operator.
  • website build highlighter (highlight_with) had no unit or percent support, site.js lacked percent, and the chat fallback highlighter in ai/frontend had the same gap.
  • LSP style_scan only recognised blocks whose first word is page or component, so attribute completion, value completion and hover were off in pub component and همگانی بخش bodies; style_head_word looks through the modifier.

Tests: extensions/tools/check_engines.salam now compares a component probe with the page probe (probe_component_en and fa) and flags a dimension, percent or colour that is no longer one token; website/check-highlight.mjs runs from website/build.sh when node exists; component_attrs in tools/lsp/test_lsp.salam. check_engines passes for all four engines including vscode-textmate. The new LSP completion tests were not confirmed: the 0.6.16 server already fails the existing style completion tests and a compiler build from this tree was killed by memory pressure, they should be run with a main built compiler.

@BaseMax
BaseMax requested a review from a team as a code owner November 19, 2026 17:45
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b832e66c-b4ef-4149-bb6c-f3328aa547c6
Commits

Reviewing files that changed from the base of the PR and between 8161d9d and a0933b0.

Files selected for processing: 15

  • ai/frontend/src/highlight.ts
  • compiler/lsp/lsp_style.salam
  • editor/app.salam
  • extensions/micro/salam.yaml
  • extensions/tools/check_engines.salam
  • extensions/tools/fixtures/probe_component_en.salam
  • extensions/tools/fixtures/probe_component_fa.salam
  • extensions/tools/gen_syntaxes.salam
  • extensions/tree-sitter-salam/grammar.js
  • extensions/tree-sitter-salam/test/corpus/component_values.txt
  • tools/lsp/test_lsp.salam
  • website/assets/js/site.js
  • website/build.salam
  • website/build.sh
  • website/check-highlight.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor
sha=a0933b00a06863170b5294cf6462da2dcaf4e438

🤖 Salam AI review

Verdict: 🛠️ Changes needed before merging

commit a0933b0 · 15 files · +640 −8 · model salam

Summary

This PR improves editor and highlighter handling so CSS-like units and percent values (including Persian digits/forms such as ۱fr and ۵۰٪) are tokenized as single numbers in component bodies as well as pages, teaches tree-sitter to parse repeat(...) track lists in layout values, and extends LSP style scanning to pub component/همگانی بخش bodies. The changes are focused and accompanied by new corpus/tests and engine probes, but the newly added LSP completion/semantic-token tests are reported as not yet confirmed against a compatible compiler/server.

What changed

  • Tree-sitter: extensions/tree-sitter-salam/grammar.js adds a track_repeat layout value so repeat(...) track lists parse in page/component attributes; extensions/tree-sitter-salam/test/corpus/component_values.txt adds corpus cases for English/Persian component bodies, pub component parameters, and page track lists.
  • Highlighting/tokenization: editor/app.salam, extensions/micro/salam.yaml (and generator), website/build.salam, website/assets/js/site.js, and ai/frontend/src/highlight.ts extend number handling to include unit/percent suffixes and Persian digit/percent forms. website/check-highlight.mjs and website/build.sh add a Node-based highlight check when available.
  • LSP/editor checks: compiler/lsp/lsp_style.salam resolves the layout head through pub/همگانی for style scanning. tools/lsp/test_lsp.salam adds component_attrs coverage, and extensions/tools/check_engines.salam plus new probe_component_{en,fa}.salam fixtures compare component tokenization to page tokenization.

Review

  • tools/lsp/test_lsp.salam (component_attrs): The PR states these new completion/semantic-token tests were not confirmed because 0.6.16 fails existing style completion tests and a compiler build from this tree could not be completed. Please run and report results with a current main-built compiler/server before merge.
  • editor/app.salam (number token branch, e.g. the new digit_len_at/unit-percent handling around the modified highlight_salam logic): The diff uses C-style ternary expressions (cond ? a : b) for advancing and selecting unit vs percent ends. Can you confirm this is valid Salam syntax in this file and compiles as intended? If not, it should be rewritten to Salam’s conditional form.
  • website/build.salam (highlight_with/unit_end): Unit/percent suffix handling is added after the numeric scan, but number detection still keys off str.IsAnyDigit(cp) and an ASCII-oriented digit loop. Does this path correctly recognize Persian-digit runs like ۱fr and ۵۰٪ in build-time output as the commit states? website/check-highlight.mjs exercises site.js, not this Salam implementation.
  • extensions/tree-sitter-salam/test/corpus/component_values.txt: English repeat(2, 1fr) is asserted as a track_repeat node, while Persian چندبار(۲، ۱fr) is asserted as a call_expression. Is this AST asymmetry intentional for consumers, given the goal was to avoid parse errors?

Tests

  • Author reports: tree-sitter test passes 28/28, a 6403-file parse sweep shows no regression, and check_engines passes for all four engines including vscode-textmate. website/check-highlight.mjs is added (run from website/build.sh when Node is present).
  • I did not run builds or tests.

Risks

  • Merging without verified LSP results leaves uncertainty around pub component/component-body completion and semantic token parity. Any mismatch in Salam expression syntax (editor/app.salam) or Persian-digit detection in the build-time highlighter (website/build.salam) would leave some surfaces inconsistent with the stated fix.

⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit 7c743e2 into main Nov 19, 2026
1 check passed
@BaseMax
BaseMax deleted the fix/editor-units-in-components branch November 19, 2026 17:50
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.

1 participant