Initial commit
This commit is contained in:
5
vscode-ext/.gitignore
vendored
Normal file
5
vscode-ext/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/dist
|
||||
/out
|
||||
/node_modules
|
||||
.vscode-test
|
||||
*.vsix
|
||||
7
vscode-ext/.vscodeignore
Normal file
7
vscode-ext/.vscodeignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.vscode
|
||||
node_modules
|
||||
out/
|
||||
src/
|
||||
tsconfig.json
|
||||
webpack.config.js
|
||||
esbuild.js
|
||||
29
vscode-ext/language-configuration.json
Normal file
29
vscode-ext/language-configuration.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": ";",
|
||||
},
|
||||
"wordPattern": "[a-zA-Z][a-zA-Z0-9_]*",
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": ":-\\s*$",
|
||||
"decreaseIndentPattern": "^\\s*\\."
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
]
|
||||
}
|
||||
5665
vscode-ext/package-lock.json
generated
Normal file
5665
vscode-ext/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
vscode-ext/package.json
Normal file
46
vscode-ext/package.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "kerolox",
|
||||
"displayName": "Kerolox",
|
||||
"publisher": "you",
|
||||
"version": "0.1.0",
|
||||
"sideEffects": false,
|
||||
"main": "./dist/extension.js",
|
||||
"browser": "./dist/extension.js",
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "kerolox",
|
||||
"extensions": [
|
||||
".rp1"
|
||||
],
|
||||
"aliases": [
|
||||
"Kerolox"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.98.0"
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "webpack --mode development",
|
||||
"watch": "webpack --mode development --watch",
|
||||
"vscode:prepublish": "npm run package",
|
||||
"package": "webpack --mode production --devtool hidden-source-map"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22",
|
||||
"@types/vscode": "^1.90.0",
|
||||
"@vscode/vsce": "^3.7.1",
|
||||
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"ts-loader": "^9.5.4",
|
||||
"typescript": "^5.0.0",
|
||||
"webpack": "^5.104.0",
|
||||
"webpack-cli": "^6.0.1"
|
||||
}
|
||||
}
|
||||
30
vscode-ext/src/extension.ts
Normal file
30
vscode-ext/src/extension.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { LanguageServer } from "kerolox-lsp";
|
||||
import { Readable, Writable } from "stream";
|
||||
import * as vscode from "vscode";
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node";
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
const server = launchLsp();
|
||||
|
||||
const clientOptions: LanguageClientOptions = {
|
||||
documentSelector: [{ scheme: "file", language: "kerolox" }]
|
||||
};
|
||||
|
||||
const client = new LanguageClient("kerolox", server, clientOptions, true);
|
||||
await client.start();
|
||||
|
||||
const dispose = async () => await client.stop();
|
||||
context.subscriptions.push({ dispose });
|
||||
}
|
||||
|
||||
export function launchLsp(): ServerOptions {
|
||||
return async () => {
|
||||
console.log("creating language server");
|
||||
const server = new LanguageServer();
|
||||
console.log("language server created");
|
||||
const writer = Writable.fromWeb(server.requests);
|
||||
const reader = Readable.fromWeb(server.responses);
|
||||
console.log("language server bound");
|
||||
return { server, writer, reader };
|
||||
};
|
||||
}
|
||||
23
vscode-ext/tsconfig.json
Normal file
23
vscode-ext/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "ES2024",
|
||||
"lib": [
|
||||
"ES2024"
|
||||
],
|
||||
"outDir": "out",
|
||||
"rootDir": "src",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"paths": {
|
||||
"kerolox-lsp": ["../crates/lsp/pkg"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode-test"
|
||||
]
|
||||
}
|
||||
76
vscode-ext/webpack.config.js
Normal file
76
vscode-ext/webpack.config.js
Normal file
@@ -0,0 +1,76 @@
|
||||
//@ts-check
|
||||
|
||||
'use strict';
|
||||
|
||||
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
|
||||
const path = require('path');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
/**@type {import('webpack').Configuration}*/
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
experiments: {
|
||||
asyncWebAssembly: true
|
||||
},
|
||||
plugins: [
|
||||
new WasmPackPlugin({
|
||||
crateDirectory: path.resolve(__dirname, "../crates/lsp"),
|
||||
extraArgs: "--target bundler -- --features wasm",
|
||||
}),
|
||||
],
|
||||
optimization: {
|
||||
moduleIds: 'deterministic',
|
||||
chunkIds: 'deterministic',
|
||||
usedExports: true,
|
||||
sideEffects: true,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
terserOptions: {
|
||||
compress: {
|
||||
passes: 2
|
||||
},
|
||||
format: { comments: false },
|
||||
mangle: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
entry: './src/extension.ts',
|
||||
output: {
|
||||
filename: 'extension.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
devtoolModuleFilenameTemplate: '../[resource-path]'
|
||||
},
|
||||
devtool: 'nosources-source-map',
|
||||
externals: {
|
||||
vscode: 'commonjs vscode'
|
||||
},
|
||||
resolve: {
|
||||
mainFields: ['browser', 'module', 'main'],
|
||||
extensions: ['.ts', '.js'],
|
||||
alias: {
|
||||
"kerolox-lsp": path.resolve(__dirname, "../crates/lsp/pkg/index.js")
|
||||
},
|
||||
fallback: {
|
||||
stream: require.resolve('stream-browserify')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'ts-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user