Skip to content

feat: add luau mode#1927

Merged
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:luau-mode
Mar 7, 2026
Merged

feat: add luau mode#1927
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:luau-mode

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

Closes: #1548

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR adds Luau (Roblox's typed Lua dialect) syntax highlighting to the editor by introducing a new StreamLanguage CodeMirror mode (src/cm/modes/luau/index.ts) and wiring it up through supportedModes.ts and a CSS file-type icon. The implementation is comprehensive and fits cleanly into the existing mode-registration pattern.

Two logic bugs were found:

  • Double-indentation for for loops: "for" is included in indentTokens alongside "do", but every Luau for loop always ends with do on the same line, so indentDepth is incremented twice per loop, making the body doubly indented and leaving a residual +1 depth after the closing end.
  • type(value) argument misclassified: After tokenizing the type keyword, state.expectTypeName is set but is never cleared when an opening ( is encountered, so type(value) — a common built-in call — incorrectly highlights its first argument as a type-definition name.

A commented-out 36-line Luau LSP server configuration block remains in serverRegistry.ts, which should be removed or addressed in a follow-up.

Confidence Score: 2/5

  • The feature is net-new and isolated, so bugs cannot cause regressions; however, both tokenizer logic bugs are readily reproducible on ordinary Luau code and should be fixed before merge.
  • Safe to merge for basic syntax highlighting, but two logic bugs in the tokenizer will produce visible incorrect indentation and wrong token colouring for common Luau patterns: every for loop body will be double-indented (with residual +1 depth after closing end), and every type(x) call will mis-colour its first argument. These are worth fixing before merge.
  • src/cm/modes/luau/index.ts — fix the for/do indentation double-count and the type(...) argument misclassification; src/cm/lsp/serverRegistry.ts — remove or address the commented-out LSP configuration block.

Last reviewed commit: b876f54

Comment thread src/cm/lsp/serverRegistry.ts
Comment thread src/cm/modes/luau/index.ts
Comment thread src/cm/modes/luau/index.ts
@bajrangCoder
Copy link
Copy Markdown
Member Author

@greptileai

Comment thread src/cm/lsp/serverRegistry.ts
Comment thread src/cm/modes/luau/index.ts Outdated
Comment thread src/cm/modes/luau/index.ts
@bajrangCoder bajrangCoder merged commit 6b24251 into Acode-Foundation:main Mar 7, 2026
6 checks passed
@bajrangCoder bajrangCoder deleted the luau-mode branch March 7, 2026 16:58
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.

Programming Language Support| Luau

1 participant