Skip to content

Commit c386c64

Browse files
committed
Merge branch 'main' of https://[email protected]/rust-sailfish/sailfish.git
Conflicts: syntax/vscode/.gitignore syntax/vscode/package-lock.json syntax/vscode/package.json
2 parents 9da0cbf + 6d8339f commit c386c64

File tree

10 files changed

+222
-14
lines changed

10 files changed

+222
-14
lines changed

syntax/vscode/.eslintrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/naming-convention": [
13+
"warn",
14+
{
15+
"selector": "import",
16+
"format": [ "camelCase", "PascalCase" ]
17+
}
18+
],
19+
"@typescript-eslint/semi": "warn",
20+
"curly": "warn",
21+
"eqeqeq": "warn",
22+
"no-throw-literal": "warn",
23+
"semi": "off"
24+
},
25+
"ignorePatterns": [
26+
"out",
27+
"dist",
28+
"**/*.d.ts"
29+
]
30+
}

syntax/vscode/.vscode-test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from '@vscode/test-cli';
2+
3+
export default defineConfig({
4+
files: 'out/test/**/*.test.js',
5+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"]
5+
}

syntax/vscode/.vscode/launch.json

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
// A launch configuration that launches the extension inside a new window
1+
// A launch configuration that compiles the extension and then opens it inside a new window
22
// Use IntelliSense to learn about possible attributes.
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
66
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Extension",
10-
"type": "extensionHost",
11-
"request": "launch",
12-
"runtimeExecutable": "${execPath}",
13-
"args": [
14-
"--extensionDevelopmentPath=${workspaceFolder}"
15-
]
16-
}
17-
]
18-
}
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}",
14+
"${workspaceFolder}/../../sailfish-tests/integration-tests/templates/"
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/dist/**/*.js"
18+
],
19+
"preLaunchTask": "${defaultBuildTask}"
20+
}
21+
]
22+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

syntax/vscode/.vscode/tasks.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "watch",
8+
"dependsOn": [
9+
"npm: watch:tsc",
10+
"npm: watch:esbuild"
11+
],
12+
"presentation": {
13+
"reveal": "never"
14+
},
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
},
20+
{
21+
"type": "npm",
22+
"script": "watch:esbuild",
23+
"group": "build",
24+
"problemMatcher": "$esbuild-watch",
25+
"isBackground": true,
26+
"label": "npm: watch:esbuild",
27+
"presentation": {
28+
"group": "watch",
29+
"reveal": "never"
30+
}
31+
},
32+
{
33+
"type": "npm",
34+
"script": "watch:tsc",
35+
"group": "build",
36+
"problemMatcher": "$tsc-watch",
37+
"isBackground": true,
38+
"label": "npm: watch:tsc",
39+
"presentation": {
40+
"group": "watch",
41+
"reveal": "never"
42+
}
43+
},
44+
{
45+
"type": "npm",
46+
"script": "watch-tests",
47+
"problemMatcher": "$tsc-watch",
48+
"isBackground": true,
49+
"presentation": {
50+
"reveal": "never",
51+
"group": "watchers"
52+
},
53+
"group": "build"
54+
},
55+
{
56+
"label": "tasks: watch-tests",
57+
"dependsOn": [
58+
"npm: watch",
59+
"npm: watch-tests"
60+
],
61+
"problemMatcher": []
62+
}
63+
]
64+
}

syntax/vscode/esbuild.js

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

syntax/vscode/language-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
["(", ")"]
1111
],
1212
"autoClosingPairs": [
13-
{ "open": "<%", "close": "%>"}.
13+
{ "open": "<%", "close": "%>"},
1414
{ "open": "{", "close": "}"},
1515
{ "open": "[", "close": "]"},
1616
{ "open": "(", "close": ")" },
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as assert from 'assert';
2+
3+
// You can import and use all API from the 'vscode' module
4+
// as well as import your extension to test it
5+
import * as vscode from 'vscode';
6+
// import * as myExtension from '../../extension';
7+
8+
suite('Extension Test Suite', () => {
9+
vscode.window.showInformationMessage('Start all tests.');
10+
11+
test('Sample test', () => {
12+
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
13+
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
14+
});
15+
});

syntax/vscode/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"module": "Node16",
4+
"target": "ES2022",
5+
"lib": [
6+
"ES2022"
7+
],
8+
"sourceMap": true,
9+
"rootDir": "src",
10+
"strict": true /* enable all strict type-checking options */
11+
/* Additional Checks */
12+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
13+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
14+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
15+
}
16+
}

0 commit comments

Comments
 (0)