mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-07-25 04:04:27 +00:00
Removed placeholder validation function
This commit is contained in:
parent
a4efc94d44
commit
513606542e
4 changed files with 13 additions and 27 deletions
|
@ -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
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue