mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-04 00:49:17 +00:00
Merge pull request #4 from Strum355/lsp
Change from extension to LSP method
This commit is contained in:
commit
a4efc94d44
26 changed files with 3510 additions and 2970 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,4 +1,7 @@
|
|||
out
|
||||
**/out
|
||||
node_modules
|
||||
.vscode-test/
|
||||
*.vsix
|
||||
client/server
|
||||
*.txt
|
||||
*.out
|
58
.vscode/launch.json
vendored
58
.vscode/launch.json
vendored
|
@ -1,36 +1,30 @@
|
|||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Client",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/client"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/client/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile:client"
|
||||
},
|
||||
{
|
||||
"name": "Attach to Server",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"port": 6009,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/client/server/**/*.js"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
},
|
||||
{
|
||||
"name": "Extension Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/test/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
}
|
||||
]
|
||||
"protocol": "legacy",
|
||||
"preLaunchTask": "watch:server"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
@ -1,9 +1,10 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.exclude": {
|
||||
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
||||
"out": true // set this to true to hide the "out" folder with the compiled JS files
|
||||
},
|
||||
"search.exclude": {
|
||||
"out": true // set this to false to include "out" folder in search results
|
||||
}
|
||||
},
|
||||
"python.pythonPath": "/usr/bin/python3"
|
||||
}
|
97
.vscode/tasks.json
vendored
97
.vscode/tasks.json
vendored
|
@ -1,20 +1,79 @@
|
|||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "compile",
|
||||
"dependsOn": [
|
||||
"compile:client",
|
||||
"compile:server"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "compile:client",
|
||||
"type": "npm",
|
||||
"script": "compile:client",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "compile:server",
|
||||
"type": "npm",
|
||||
"script": "compile:server",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"dependsOn": [
|
||||
"watch:client",
|
||||
"watch:server"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "watch:client",
|
||||
"type": "npm",
|
||||
"script": "watch:client",
|
||||
"isBackground": true,
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$tsc-watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "watch:server",
|
||||
"type": "npm",
|
||||
"script": "watch:server",
|
||||
"isBackground": true,
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$tsc-watch"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2275
client/package-lock.json
generated
Normal file
2275
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
83
client/package.json
Normal file
83
client/package.json
Normal 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
30
client/src/extension.ts
Normal 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())
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitReturns": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
2660
package-lock.json
generated
2660
package-lock.json
generated
File diff suppressed because it is too large
Load diff
75
package.json
75
package.json
|
@ -3,78 +3,27 @@
|
|||
"displayName": "vscode-mc-shader",
|
||||
"description": "A Visual Studio Code extension for linting/etc Minecraft GLSL Shaders",
|
||||
"version": "0.0.1",
|
||||
"publisher": "Strum355",
|
||||
"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"
|
||||
],
|
||||
"extensionDependencies": [
|
||||
"slevesque.shader"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "glsl",
|
||||
"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'"
|
||||
"postinstall": "cd server && npm install && cd ../client && npm install && cd ..",
|
||||
"compile": "npm run compile:client && npm run compile:server",
|
||||
"run": "concurrently \"npm run watch:client\" \"npm run watch:server\"",
|
||||
"compile:client": "tsc -p client/tsconfig.json",
|
||||
"compile:server": "cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json",
|
||||
"watch:client": "tsc -w -p client/tsconfig.json",
|
||||
"watch:server": "cd server && npm run installServer && cd .. && tsc -w -p server/tsconfig.json",
|
||||
"lint": "cd server && npm run lint && cd ../client && npm run lint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^7.0.43",
|
||||
"@types/shelljs": "^0.7.9",
|
||||
"concurrently": "^3.5.1",
|
||||
"tslint": "^5.8.0",
|
||||
"typescript": "^2.6.1",
|
||||
"vscode": "^1.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"shelljs": "^0.8.2"
|
||||
"typescript": "^2.6.1"
|
||||
}
|
||||
}
|
||||
|
|
378
server/package-lock.json
generated
Normal file
378
server/package-lock.json
generated
Normal file
|
@ -0,0 +1,378 @@
|
|||
{
|
||||
"name": "vscode-mc-shader-server",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "7.0.65",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.65.tgz",
|
||||
"integrity": "sha512-iUdyWWikcQnGvIZnYh5ZxnxeREykndA9+iGdo068NGNutibWknDjmmNMq/8cnS1eaTCcgqJsPsFppw3XJWNlUg==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"babel-code-frame": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
||||
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^1.1.3",
|
||||
"esutils": "^2.0.2",
|
||||
"js-tokens": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
|
||||
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
|
||||
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz",
|
||||
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
||||
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||
"dev": true
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"has-ansi": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
|
||||
"dev": true
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.12.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
|
||||
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz",
|
||||
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.7.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz",
|
||||
"integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||
"dev": true
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz",
|
||||
"integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw==",
|
||||
"dev": true
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.10.0.tgz",
|
||||
"integrity": "sha1-EeJrzLiK+gLdDZlWyuPUVAtfVMM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-code-frame": "^6.22.0",
|
||||
"builtin-modules": "^1.1.1",
|
||||
"chalk": "^2.3.0",
|
||||
"commander": "^2.12.1",
|
||||
"diff": "^3.2.0",
|
||||
"glob": "^7.1.1",
|
||||
"js-yaml": "^3.7.0",
|
||||
"minimatch": "^3.0.4",
|
||||
"resolve": "^1.3.2",
|
||||
"semver": "^5.3.0",
|
||||
"tslib": "^1.8.0",
|
||||
"tsutils": "^2.12.1"
|
||||
}
|
||||
},
|
||||
"tsutils": {
|
||||
"version": "2.27.1",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.1.tgz",
|
||||
"integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "^1.8.1"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
|
||||
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.5.0.tgz",
|
||||
"integrity": "sha1-hyOdnhZrLXNSJFuKgTWXgEwdY6o="
|
||||
},
|
||||
"vscode-languageserver": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.5.1.tgz",
|
||||
"integrity": "sha512-RYUKn0DgHTFcS8kS4VaNCjNMaQXYqiXdN9bKrFjXzu5RPKfjIYcoh47oVWwZj4L3R/DPB0Se7HPaDatvYY2XgQ==",
|
||||
"requires": {
|
||||
"vscode-languageserver-protocol": "3.5.1",
|
||||
"vscode-uri": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-protocol": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.5.1.tgz",
|
||||
"integrity": "sha512-1fPDIwsAv1difCV+8daOrJEGunClNJWqnUHq/ncWrjhitKWXgGmRCjlwZ3gDUTt54yRcvXz1PXJDaRNvNH6pYA==",
|
||||
"requires": {
|
||||
"vscode-jsonrpc": "3.5.0",
|
||||
"vscode-languageserver-types": "3.5.0"
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz",
|
||||
"integrity": "sha1-5I15li8LjgLelV4/UkkI4rGcA3Q="
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.3.tgz",
|
||||
"integrity": "sha1-Yxvb9xbcyrDmUpGo3CXCMjIIWlI="
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
28
server/package.json
Normal file
28
server/package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "vscode-mc-shader-server",
|
||||
"description": "A Visual Studio Code extension for linting/etc Minecraft GLSL Shaders",
|
||||
"version": "0.0.1",
|
||||
"author": "Noah Santschi-Cooney (Strum355)",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://dl.continuum.graphics/nova-group/bedrock-verifier.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^7.0.43",
|
||||
"tslint": "^5.8.0",
|
||||
"typescript": "^2.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageserver": "^3.4.2"
|
||||
},
|
||||
"scripts": {
|
||||
"installServer": "installServerIntoExtension ../client ./package.json ./tsconfig.json",
|
||||
"compile": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -p .",
|
||||
"watch": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -w -p .",
|
||||
"lint": "tslint -c tslint.json 'src/**/*.ts'"
|
||||
}
|
||||
}
|
363
server/src/completionProvider.ts
Normal file
363
server/src/completionProvider.ts
Normal file
|
@ -0,0 +1,363 @@
|
|||
import { CompletionItem, CompletionItemKind } from 'vscode-languageserver'
|
||||
|
||||
const value = CompletionItemKind.Value
|
||||
|
||||
export const completions: CompletionItem[] = [
|
||||
{
|
||||
label: 'heldItemId',
|
||||
detail: '<int> held item ID (main hand)'
|
||||
},
|
||||
{
|
||||
label: 'heldBlockLightValue',
|
||||
detail: '<int> held item light value (main hand)'
|
||||
},
|
||||
{
|
||||
label: 'heldItemId2',
|
||||
detail: '<int> held item ID (off hand)'
|
||||
},
|
||||
{
|
||||
label: 'heldBlockLightValue2',
|
||||
detail: '<int> held item light value (off hand)'
|
||||
},
|
||||
{
|
||||
label: 'fogMode',
|
||||
detail: '<int> GL_LINEAR, GL_EXP or GL_EXP2'
|
||||
},
|
||||
{
|
||||
label: 'fogColor',
|
||||
detail: '<vec3> r, g, b'
|
||||
},
|
||||
{
|
||||
label: 'skyColor',
|
||||
detail: '<vec3> r, g, b'
|
||||
},
|
||||
{
|
||||
label: 'worldTime',
|
||||
detail: '<int> <ticks> = worldTicks % 24000'
|
||||
},
|
||||
{
|
||||
label: 'worldDay',
|
||||
detail: '<int> <days> = worldTicks / 24000'
|
||||
},
|
||||
{
|
||||
label: 'moonPhase',
|
||||
detail: '<int> 0-7'
|
||||
},
|
||||
{
|
||||
label: 'frameCounter',
|
||||
detail: '<int> Frame index (0 to 720719, then resets to 0)'
|
||||
},
|
||||
{
|
||||
label: 'frameTime',
|
||||
detail: '<float> last frame time, seconds'
|
||||
},
|
||||
{
|
||||
label: 'frameTimeCounter',
|
||||
detail: '<float> run time, seconds (resets to 0 after 3600s)'
|
||||
},
|
||||
{
|
||||
label: 'sunAngle',
|
||||
detail: '<float> 0.0-1.0'
|
||||
},
|
||||
{
|
||||
label: 'shadowAngle',
|
||||
detail: '<float> 0.0-1.0'
|
||||
},
|
||||
{
|
||||
label: 'rainStrength',
|
||||
detail: '<float> 0.0-1.0'
|
||||
},
|
||||
{
|
||||
label: 'aspectRatio',
|
||||
detail: '<float> viewWidth / viewHeight'
|
||||
},
|
||||
{
|
||||
label: 'viewWidth',
|
||||
detail: '<float> viewWidth'
|
||||
},
|
||||
{
|
||||
label: 'viewHeight',
|
||||
detail: '<float> viewHeight'
|
||||
},
|
||||
{
|
||||
label: 'near',
|
||||
detail: '<float> near viewing plane distance'
|
||||
},
|
||||
{
|
||||
label: 'far',
|
||||
detail: '<float> far viewing plane distance'
|
||||
},
|
||||
{
|
||||
label: 'sunPosition',
|
||||
detail: '<vec3> sun position in eye space'
|
||||
},
|
||||
{
|
||||
label: 'moonPosition',
|
||||
detail: '<vec3> moon position in eye space'
|
||||
},
|
||||
{
|
||||
label: 'shadowLightPosition',
|
||||
detail: '<vec3> shadow light (sun or moon) position in eye space'
|
||||
},
|
||||
{
|
||||
label: 'upPosition',
|
||||
detail: '<vec3> direction up'
|
||||
},
|
||||
{
|
||||
label: 'cameraPosition',
|
||||
detail: '<vec3> camera position in world space'
|
||||
},
|
||||
{
|
||||
label: 'previousCameraPosition',
|
||||
detail: '<vec3> last frame cameraPosition'
|
||||
},
|
||||
{
|
||||
label: 'gbufferModelView',
|
||||
detail: '<mat4> modelview matrix after setting up the camera transformations'
|
||||
},
|
||||
{
|
||||
label: 'gbufferModelViewInverse',
|
||||
detail: '<mat4> inverse gbufferModelView'
|
||||
},
|
||||
{
|
||||
label: 'gbufferPreviousModelView',
|
||||
detail: '<mat4> last frame gbufferModelView'
|
||||
},
|
||||
{
|
||||
label: 'gbufferProjection',
|
||||
detail: '<mat4> projection matrix when the gbuffers were generated'
|
||||
},
|
||||
{
|
||||
label: 'gbufferProjectionInverse',
|
||||
detail: '<mat4> inverse gbufferProjection'
|
||||
},
|
||||
{
|
||||
label: 'gbufferPreviousProjection',
|
||||
detail: '<mat4> last frame gbufferProjection'
|
||||
},
|
||||
{
|
||||
label: 'shadowProjection',
|
||||
detail: '<mat4> projection matrix when the shadow map was generated'
|
||||
},
|
||||
{
|
||||
label: 'shadowProjectionInverse',
|
||||
detail: '<mat4> inverse shadowProjection'
|
||||
},
|
||||
{
|
||||
label: 'shadowModelView',
|
||||
detail: '<mat4> modelview matrix when the shadow map was generated'
|
||||
},
|
||||
{
|
||||
label: 'shadowModelViewInverse',
|
||||
detail: '<mat4> inverse shadowModelView'
|
||||
},
|
||||
{
|
||||
label: 'wetness',
|
||||
detail: '<float> rainStrength smoothed with wetnessHalfLife or drynessHalfLife'
|
||||
},
|
||||
{
|
||||
label: 'eyeAltitude',
|
||||
detail: '<float> view entity Y position'
|
||||
},
|
||||
{
|
||||
label: 'eyeBrightness',
|
||||
detail: '<ivec2> x = block brightness, y = sky brightness, light 0-15 = brightness 0-240'
|
||||
},
|
||||
{
|
||||
label: 'eyeBrightnessSmooth',
|
||||
detail: '<ivec2> eyeBrightness smoothed with eyeBrightnessHalflife'
|
||||
},
|
||||
{
|
||||
label: 'terrainTextureSize',
|
||||
detail: '<ivec2> not used'
|
||||
},
|
||||
{
|
||||
label: 'terrainIconSize',
|
||||
detail: '<int> not used'
|
||||
},
|
||||
{
|
||||
label: 'isEyeInWater',
|
||||
detail: '<int> 1 = camera is in water, 2 = camera is in lava'
|
||||
},
|
||||
{
|
||||
label: 'nightVision',
|
||||
detail: '<float> night vision (0.0-1.0)'
|
||||
},
|
||||
{
|
||||
label: 'blindness',
|
||||
detail: '<float> blindness (0.0-1.0)'
|
||||
},
|
||||
{
|
||||
label: 'screenBrightness',
|
||||
detail: '<float> screen brightness (0.0-1.0)'
|
||||
},
|
||||
{
|
||||
label: 'hideGUI',
|
||||
detail: '<int> GUI is hidden'
|
||||
},
|
||||
{
|
||||
label: 'centerDepthSmooth',
|
||||
detail: '<float> centerDepth smoothed with centerDepthSmoothHalflife'
|
||||
},
|
||||
{
|
||||
label: 'atlasSize',
|
||||
detail: '<ivec2> texture atlas size (only set when the atlas texture is bound)'
|
||||
},
|
||||
{
|
||||
label: 'entityColor',
|
||||
detail: '<vec4> entity color multiplier (entity hurt, creeper flashing when exploding)'
|
||||
},
|
||||
{
|
||||
label: 'entityId',
|
||||
detail: '<int> entity ID'
|
||||
},
|
||||
{
|
||||
label: 'blockEntityId',
|
||||
detail: '<int> block entity ID (block ID for the tile entity)'
|
||||
},
|
||||
{
|
||||
label: 'blendFunc',
|
||||
detail: '<ivec4> blend function (srcRGB, dstRGB, srcAlpha, dstAlpha)'
|
||||
},
|
||||
{
|
||||
label: 'texture',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'lightmap',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'normals',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'specular',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadow',
|
||||
detail: '<sampler2D> waterShadowEnabled ? 5 : 4'
|
||||
},
|
||||
{
|
||||
label: 'watershadow',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadowtex0',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadowtex1',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'depthtex0',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'gaux1',
|
||||
detail: '<sampler2D> 7 <custom texture or output from deferred programs>'
|
||||
},
|
||||
{
|
||||
label: 'gaux2',
|
||||
detail: '<sampler2D> 8 <custom texture or output from deferred programs>'
|
||||
},
|
||||
{
|
||||
label: 'gaux3',
|
||||
detail: '<sampler2D> 9 <custom texture or output from deferred programs>'
|
||||
},
|
||||
{
|
||||
label: 'gaux4',
|
||||
detail: '<sampler2D> 10 <custom texture or output from deferred programs>'
|
||||
},
|
||||
{
|
||||
label: 'depthtex1',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadowcolor',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadowcolor0',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'shadowcolor1',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'noisetex',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'tex',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'gcolor',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'gdepth',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'gnormal',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'composite',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex0',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex1',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex2',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex3',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex4',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex5',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex6',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'colortex7',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'gdepthtex',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'depthtex2',
|
||||
detail: '<sampler2D>'
|
||||
},
|
||||
{
|
||||
label: 'depthtex3',
|
||||
detail: '<type> depthBuffers = 4'
|
||||
}
|
||||
]
|
||||
|
||||
for (let i = 1; i < completions.length + 1; i++) {
|
||||
completions[i - 1].data = i
|
||||
completions[i - 1].kind = value
|
||||
}
|
13
server/src/config.ts
Normal file
13
server/src/config.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export class Config {
|
||||
public readonly minecraftPath: string
|
||||
public readonly glslangPath: string
|
||||
|
||||
constructor(mcPath: string, glslangPath: string) {
|
||||
this.minecraftPath = mcPath
|
||||
this.glslangPath = glslangPath
|
||||
}
|
||||
|
||||
public onChange(c: Config) {
|
||||
Object.assign(this, c)
|
||||
}
|
||||
}
|
63
server/src/server.ts
Normal file
63
server/src/server.ts
Normal file
|
@ -0,0 +1,63 @@
|
|||
import * as vsclang from 'vscode-languageserver'
|
||||
import { Config } from './config'
|
||||
import { completions } from './completionProvider';
|
||||
|
||||
const connection = vsclang.createConnection(new vsclang.IPCMessageReader(process), new vsclang.IPCMessageWriter(process));
|
||||
|
||||
const documents = new vsclang.TextDocuments();
|
||||
|
||||
documents.listen(connection);
|
||||
|
||||
const conf = new Config('', '')
|
||||
|
||||
connection.onInitialize((params): vsclang.InitializeResult => {
|
||||
return {
|
||||
capabilities: {
|
||||
textDocumentSync: documents.syncKind,
|
||||
completionProvider: {
|
||||
resolveProvider: true
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
documents.onDidChangeContent((change) => {
|
||||
validateTextDocument(change.document);
|
||||
});
|
||||
|
||||
connection.onDidChangeConfiguration((change) => {
|
||||
conf.onChange(change.settings as Config)
|
||||
documents.all().forEach(validateTextDocument);
|
||||
});
|
||||
|
||||
function validateTextDocument(textDocument: vsclang.TextDocument): void {
|
||||
const diagnostics: vsclang.Diagnostic[] = [];
|
||||
const lines = textDocument.getText().split(/\r?\n/g);
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const index = line.indexOf('typescript');
|
||||
if (index >= 0) {
|
||||
diagnostics.push({
|
||||
severity: vsclang.DiagnosticSeverity.Warning,
|
||||
range: {
|
||||
start: { line: i, character: index },
|
||||
end: { line: i, character: index + 10 }
|
||||
},
|
||||
message: `bananas`,
|
||||
source: 'mcglsl'
|
||||
});
|
||||
}
|
||||
}
|
||||
// Send the computed diagnostics to VS Code.
|
||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
||||
}
|
||||
|
||||
connection.onCompletion((textDocumentPosition: vsclang.TextDocumentPositionParams): vsclang.CompletionItem[] => {
|
||||
return completions
|
||||
});
|
||||
|
||||
connection.onCompletionResolve((item: vsclang.CompletionItem): vsclang.CompletionItem => {
|
||||
return completions[item.data - 1]
|
||||
});
|
||||
|
||||
connection.listen();
|
20
server/tsconfig.json
Normal file
20
server/tsconfig.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"outDir": "../client/server",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitReturns": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode-test",
|
||||
"test"
|
||||
]
|
||||
}
|
42
server/tslint.json
Normal file
42
server/tslint.json
Normal 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"
|
||||
]
|
||||
}
|
||||
}
|
18
shaders.py
Normal file
18
shaders.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
with open('shaders.txt') as f:
|
||||
items = {}
|
||||
lines = filter(lambda s: s.startswith('uniform'), f.readlines())
|
||||
for line in lines:
|
||||
err = False
|
||||
try:
|
||||
detail = int(' '.join(line.split()[3:]))
|
||||
err = True
|
||||
except:
|
||||
pass
|
||||
type = line.split()[1].rstrip('>').lstrip('<')
|
||||
detail = ' '.join(line.split()[3:]) if not err else ''
|
||||
label = line.split()[2].rstrip(';')
|
||||
if label in items:
|
||||
continue
|
||||
items[label] = True
|
||||
detail = ' ' + detail if not detail == '' else ''
|
||||
print('{\n\tlabel: \'%s\',\n\tdetail: \'<%s>%s\'\n},' % (label, type, detail))
|
|
@ -1,27 +0,0 @@
|
|||
import { spawn } from 'child_process'
|
||||
|
||||
//
|
||||
export function runLinter(command: string, ...args: any[]) {
|
||||
const child = spawn(command, ...args)
|
||||
let stderr = ''
|
||||
|
||||
child.stderr.on('data', data => {
|
||||
stderr += data
|
||||
})
|
||||
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
child.on('error', () => reject(new Error('fatal error ${stderr}')))
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
switch (code) {
|
||||
case 0:
|
||||
case 2:
|
||||
resolve(stderr)
|
||||
default:
|
||||
reject(new Error('standard error ${signal} ${stderr}'))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return promise
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
import * as vscode from 'vscode'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import { regLinuxOutput } from './linter/glslProvider'
|
||||
// glslangPath: Path to glslangValidator (assumed in PATH by default)
|
||||
// workDir: the directory in which all the files should be, ending in /shaders
|
||||
// tmpdir: the directory into which the symlinks are stored, should be the OS's temp dir
|
||||
// isWin: are we on Windows?
|
||||
export class Config {
|
||||
public readonly minecraftPath: string
|
||||
public readonly glslangPath: string
|
||||
public readonly workDir: string
|
||||
public readonly tmpdir: string
|
||||
public readonly isWin: boolean
|
||||
public readonly outputMatch: RegExp
|
||||
|
||||
constructor() {
|
||||
const c = vscode.workspace.getConfiguration('mcglsl')
|
||||
|
||||
console.log('[MC-GLSL] glslangValidatorPath set to', c.get('glslangValidatorPath'))
|
||||
console.log('[MC-GLSL] temp directory root set to', path.join(os.tmpdir(), vscode.workspace.name!, 'shaders'))
|
||||
|
||||
this.glslangPath = c.get('glslangValidatorPath') as string
|
||||
this.minecraftPath = c.get('minecraftPath') as string
|
||||
this.isWin = os.platform() === 'win32'
|
||||
this.tmpdir = path.join(os.tmpdir(), vscode.workspace.name!, 'shaders')
|
||||
this.outputMatch = regLinuxOutput
|
||||
this.workDir = path.basename(vscode.workspace.rootPath!) === 'shaders' ?
|
||||
vscode.workspace.rootPath! :
|
||||
path.join(vscode.workspace.rootPath!, 'shaders')
|
||||
}
|
||||
|
||||
public onChange(e: vscode.ConfigurationChangeEvent) {
|
||||
if (e.affectsConfiguration('mcglsl')) {
|
||||
console.log('[MC-GLSL] config changed')
|
||||
Object.assign(this, new Config())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
import * as vscode from 'vscode'
|
||||
import GLSLProvider from './linter/glslProvider'
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
vscode.languages.registerCodeActionsProvider('glsl', new GLSLProvider(context.subscriptions))
|
||||
}
|
||||
|
||||
export function deactivate() {}
|
|
@ -1,11 +0,0 @@
|
|||
declare global {
|
||||
interface String {
|
||||
leftTrim: () => string
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.leftTrim = function(): string {
|
||||
return this.replace(/^\s+/,'')
|
||||
}
|
||||
|
||||
export {}
|
|
@ -1,155 +0,0 @@
|
|||
import * as vscode from 'vscode'
|
||||
import * as shell from 'shelljs'
|
||||
import * as path from 'path'
|
||||
import { runLinter } from '../asyncSpawn'
|
||||
import '../global'
|
||||
import { Config } from '../config'
|
||||
|
||||
// These are used for symlinking as glslangValidator only accepts files in these formats
|
||||
const extensions: { [id: string]: string } = {
|
||||
'.fsh': 'frag',
|
||||
'.vsh': 'vert',
|
||||
'.gsh': 'geom',
|
||||
'.glsl': 'frag',
|
||||
}
|
||||
|
||||
// These will be used to filter out error messages that are irrelevant/incorrect for us
|
||||
// Lot of testing needed to find all the ones that we need to match
|
||||
const filters: RegExp[] = [
|
||||
/(No code generated)/,
|
||||
/(compilation terminated)/,
|
||||
/\/\w*.(vert|frag)$/
|
||||
]
|
||||
|
||||
const regInclude = /^(?: |\t)*(?:#include) "((?:\/[\S]+)+\.(?:glsl))"$/
|
||||
export const regLinuxOutput = /^(WARNING|ERROR): ((?:\/[^/\n]*)+\/*):(\d+): ((?:'[\w\W]*'){1} :[\w ]+)/
|
||||
|
||||
export default class GLSLProvider implements vscode.CodeActionProvider {
|
||||
private diagnosticCollection: vscode.DiagnosticCollection // where errors/warnings/hints are pushed to be displayed
|
||||
private config: Config
|
||||
private onTypeDisposable?: vscode.Disposable
|
||||
|
||||
constructor(subs: vscode.Disposable[]) {
|
||||
this.diagnosticCollection = vscode.languages.createDiagnosticCollection()
|
||||
|
||||
subs.push(this)
|
||||
|
||||
this.config = new Config()
|
||||
|
||||
const c = vscode.workspace.getConfiguration('mcglsl')
|
||||
if (c.get('lintOnType') as boolean) {
|
||||
this.onTypeDisposable = vscode.workspace.onDidChangeTextDocument(this.docChange, this)
|
||||
console.log('[MC-GLSL] linting while typing.')
|
||||
} else {
|
||||
if (this.onTypeDisposable) this.onTypeDisposable.dispose()
|
||||
console.log('[MC-GLSL] not linting while typing.')
|
||||
}
|
||||
|
||||
this.checkBinary()
|
||||
|
||||
vscode.workspace.onDidOpenTextDocument(this.lint, this)
|
||||
vscode.workspace.onDidSaveTextDocument(this.lint, this)
|
||||
|
||||
vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
this.config.onChange(e)
|
||||
this.checkBinary()
|
||||
}, this)
|
||||
|
||||
vscode.workspace.textDocuments.forEach(doc => this.lint(doc))
|
||||
}
|
||||
|
||||
// Check if glslangValidator binary can be found
|
||||
public checkBinary() {
|
||||
if (shell.which(this.config.glslangPath) == null) {
|
||||
const msg = '[MC-GLSL] glslangValidator not found. Please check that you\'ve given the right path.'
|
||||
console.log(msg)
|
||||
vscode.window.showErrorMessage(msg)
|
||||
}
|
||||
}
|
||||
|
||||
public dispose = () => this.diagnosticCollection.dispose()
|
||||
|
||||
// Maybe only lint when files are saved...hmmm
|
||||
private docChange = (e: vscode.TextDocumentChangeEvent) => this.lint(e.document)
|
||||
|
||||
// Returns true if the string matches any of the regex
|
||||
public matchesFilters = (s: string) => filters.some(reg => reg.test(s))
|
||||
|
||||
// Split output by line, remove empty lines and then remove all lines that match any of the regex
|
||||
private filterMessages = (res: string) => res
|
||||
.split('\n')
|
||||
.filter(s => s.length > 1 && !this.matchesFilters(s))
|
||||
.map(s => s.match(this.config.outputMatch))
|
||||
.filter(match => match && match.length > 3)
|
||||
|
||||
// The big boi that does all the shtuff
|
||||
private async lint(document: vscode.TextDocument) {
|
||||
if (document.languageId !== 'glsl') return
|
||||
|
||||
const ext = extensions[path.extname(document.fileName)]
|
||||
const root = '-I'
|
||||
let res = ''
|
||||
|
||||
try {
|
||||
res = await runLinter(this.config.glslangPath, ['-E', '-S', ext, document.uri.path])
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return
|
||||
}
|
||||
console.log(res)
|
||||
const messageMatches = this.filterMessages(res) as RegExpMatchArray[]
|
||||
console.log(messageMatches)
|
||||
|
||||
const diags: vscode.Diagnostic[] = []
|
||||
|
||||
messageMatches.forEach(match => {
|
||||
const [type, lineString, message] = match!.slice(1)
|
||||
const lineNum = parseInt(lineString)
|
||||
|
||||
const severity: vscode.DiagnosticSeverity = type !== 'ERROR:' ? vscode.DiagnosticSeverity.Warning : vscode.DiagnosticSeverity.Error
|
||||
|
||||
const range = this.calcRange(document, lineNum)
|
||||
|
||||
//if (diags.length > 0 && range.isEqual(diags[diags.length - 1].range) && regSyntaxError.test(message)) return
|
||||
|
||||
diags.push(new vscode.Diagnostic(range, '[mc-glsl] ' + message, severity))
|
||||
})
|
||||
|
||||
this.findIncludes(document).forEach(include => {
|
||||
// path.join(this.config.workDir, match![1])
|
||||
if (include.text.includes('../')) {
|
||||
const trimmed = include.text.leftTrim()
|
||||
const offset = include.text.length - trimmed.length
|
||||
const range = new vscode.Range(include.lineNumber, offset, include.lineNumber, offset + trimmed.length)
|
||||
diags.push(new vscode.Diagnostic(range, '[mc-glsl] includes with .. directory movement will fail in zipped shaders.', vscode.DiagnosticSeverity.Warning))
|
||||
}
|
||||
})
|
||||
|
||||
this.diagnosticCollection.set(document.uri, diags)
|
||||
}
|
||||
|
||||
// Finds all lines that contain #include
|
||||
private findIncludes = (document: vscode.TextDocument) => this.filter(document, line => regInclude.test(line.text))
|
||||
|
||||
private filter(document: vscode.TextDocument, f: (s: vscode.TextLine) => boolean): vscode.TextLine[] {
|
||||
const out: vscode.TextLine[] = []
|
||||
for (let i = 0; i < document.lineCount; i++) {
|
||||
if (f(document.lineAt(i))) out.push(document.lineAt(i))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Calculates the start and end character positions to underline
|
||||
private calcRange(document: vscode.TextDocument, lineNum: number): vscode.Range {
|
||||
const line = document.lineAt(lineNum - 1).text
|
||||
const trimmed = line.leftTrim()
|
||||
return new vscode.Range(lineNum - 1, line.length - trimmed.length, lineNum - 1, line.length - 1)
|
||||
}
|
||||
|
||||
public provideCodeActions(document: vscode.TextDocument,
|
||||
range: vscode.Range,
|
||||
context: vscode.CodeActionContext,
|
||||
token: vscode.CancellationToken): vscode.ProviderResult<vscode.Command[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
suite('Extension Tests', () => {
|
||||
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
import * as testRunner from 'vscode/lib/testrunner';
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: true // colored output from test results
|
||||
});
|
||||
|
||||
module.exports = testRunner;
|
Loading…
Add table
Add a link
Reference in a new issue