major changes

- Added documentation via mdbook
- Created basic VS code extension
- Implemented if else blocks and changed some syntax
- fixed some issues
This commit is contained in:
2025-11-02 19:56:26 +01:00
parent 78959d4f22
commit af0a1632c0
40 changed files with 14014 additions and 177 deletions

View File

@@ -0,0 +1,6 @@
{
"devDependencies": {
"yo": "^5.1.0",
"generator-code": "^1.11.13"
}
}

5715
vsc-extension/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

17
vsc-extension/rush/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,17 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}

View File

@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

View File

@@ -0,0 +1,9 @@
# Change Log
All notable changes to the "rush" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

View File

@@ -0,0 +1,47 @@
# Installing the Rush VS Code Extension
## Method 1: Install from VSIX file (Recommended for sharing)
1. **Get the VSIX file**: `rush-0.0.1.vsix` (located in this directory)
2. **Install in VS Code**:
- Open VS Code
- Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
- Type: `Extensions: Install from VSIX...`
- Select the `rush-0.0.1.vsix` file
- Restart VS Code if prompted
3. **Verify installation**:
- Open any `.rush` or `.rsh` file
- You should see syntax highlighting automatically
- Try typing `for` and pressing Tab to test snippets
## Method 2: Install via command line
```bash
code --install-extension rush-0.0.1.vsix
```
## Sharing with friends
Just send them the `rush-0.0.1.vsix` file! They can install it using Method 1 or 2 above.
## Features
- ✅ Syntax highlighting for all Rush keywords
- ✅ Built-in variable highlighting ($IS_ROOT, $USER, etc.)
- ✅ Shebang highlighting (#!/path/to/rush)
- ✅ Error detection for common syntax mistakes
- ✅ Code snippets (type `for`, `if`, `parallel`, etc.)
- ✅ Auto-closing braces and quotes
## Uninstalling
1. Open VS Code
2. Go to Extensions (Ctrl+Shift+X)
3. Find "Rush Shell"
4. Click the gear icon → Uninstall
---
**File location**: `/home/louis/dev/rush/vsc-extension/rush/rush-0.0.1.vsix`

View File

@@ -0,0 +1,153 @@
# rush README
This is the README for your extension "rush". After writing up a brief description, we recommend including the following sections.
## Features
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
# Rush Shell Extension for VS Code
Syntax highlighting and basic validation support for Rush shell scripts (`.rush`, `.rsh`).
## Features
### Syntax Highlighting
- **Keywords**: `if`, `else`, `for`, `in`, `not`, `parallel`, `workers`, `run`
- **Built-in Variables**: `$IS_ROOT`, `$USER`, `$HOME`, `$SHELL`, `$PWD`, `$OS`, `$ARCH`
- **Variables**: `$VARNAME` with proper substitution highlighting
- **Comments**: `# comments` and shebangs `#!/path/to/rush`
- **Strings**: Double-quoted strings with embedded variable highlighting
- **Commands**: Common shell commands like `echo`, `ls`, `cd`, etc.
### Error Highlighting
The extension highlights common syntax errors:
- Missing `{` after `for`, `if`, `parallel`, `workers`
- `run` keyword used without braces
- Missing `in` keyword in `for` loops
### Code Snippets
Type these prefixes and press Tab:
- `for` - Create a for loop
- `if` - Create an if statement
- `ifelse` - Create an if-else statement
- `parallel` - Create a parallel execution block
- `workers` - Create a workers block
- `run` - Create a run block
- `echo` - Echo command
- `var` - Variable assignment
## Usage
1. Open any `.rush` or `.rsh` file
2. Syntax highlighting will be applied automatically
3. Type snippet prefixes for quick code generation
4. Syntax errors will be highlighted in red
## Example
```rush
#!/home/user/rush/target/debug/rush
# Built-in variables
echo "User: $USER"
echo "Home: $HOME"
# For loops
for i in 1 2 3 {
echo "Count: $i"
}
# Parallel execution
parallel {
run { echo "Task 1" }
run { echo "Task 2" }
}
# Workers with concurrency
workers 2 {
for task in alpha beta gamma {
run { echo "Processing: $task" }
}
}
# Conditionals
if not $IS_ROOT {
echo "Running as regular user"
} else {
echo "Running as root"
}
```
## Requirements
- VS Code 1.105.0 or higher
## Release Notes
### 0.0.1
Initial release:
- Syntax highlighting for Rush shell scripts
- Basic error detection
- Code snippets for common patterns
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
## Requirements
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
## Extension Settings
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
For example:
This extension contributes the following settings:
* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.
## Known Issues
Calling out known issues can help limit users opening duplicate issues against your extension.
## Release Notes
Users appreciate release notes as you update your extension.
### 1.0.0
Initial release of ...
### 1.0.1
Fixed issue #.
### 1.1.0
Added features X, Y, and Z.
---
## Working with Markdown
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
## For more information
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
**Enjoy!**

View File

@@ -0,0 +1,39 @@
# Rush Shell Extension for VS Code
Syntax highlighting and basic validation support for Rush shell scripts (`.rush`, `.rsh`).
## Features
### Syntax Highlighting & Code Snippets
Type these prefixes and press Tab:
- `for` - Create a for loop
- `if` - Create an if statement
- `ifelse` - Create an if-else statement
- `parallel` - Create a parallel execution block
- `workers` - Create a workers block
- `run` - Create a run block
- `echo` - Echo command
- `var` - Variable assignment
## Usage
1. Open any `.rush` or `.rsh` file
2. Syntax highlighting will be applied automatically
3. Type snippet prefixes for quick code generation
4. Syntax errors will be highlighted in red
## Requirements
- VS Code 1.105.0 or higher
## Release Notes
### 0.0.1
Initial release:
- Syntax highlighting for Rush shell scripts
- Basic error detection
- Code snippets for common patterns

View File

@@ -0,0 +1,24 @@
{
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
],
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",
"indentationRules": {
"increaseIndentPattern": "^.*\\{[^}]*$",
"decreaseIndentPattern": "^\\s*\\}.*$"
}
}

4224
vsc-extension/rush/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
{
"name": "rush",
"displayName": "Rush Shell",
"description": "Syntax highlighting and validation for Rush shell scripts",
"version": "0.0.1",
"publisher": "rush-lang",
"repository": {
"type": "git",
"url": "https://git.louiscreates.com/tototomate123/rush"
},
"engines": {
"vscode": "^1.105.0"
},
"categories": [
"Programming Languages",
"Snippets"
],
"keywords": [
"rush",
"shell",
"scripting",
"parallel",
"concurrency"
],
"contributes": {
"languages": [
{
"id": "rush",
"aliases": [
"Rush",
"rush"
],
"extensions": [
".rush",
".rsh"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "rush",
"scopeName": "source.rush",
"path": "./syntaxes/rush.tmLanguage.json"
}
],
"snippets": [
{
"language": "rush",
"path": "./snippets/rush.json"
}
]
},
"devDependencies": {
"@vscode/vsce": "^3.6.2"
}
}

View File

@@ -0,0 +1,74 @@
{
"For Loop": {
"prefix": "for",
"body": [
"for ${1:i} in ${2:items} {",
"\t$0",
"}"
],
"description": "For loop with items"
},
"If Statement": {
"prefix": "if",
"body": [
"if ${1:condition} {",
"\t$0",
"}"
],
"description": "If statement"
},
"If-Else Statement": {
"prefix": "ifelse",
"body": [
"if ${1:condition} {",
"\t$2",
"} else {",
"\t$0",
"}"
],
"description": "If-else statement"
},
"Parallel Block": {
"prefix": "parallel",
"body": [
"parallel {",
"\trun { ${1:command} }",
"\trun { ${2:command} }",
"\t$0",
"}"
],
"description": "Parallel execution block"
},
"Workers Block": {
"prefix": "workers",
"body": [
"workers ${1:2} {",
"\t$0",
"}"
],
"description": "Workers block with concurrency limit"
},
"Run Block": {
"prefix": "run",
"body": [
"run {",
"\t$0",
"}"
],
"description": "Run block (use inside parallel/workers)"
},
"Echo": {
"prefix": "echo",
"body": [
"echo \"$0\""
],
"description": "Echo command"
},
"Variable Assignment": {
"prefix": "var",
"body": [
"${1:VARNAME} = \"${2:value}\"$0"
],
"description": "Variable assignment"
}
}

View File

@@ -0,0 +1,172 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Rush",
"patterns": [
{
"include": "#shebang"
},
{
"include": "#invalid-syntax"
},
{
"include": "#comments"
},
{
"include": "#keywords"
},
{
"include": "#control-flow"
},
{
"include": "#builtin-variables"
},
{
"include": "#variables"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#operators"
},
{
"include": "#commands"
}
],
"repository": {
"shebang": {
"patterns": [
{
"name": "meta.shebang.rush",
"match": "\\A#!.*$",
"captures": {
"0": {
"name": "comment.line.shebang.rush"
}
}
}
]
},
"invalid-syntax": {
"patterns": [
{
"name": "invalid.illegal.missing-brace.rush",
"comment": "for/if/parallel/workers without opening brace on same line",
"match": "^\\s*(for\\s+\\w+\\s+in\\s+[^{]+$|if\\s+[^{]+$|parallel\\s*$|workers\\s+\\d+\\s*$)"
},
{
"name": "invalid.illegal.run-without-brace.rush",
"comment": "run keyword not followed by opening brace",
"match": "\\brun\\s+(?!\\{)\\w"
},
{
"name": "invalid.illegal.missing-in.rush",
"comment": "for loop without 'in' keyword",
"match": "\\bfor\\s+\\w+\\s+(?!in\\b)\\w"
}
]
},
"comments": {
"patterns": [
{
"name": "comment.line.number-sign.rush",
"match": "#(?!!).*$"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.rush",
"match": "\\b(if|else|for|in|while|return|not)\\b"
},
{
"name": "keyword.other.rush",
"match": "\\b(parallel|workers|run)\\b"
}
]
},
"control-flow": {
"patterns": [
{
"name": "keyword.control.conditional.rush",
"match": "\\b(if|else)\\b"
},
{
"name": "keyword.control.loop.rush",
"match": "\\b(for|while|in)\\b"
}
]
},
"builtin-variables": {
"patterns": [
{
"name": "variable.language.rush",
"match": "\\$\\b(IS_ROOT|USER|HOME|SHELL|PWD|OS|ARCH)\\b"
}
]
},
"variables": {
"patterns": [
{
"name": "variable.other.rush",
"match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
},
{
"name": "variable.other.assignment.rush",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?==)"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.rush",
"begin": "\"",
"end": "\"",
"patterns": [
{
"include": "#variables"
},
{
"name": "constant.character.escape.rush",
"match": "\\\\."
}
]
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.rush",
"match": "\\b[0-9]+\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.assignment.rush",
"match": "="
},
{
"name": "punctuation.definition.block.rush",
"match": "[{}]"
}
]
},
"commands": {
"patterns": [
{
"name": "support.function.builtin.rush",
"match": "\\b(echo|exit|cd|ls|mkdir|rm|cp|mv|cat|grep|find|chmod|chown)\\b"
}
]
}
},
"scopeName": "source.rush"
}

View File

@@ -0,0 +1,29 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/rush.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
## Get up and running straight away
* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.
## Make changes
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Add more language features
* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/api/language-extensions/overview
## Install your extension
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension.