Skip to content

Commit cf44cc3

Browse files
committed
Merge BlockstreamResearch#123: Add VSCode extension with syntax highlighter
86971c8 Add VSCode extension with syntax highlighter (Michael Zaikin) Pull request description: This PR adds a minimal extension for VSCode that highlights *.simf files and also enables basic things like auto commenting/uncommenting (when you press cmd+/). ACKs for top commit: apoelstra: ACK 86971c8; successfully ran local tests Tree-SHA512: 5e4f5e38fc5e2087fdf61c795bd46ff985ae054b7e6b66ae1197c6d4a9bd1507f3bcb228708dea8c8f451dba14e3868a893eda9146c1dd7cc41a172c4d1cbdce
2 parents 45c34f9 + 86971c8 commit cf44cc3

8 files changed

+524
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ target/
1818

1919
# mdbook HTML output dir
2020
book/book/
21+
22+
# Node.js modules
23+
node_modules/
24+
25+
# VSCode extension package
26+
*.vsix

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ The compiler produces a base64-encoded Simplicity program. Witness data will be
6565
```bash
6666
./target/debug/simc examples/test.simf examples/test.wit
6767
```
68+
69+
### VSCode extension
70+
71+
See the installation [instructions](./vscode/README.md).

vscode/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Simfony contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

vscode/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Simfony extension for VSCode
2+
3+
VSCode extension that provides syntax highlighting for the [Simfony](https://docs.simfony.dev/) programming language.
4+
5+
## Features
6+
7+
- Syntax highlighting for .simf files
8+
- Basic language configuration (brackets, comments)
9+
10+
## Installation
11+
12+
Install Node.js (v14 or later recommended).
13+
14+
### Local Installation
15+
16+
1. Clone this repository
17+
2. Navigate to the extension directory:
18+
```bash
19+
cd vscode
20+
```
21+
3. Install dependencies:
22+
```bash
23+
npm install
24+
```
25+
4. Package the extension:
26+
```bash
27+
npm install -g @vscode/vsce
28+
vsce package
29+
```
30+
This will create a `.vsix` file in the current directory.
31+
32+
5. Install the extension in VSCode:
33+
- Launch VS Code
34+
- Go to the Extensions view (Ctrl+Shift+X)
35+
- Click on the "..." menu in the top-right of the Extensions view
36+
- Select "Install from VSIX..."
37+
- Navigate to and select the `.vsix` file you created
38+
39+
### Alternative Installation Method
40+
41+
You can also install the extension directly from the source code:
42+
43+
1. Copy the `vscode` folder (rename it if necessary) to your VSCode extensions directory:
44+
- Windows: `%USERPROFILE%\.vscode\extensions`
45+
- macOS/Linux: `~/.vscode/extensions`
46+
47+
2. Restart VSCode
48+
49+
## Development
50+
51+
1. Clone this repository and cd into `vscode` directory
52+
2. Run `npm install`
53+
3. Open the project in VS Code
54+
4. Press F5 to start debugging (this will launch a new VSCode window with the extension loaded)
55+
5. Make changes to the extension
56+
6. Reload the debugging window to see your changes (Ctrl+R or Cmd+R)
57+
58+
### Reloading the Extension During Development
59+
60+
When making changes to the extension, you can reload it without uninstalling and reinstalling:
61+
62+
1. **Using the Command Palette**:
63+
- Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS)
64+
- Type "Developer: Reload Window" and select it
65+
66+
2. **Using keyboard shortcut**:
67+
- Press `Ctrl+R` (or `Cmd+R` on macOS)
68+
69+
3. **For extensions installed from folder**:
70+
- Make your changes to the extension files
71+
- Run the "Developer: Reload Window" command as described above
72+
- VSCode will reload with the updated extension
73+
74+
4. **For more substantial changes**:
75+
- If you've made significant changes to the extension's structure or manifest
76+
- You may need to restart VSCode completely (close and reopen)
77+
- In some cases, you might need to run the command "Developer: Restart Extension Host"

vscode/language-configuration.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"comments": {
3+
"lineComment": "//"
4+
},
5+
"brackets": [
6+
["{", "}"],
7+
["[", "]"],
8+
["(", ")"]
9+
],
10+
"autoClosingPairs": [
11+
{ "open": "{", "close": "}" },
12+
{ "open": "[", "close": "]" },
13+
{ "open": "(", "close": ")" },
14+
{ "open": "\"", "close": "\"" }
15+
],
16+
"surroundingPairs": [
17+
["{", "}"],
18+
["[", "]"],
19+
["(", ")"],
20+
["\"", "\""]
21+
]
22+
}

vscode/package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "simfony-language",
3+
"displayName": "Simfony Language Support",
4+
"description": "Syntax highlighting and autocompletion for Simfony language",
5+
"version": "0.0.1",
6+
"publisher": "blockstream",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/BlockstreamResearch/simfony"
10+
},
11+
"engines": {
12+
"vscode": "^1.85.0"
13+
},
14+
"categories": [
15+
"Programming Languages"
16+
],
17+
"contributes": {
18+
"languages": [{
19+
"id": "simfony",
20+
"aliases": ["Simfony", "simfony"],
21+
"extensions": [".simf"],
22+
"configuration": "./language-configuration.json"
23+
}],
24+
"grammars": [{
25+
"language": "simfony",
26+
"scopeName": "source.simfony",
27+
"path": "./syntaxes/simfony.tmLanguage.json"
28+
}]
29+
},
30+
"license": "MIT"
31+
}

0 commit comments

Comments
 (0)