Hi everyone!
I’ve recently created four new language packages for CodeMirror 6:
-
@fazelstudio/codemirror-lang-c— C language support -
@fazelstudio/codemirror-lang-lua— Lua 5.4 language support -
@fazelstudio/codemirror-lang-luau— Luau language support -
@fazelstudio/codemirror-lang-scala— Scala 3 language support
All four packages use native Lezer grammars and are designed specifically for CodeMirror 6.
C
@fazelstudio/codemirror-lang-c provides C17 syntax support with:
-
Syntax highlighting
-
Incremental parsing
-
Code indentation
-
Code folding
-
Preprocessor directive recognition
-
Support for several commonly used compiler extensions such as
__attribute__,__declspec,typeof, andasm
The parser primarily targets ISO C17, with selected C11/C23 features.
GitHub: GitHub - fazel-studio/codemirror-lang-c: C language support for the CodeMirror code editor · GitHub
Lua
@fazelstudio/codemirror-lang-lua targets Lua 5.4 and includes:
-
Full Lua 5.4 syntax
-
Syntax highlighting
-
Autocomplete with Lua standard-library and keyword completions
-
Snippets
-
Automatic indentation
-
Code folding
-
Bracket matching
-
Long strings and comments
-
Labels and
goto -
Lua 5.4 attributes such as
<const>and<close>
GitHub: GitHub - fazel-studio/codemirror-lang-lua: Lua language support for CodeMirror 6 · GitHub
Luau
@fazelstudio/codemirror-lang-luau supports Luau syntax, including Lua 5.1 compatibility and Luau-specific features such as:
-
Gradual typing and type annotations
-
Type aliases and generic types
-
Union, intersection, and optional types
-
Type casts
-
export type -
String interpolation
-
If expressions
-
Compound assignment operators
-
Bitwise operators
-
continue -
Function attributes
-
Syntax highlighting
-
Automatic indentation
-
Code folding
Scala
@fazelstudio/codemirror-lang-scala provides Scala 3 language support, including:
-
Classes, traits, objects, enums, and case classes
-
Pattern matching
-
For-comprehensions
-
Significant indentation / optional braces
-
String interpolation
-
XML literals
-
Generic types with variance
-
Union and intersection types
-
Type lambdas
-
given/using -
Extension methods
-
Opaque types
-
Scaladoc comments
All four packages are released under the MIT license.
The packages are available on npm:
-
@fazelstudio/codemirror-lang-c -
@fazelstudio/codemirror-lang-lua -
@fazelstudio/codemirror-lang-luau -
@fazelstudio/codemirror-lang-scala
I’d really appreciate feedback from the CodeMirror community, especially regarding grammar coverage, parsing edge cases, highlighting, indentation, and areas where these language packages could be improved.
Thanks!