Skip to content

Commit 9798653

Browse files
committed
initial move from simplicityhl
0 parents  commit 9798653

28 files changed

Lines changed: 9259 additions & 0 deletions

.github/workflows/extension.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Extension on VSCode marketplace and Open VSX Registry
2+
on:
3+
push:
4+
tags:
5+
- "simplicityhl-vscode-v*"
6+
jobs:
7+
Extension:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: 20
14+
15+
- run: npm ci
16+
working-directory: vscode
17+
18+
- name: Verify tag matches extension version
19+
working-directory: vscode
20+
shell: bash
21+
run: |
22+
TAG="${GITHUB_REF##*/}"
23+
VERSION_TAG="${TAG#simplicityhl-vscode-v}"
24+
25+
PACKAGE_VERSION=$(jq -r '.version' package.json)
26+
27+
echo "Tag version: $VERSION_TAG"
28+
echo "Package version: $PACKAGE_VERSION"
29+
30+
if [ "$VERSION_TAG" != "$PACKAGE_VERSION" ]; then
31+
echo "Tag version ($VERSION_TAG) does not match package.json version ($PACKAGE_VERSION)"
32+
exit 1
33+
fi
34+
35+
- name: Publish to Open VSX Registry
36+
uses: HaaLeo/publish-vscode-extension@v2
37+
with:
38+
pat: ${{ secrets.OPEN_VSX_TOKEN }}
39+
packagePath: vscode
40+
skipDuplicate: true
41+
42+
- name: Publish to Visual Studio Marketplace
43+
uses: HaaLeo/publish-vscode-extension@v2
44+
with:
45+
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
46+
registryUrl: https://marketplace.visualstudio.com
47+
packagePath: vscode
48+
skipDuplicate: true
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on: # yamllint disable-line rule:truthy
2+
pull_request:
3+
4+
name: Verify signed commits
5+
6+
jobs:
7+
Check-Signatures:
8+
name: Check GPG signatures
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "Checkout repo"
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: "Verify all PR commits are signed"
17+
run: |
18+
set -euo pipefail
19+
base="${{ github.event.pull_request.base.sha }}"
20+
head="${{ github.event.pull_request.head.sha }}"
21+
unsigned=""
22+
for sha in $(git rev-list "$base".."$head"); do
23+
sig=$(git log --format='%G?' -1 "$sha")
24+
if [ "$sig" != "G" ] && [ "$sig" != "U" ] && [ "$sig" != "E" ]; then
25+
unsigned="$unsigned $sha"
26+
echo "::error::Commit $sha is not GPG signed (signature status: $sig)"
27+
fi
28+
done
29+
if [ -n "$unsigned" ]; then
30+
echo ""
31+
echo "The following commits are not signed:$unsigned"
32+
echo "Please sign your commits with a GPG key."
33+
exit 1
34+
fi
35+
echo "All commits are GPG signed."

.github/workflows/typescript.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: VS Code extension (ESLint)
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'vscode/**'
9+
- '.github/workflows/typescript.yml'
10+
pull_request:
11+
branches:
12+
- master
13+
paths:
14+
- 'vscode/**'
15+
- '.github/workflows/typescript.yml'
16+
workflow_dispatch:
17+
18+
jobs:
19+
eslint:
20+
name: Lint on Node v${{ matrix.node }}
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 10
23+
24+
permissions:
25+
contents: read
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
node:
34+
- 22
35+
36+
defaults:
37+
run:
38+
working-directory: ./vscode
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{ matrix.node }}
46+
cache: 'npm'
47+
cache-dependency-path: vscode/package-lock.json
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
env:
52+
CI: true
53+
54+
- name: Run ESLint
55+
run: npm run eslint-check
56+
env:
57+
CI: true

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# client executables files
2+
node_modules/
3+
out/
4+
5+
.pnpm-debug.log
6+
7+
*.ast
8+
dist/
9+
10+
# vscode package
11+
*.vsix
12+
13+
# lock files
14+
Cargo.lock
15+
**/pnpm-lock.yaml

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 SimplicityHL 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.

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SimplicityHL extension for VSCode
2+
3+
VSCode extension that provides syntax highlighting for the [SimplicityHL](https://github.com/BlockstreamResearch/SimplicityHL) programming language.
4+
5+
[Simplicity](https://github.com/BlockstreamResearch/simplicity) is a typed, combinator-based, functional language without loops or recursion, developed to be an alternative to Bitcoin script that is formally specified, and can be statically analyzed with upper bounds on computation resources prior to execution.
6+
7+
SimplicityHL is a high-level language for writing Simplicity smart contracts. SimplicityHL looks and feels like [Rust](https://www.rust-lang.org), but is compiled to Simplicity bytecode. Developers write SimplicityHL transactions, which Bitcoin/Liquid nodes verify with the Simplicity script interpreter.
8+
9+
## Features
10+
11+
- Syntax highlighting for .simf and .wit files
12+
- Basic language configuration (brackets, comments)
13+
14+
Also, you can install the [SimplicityHL language server](https://github.com/distributed-lab/simplicityhl-lsp), which enables several features:
15+
- Error diagnostics
16+
![diagnostics](https://github.com/user-attachments/assets/54315645-464b-40c3-bb72-c6e8c4bc0ad5)
17+
18+
- Completion of user-defined functions and jets
19+
![completion](https://github.com/user-attachments/assets/bbc2b9de-c286-4d31-b47e-ac95885f8916)
20+
21+
22+
23+
24+
### Development
25+
26+
To install the extension manually or hack on the source code see [development.md](docs/development.md)

docs/development.md

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

esbuild.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { context } from "esbuild";
2+
import process from "node:process";
3+
4+
const production = process.argv.includes("--production");
5+
const watch = process.argv.includes("--watch");
6+
7+
async function main() {
8+
const ctx = await context({
9+
entryPoints: ["src/extension.ts"],
10+
bundle: true,
11+
format: "cjs",
12+
minify: production,
13+
sourcemap: !production,
14+
sourcesContent: false,
15+
platform: "node",
16+
outfile: "dist/extension.js",
17+
external: ["vscode"],
18+
logLevel: "warning",
19+
plugins: [
20+
esbuildProblemMatcherPlugin,
21+
],
22+
});
23+
if (watch) {
24+
await ctx.watch();
25+
} else {
26+
await ctx.rebuild();
27+
await ctx.dispose();
28+
}
29+
}
30+
31+
/**
32+
* @type {import('esbuild').Plugin}
33+
*/
34+
const esbuildProblemMatcherPlugin = {
35+
name: "esbuild-problem-matcher",
36+
37+
setup(build) {
38+
build.onStart(() => {
39+
console.log("[watch] build started");
40+
});
41+
build.onEnd((result) => {
42+
result.errors.forEach(({ text, location }) => {
43+
console.error(`✘ [ERROR] ${text}`);
44+
if (location == null) return;
45+
console.error(
46+
` ${location.file}:${location.line}:${location.column}:`,
47+
);
48+
});
49+
console.log("[watch] build finished");
50+
});
51+
},
52+
};
53+
54+
main().catch((e) => {
55+
console.error(e);
56+
process.exit(1);
57+
});

eslint.config.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import js from "@eslint/js";
2+
3+
import { defineConfig } from "eslint/config";
4+
import globals from "globals";
5+
import tseslint from "typescript-eslint";
6+
7+
export default defineConfig(
8+
{
9+
ignores: ["dist/**", "node_modules/**", "generated-types/**", "artifacts/**", "coverage/**"],
10+
},
11+
js.configs.recommended,
12+
...tseslint.configs.recommended,
13+
{
14+
files: ["src/**/*.ts"],
15+
languageOptions: {
16+
parser: tseslint.parser,
17+
parserOptions: {
18+
project: "./tsconfig.json",
19+
tsconfigRootDir: process.cwd(),
20+
},
21+
globals: {
22+
...globals.node,
23+
},
24+
},
25+
plugins: {
26+
"@typescript-eslint": tseslint.plugin,
27+
},
28+
rules: {
29+
"@typescript-eslint/ban-ts-comment": "off",
30+
"@typescript-eslint/no-explicit-any": "off",
31+
"@typescript-eslint/no-unused-expressions": "off",
32+
"@typescript-eslint/no-floating-promises": "error",
33+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
34+
},
35+
},
36+
{
37+
files: ["**/*.js"],
38+
languageOptions: {
39+
globals: {
40+
...globals.node,
41+
},
42+
},
43+
}
44+
);

icon.png

1.14 KB
Loading

0 commit comments

Comments
 (0)