turns out it was because i actually forgot to commit the rest. Nice. Have a load of default code

This commit is contained in:
Noah Santschi-Cooney 2018-06-02 22:42:36 +01:00
parent 4436ef11eb
commit 674c3cbb9b
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
8 changed files with 308 additions and 6 deletions

2
.vscode/launch.json vendored
View file

@ -15,7 +15,7 @@
"outFiles": [
"${workspaceRoot}/client/out/**/*.js"
],
"preLaunchTask": "watch:client"
"preLaunchTask": "compile"
},
{
"name": "Attach to Server",

41
client/server/package-lock.json generated Normal file
View file

@ -0,0 +1,41 @@
{
"name": "vscode-mc-shader-server",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"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="
}
}
}

View file

@ -0,0 +1,27 @@
{
"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 ."
}
}

113
client/server/server.js Normal file
View file

@ -0,0 +1,113 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_languageserver_1 = require("vscode-languageserver");
// Create a connection for the server. The connection uses Node's IPC as a transport
const connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.IPCMessageReader(process), new vscode_languageserver_1.IPCMessageWriter(process));
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents = new vscode_languageserver_1.TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
// After the server has started, the client sends an initialize request. The server receives
// in the passed params, the rootPath of the workspace plus the client capabilities.
connection.onInitialize((params) => {
return {
capabilities: {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
// Tell the client that the server supports code completion
completionProvider: {
resolveProvider: true
}
}
};
});
// The content of a text document has changed. This event is emitted
// when the text document is first opened or when its content has changed.
documents.onDidChangeContent((change) => {
validateTextDocument(change.document);
});
// The settings have changed. It is sent on server activation
// as well.
connection.onDidChangeConfiguration((change) => {
documents.all().forEach(validateTextDocument);
});
function validateTextDocument(textDocument) {
const diagnostics = [];
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: vscode_languageserver_1.DiagnosticSeverity.Warning,
range: {
start: { line: i, character: index },
end: { line: i, character: index + 10 }
},
message: `${line.substr(index, 10)} should be spelled TypeScript`,
source: 'ex'
});
}
}
// Send the computed diagnostics to VS Code.
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}
connection.onDidChangeWatchedFiles((change) => {
// Monitored files have changed in VS Code
connection.console.log('We received a file change event');
});
// This handler provides the initial list of the completion items.
connection.onCompletion((textDocumentPosition) => {
// The passed parameter contains the position in the text document in
// which code completion was requested. For this example, we ignore this
// information and always provide the same completion items.
return [
{
label: 'TypeScript',
kind: vscode_languageserver_1.CompletionItemKind.Text,
data: 1
},
{
label: 'JavaScript',
kind: vscode_languageserver_1.CompletionItemKind.Text,
data: 2
}
];
});
// This handler resolves additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item) => {
if (item.data === 1) {
item.detail = 'TypeScript details',
item.documentation = 'TypeScript documentation';
}
else if (item.data === 2) {
item.detail = 'JavaScript details',
item.documentation = 'JavaScript documentation';
}
return item;
});
/*
connection.onDidOpenTextDocument((params) => {
// A text document was opened in VS Code.
// params.uri uniquely identifies the document. For documents stored on disk, this is a file URI.
// params.text the initial full content of the document.
connection.console.log(`${params.textDocument.uri} opened.`);
});
connection.onDidChangeTextDocument((params) => {
// The content of a text document has changed in VS Code.
// params.uri uniquely identifies the document.
// params.contentChanges describe the content changes to the document.
connection.console.log(`${params.textDocument.uri} changed: ${JSON.stringify(params.contentChanges)}`);
});
connection.onDidCloseTextDocument((params) => {
// A text document was closed in VS Code.
// params.uri uniquely identifies the document.
connection.console.log(`${params.textDocument.uri} closed.`);
});
*/
// Listen on the connection
connection.listen();
//# sourceMappingURL=server.js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AACvB,UAAU,CAAC,mBAAmB,CAAC,CAAC,IAAoB,EAAkB,EAAE;IACtE,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;QACnB,IAAI,CAAC,MAAM,GAAG,oBAAoB;YAChC,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAA;KAClD;SAAM,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;QAC1B,IAAI,CAAC,MAAM,GAAG,oBAAoB;YAChC,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAA;KAClD;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;EAkBE;AAEF,2BAA2B;AAC3B,UAAU,CAAC,MAAM,EAAE,CAAC"}

View file

@ -22,6 +22,7 @@
"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 ."
"watch": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -w -p .",
"lint": "tslint -c tslint.json 'src/**/*.ts'"
}
}

View file

@ -1,3 +1,122 @@
import * as vscodeLang from 'vscode-languageserver'
import { exec } from 'child_process'
import { IPCMessageReader, IPCMessageWriter, createConnection, IConnection,
TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity, InitializeResult, TextDocumentPositionParams, CompletionItem, CompletionItemKind
} from 'vscode-languageserver';
// Create a connection for the server. The connection uses Node's IPC as a transport
const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
// After the server has started, the client sends an initialize request. The server receives
// in the passed params, the rootPath of the workspace plus the client capabilities.
connection.onInitialize((params): InitializeResult => {
return {
capabilities: {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
// Tell the client that the server supports code completion
completionProvider: {
resolveProvider: true
}
}
};
});
// The content of a text document has changed. This event is emitted
// when the text document is first opened or when its content has changed.
documents.onDidChangeContent((change) => {
validateTextDocument(change.document);
});
// The settings have changed. It is sent on server activation
// as well.
connection.onDidChangeConfiguration((change) => {
documents.all().forEach(validateTextDocument);
});
function validateTextDocument(textDocument: TextDocument): void {
const diagnostics: 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: DiagnosticSeverity.Warning,
range: {
start: { line: i, character: index },
end: { line: i, character: index + 10 }
},
message: `${line.substr(index, 10)} should be spelled TypeScript`,
source: 'ex'
});
}
}
// Send the computed diagnostics to VS Code.
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}
connection.onDidChangeWatchedFiles((change) => {
// Monitored files have changed in VS Code
connection.console.log('We received a file change event');
});
// This handler provides the initial list of the completion items.
connection.onCompletion((textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
// The passed parameter contains the position in the text document in
// which code completion was requested. For this example, we ignore this
// information and always provide the same completion items.
return [
{
label: 'TypeScript',
kind: CompletionItemKind.Text,
data: 1
},
{
label: 'JavaScript',
kind: CompletionItemKind.Text,
data: 2
}
];
});
// This handler resolves additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item: CompletionItem): CompletionItem => {
if (item.data === 1) {
item.detail = 'TypeScript details',
item.documentation = 'TypeScript documentation'
} else if (item.data === 2) {
item.detail = 'JavaScript details',
item.documentation = 'JavaScript documentation'
}
return item;
});
/*
connection.onDidOpenTextDocument((params) => {
// A text document was opened in VS Code.
// params.uri uniquely identifies the document. For documents stored on disk, this is a file URI.
// params.text the initial full content of the document.
connection.console.log(`${params.textDocument.uri} opened.`);
});
connection.onDidChangeTextDocument((params) => {
// The content of a text document has changed in VS Code.
// params.uri uniquely identifies the document.
// params.contentChanges describe the content changes to the document.
connection.console.log(`${params.textDocument.uri} changed: ${JSON.stringify(params.contentChanges)}`);
});
connection.onDidCloseTextDocument((params) => {
// A text document was closed in VS Code.
// params.uri uniquely identifies the document.
connection.console.log(`${params.textDocument.uri} closed.`);
});
*/
// Listen on the connection
connection.listen();

View file

@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"outDir": "out",
"outDir": "../client/server",
"lib": [
"es6"
],
@ -10,7 +10,7 @@
"rootDir": "src",
"strict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noImplicitReturns": true
},
"exclude": [
"node_modules",