Lynx Language Support for VS Code
This extension provides syntax highlighting for the Lynx declarative modeling language.
Features
- Syntax Highlighting: Complete syntax highlighting for Lynx language constructs
- Language Configuration: Automatic bracket matching, indentation, and folding
- Comment Support: Line comments (
// ) and block comments (/* */ )
Supported Language Features
Functions (Yellow)
minimize , maximize - Optimization directives
filter , sum , firstTrue - Built-in functions
assert , Has - Utility functions
Keywords (Purple)
type , alias - Type declarations
objective , suchThat - Optimization parameters
true , false - Boolean literals
Types
- Primitive Types:
Bool , Integer , Float , String , int , float , str , bool
- Logic Types:
All , Any , Not , Exactly , AtLeast , AtMost , Free , Has
- Custom Types: Capitalized identifiers (e.g.,
Color , Wheel , Price )
Operators
- Range:
.. , ... (spread)
- Assignment:
=
- Comparison:
== , != , <= , >= , < , >
- Arithmetic:
+ , - , * , /
- Logical:
&& , || , !
- Lambda:
->
Special Constructs
- Attributes:
@attributeName
- Global Context:
*
- String Literals:
"text"
- Numbers: Integers and floats
- Comments:
// line comment and /* block comment */
Installation
Copy the vscode-lynx-extension folder to your VS Code extensions directory:
- Windows:
%USERPROFILE%\\.vscode\\extensions\\
- macOS:
~/.vscode/extensions/
- Linux:
~/.vscode/extensions/
Restart VS Code
Open any .lynx file to see syntax highlighting in action
Example
// Type declaration with attributes
type Color : Bool {
@tag : str,
}
// Variable assignment
red = Color(tag = "red")
// Range expression
z = -2..1
// Logic operation
constraint = All(x, y, z)
// Optimization
solution = minimize(
objective = bike.totalPrice,
suchThat = All(bike, constraint)
)
Development
To modify or extend the syntax highlighting:
- Edit
syntaxes/lynx.tmLanguage.json for syntax rules
- Edit
language-configuration.json for language behavior
- Update
package.json for extension metadata
License
MIT - See LICENSE file for details
| |