VS Code Integration

VS Code integration provides syntax highlighting, IntelliSense, and other development features for Rui. This guide will help you set up and use the Rui extension in VS Code.

Installing the Extension

Method 1: Direct Installation (Recommended)

Click the link below to install the Rui extension directly from the VS Code Marketplace:

Install Rui Support Extension

Method 2: Through VS Code Extensions View

  1. Open VS Code
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for "Rui Support" or "Rui Language"
  4. Click "Install" on the Rui extension

Method 3: Command Line Installation

code --install-extension PratikDeshpande.rui-support

Features

The Rui VS Code extension provides:

  • Syntax Highlighting: Color-coded syntax for better readability
  • Keyword Support: Full support for Rui keywords (define, suppose, until, if, else, return, write)
  • Boolean Support: Syntax highlighting for true and false
  • Variable and Function Names: Proper highlighting for identifiers
  • String Support: Both single (') and double (") quote strings
  • Number Support: Syntax highlighting for numeric literals
  • Operator Support: Highlighting for operators and brackets
  • Function Arguments: Support for function parameters
  • Block and Loop Highlighting: Proper syntax highlighting for code blocks and loops
  • File Association: Works with .rui files

Syntax Highlighting

Once installed, .rui files will have syntax highlighting:

// Comments are highlighted
define greet(name) {
    write("Hello, " + name + "!")
}

// Keywords like 'define', 'if', 'until' are highlighted
if (age >= 18) {
    write("Adult")
} else {
    write("Minor")
}

Code Snippets

The extension includes helpful code snippets:

Function Snippet

Type define and press Tab:

define functionName(parameters) {
    // Function body
}

If Statement Snippet

Type if and press Tab:

if (condition) {
    // Code block
}

Until Loop Snippet

Type until and press Tab:

until (condition) {
    // Code block
}

Error Detection

The extension highlights syntax errors in real-time:

define greet(name {
    write("Hello, " + name + "!")
}  // Error highlighted here

Example: Setting Up a Project

  1. Create a new folder for your Rui project
  2. Open the folder in VS Code
  3. Create a new file with .rui extension
  4. Start coding with full VS Code support
my-rui-project/
├── hello.rui
├── calculator.rui
└── examples/
    └── demo.rui

Running Rui Programs

You can run Rui programs directly from VS Code:

  1. Open the Terminal (Ctrl+` or Cmd+`)
  2. Run your Rui program:
rui hello.rui

Debugging

While the Rui extension doesn't include a debugger yet, you can use VS Code's integrated terminal to run and test your programs:

  1. Open the Terminal
  2. Run your program
  3. Check the output for errors
  4. Fix any issues and re-run

Troubleshooting

Extension Not Working

If the extension isn't working:

  1. Restart VS Code
  2. Check if the extension is enabled
  3. Verify file associations
  4. Check the Output panel for error messages

Syntax Highlighting Issues

If syntax highlighting isn't working:

  1. Make sure the file has a .rui extension
  2. Check the language mode in the status bar
  3. Manually set the language mode to "Rui"

IntelliSense Not Working

If auto-completion isn't working:

  1. Check the extension settings
  2. Make sure IntelliSense is enabled
  3. Try pressing Ctrl+Space to trigger manually

Contributing to the Extension

The Rui VS Code extension is open source. You can contribute by:

  1. Reporting bugs
  2. Suggesting new features
  3. Contributing code
  4. Improving documentation

Visit the Contributing guide for more information.

Next Steps

Now that you have VS Code set up for Rui development, you're ready to start building more complex programs. Check out the Contributing guide to learn how you can help improve Rui.