Changing to an LSP style model. Client extension is now small af

This commit is contained in:
Noah Santschi-Cooney 2018-06-02 21:04:53 +01:00
parent cefd0e2e67
commit 3db6964f7c
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
21 changed files with 728 additions and 820 deletions

2275
client/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

83
client/package.json Normal file
View file

@ -0,0 +1,83 @@
{
"name": "vscode-mc-shader-client",
"description": "A Visual Studio Code extension for linting/etc Minecraft GLSL Shaders",
"version": "0.0.1",
"publisher": "Noah Santschi-Cooney (Strum355)",
"author": "Noah Santschi-Cooney (Strum355)",
"license": "MIT",
"repository": {
"url": "https://github.com/Strum355/vscode-mc-shader"
},
"engines": {
"vscode": "^1.23.0"
},
"categories": [
"Linters",
"Programming Languages"
],
"activationEvents": [
"onLanguage:glsl",
"workspaceContains:**/*.fsh",
"workspaceContains:**/*.vsh",
"workspaceContains:**/*.gsh",
"workspaceContains:**/*.glsl"
],
"extensionDependencies": [
"slevesque.shader"
],
"main": "./out/extension",
"contributes": {
"languages": [
{
"id": "glsl",
"aliases": [
"OpenGL Shading Language"
],
"extensions": [
".fsh",
".vsh",
".gsh",
".glsl"
]
}
],
"configuration": {
"title": "Minecraft GLSL configurations",
"properties": {
"mcglsl.glslangValidatorPath": {
"type": "string",
"default": "glslangValidator",
"description": "The path to the glslangValidator executable. Default value assumes its in your PATH."
},
"mcglsl.lintOnType": {
"type": "boolean",
"default": false,
"description": "Whether or not to lint while typing. Can decrease performance."
},
"mcglsl.minecraftPath": {
"type": "string",
"default": "",
"description": "Absolute path to your Minecraft installation folder. The shaderpacks folder will be derived from this."
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"lint": "tslint -c tslint.json 'src/**/*.ts'"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^7.0.43",
"tslint": "^5.8.0",
"typescript": "^2.6.1",
"vscode": "^1.1.18"
},
"dependencies": {
"vscode-languageclient": "^4.1.4"
}
}

30
client/src/extension.ts Normal file
View file

@ -0,0 +1,30 @@
import * as vscode from 'vscode'
import * as vscodeLang from 'vscode-languageclient'
import * as path from 'path'
export function activate(context: vscode.ExtensionContext) {
const serverModule = context.asAbsolutePath(path.join('server', 'server.js'))
const debugOpts = { execArgv: ['--nolazy', '--debug=6009']}
const serverOpts: vscodeLang.ServerOptions = {
run: {
module: serverModule, transport: vscodeLang.TransportKind.ipc
},
debug: {
module: serverModule, transport: vscodeLang.TransportKind.ipc, options: debugOpts
}
}
const clientOpts: vscodeLang.LanguageClientOptions = {
documentSelector: [{scheme: 'file', language: 'glsl'}],
synchronize: {
configurationSection: 'mcglsl',
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.{fsh,gsh,vsh,glsl}')
}
}
const disposable = new vscodeLang.LanguageClient('vscode-mc-shader', serverOpts, clientOpts)
context.subscriptions.push(disposable.start())
}

20
client/tsconfig.json Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
"strict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
},
"exclude": [
"node_modules",
".vscode-test",
"test"
]
}

42
client/tslint.json Normal file
View file

@ -0,0 +1,42 @@
{
"defaultSeverity": "error",
"extends": ["tslint:recommended"],
"rules": {
"quotemark": [true, "single"],
"comment-format": false,
"semicolon": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"interface-name": false,
"indent": [true, "spaces", 2],
"arrow-parens": false,
"max-classes-per-file": false,
"no-console": false,
"eofline": false,
"member-ordering": false,
"trailing-comma": false,
"no-var-requires": false,
"max-line-length": {
"severity": "warning",
"options": [170]
},
"radix": false,
"no-empty": false,
"prefer-const": {
"severity": "warning"
},
"curly": [true, "ignore-same-line"],
"whitespace": [
true,
"check-decl",
"check-operator",
"check-module",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock",
"check-branch"
]
}
}