Removed placeholder validation function

This commit is contained in:
Noah Santschi-Cooney 2018-06-04 21:39:59 +01:00
parent a4efc94d44
commit 513606542e
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
4 changed files with 13 additions and 27 deletions

2
.vscode/launch.json vendored
View file

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

View file

@ -14,9 +14,11 @@ Fork the repo (you are using [SSH keys](https://help.github.com/articles/connect
Install dependencies:
`cd vscode-mc-shader && npm i`
`cd vscode-mc-shader/server && npm i && cd ../client && npm i`
Follow [this](https://code.visualstudio.com/docs/extensions/overview) link to learn your way around making extensions.
Follow [this](https://code.visualstudio.com/docs/extensions/overview) link to learn your way around making extensions as well as [here](https://code.visualstudio.com/docs/extensions/example-language-server) to learn a bit about the Language Server Protocol.
To test out your changes, simply choose `Launch Client` in the debug menu.
## Submitting a Pull Request

5
server/src/linter.ts Normal file
View file

@ -0,0 +1,5 @@
import * as vsclang from 'vscode-languageserver'
export function preprocess(document: vsclang.TextDocument) {
return
}

View file

@ -1,6 +1,7 @@
import * as vsclang from 'vscode-languageserver'
import { Config } from './config'
import { completions } from './completionProvider';
import { preprocess } from './linter';
const connection = vsclang.createConnection(new vsclang.IPCMessageReader(process), new vsclang.IPCMessageWriter(process));
@ -22,36 +23,14 @@ connection.onInitialize((params): vsclang.InitializeResult => {
});
documents.onDidChangeContent((change) => {
validateTextDocument(change.document);
preprocess(change.document);
});
connection.onDidChangeConfiguration((change) => {
conf.onChange(change.settings as Config)
documents.all().forEach(validateTextDocument);
documents.all().forEach(preprocess);
});
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
});