mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-02 16:13: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
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -12,7 +12,7 @@
|
|||
"outFiles": [
|
||||
"${workspaceRoot}/client/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile:client"
|
||||
"preLaunchTask": "npm: compile"
|
||||
},
|
||||
{
|
||||
"name": "Attach to Server",
|
||||
|
|
|
@ -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
5
server/src/linter.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import * as vsclang from 'vscode-languageserver'
|
||||
|
||||
export function preprocess(document: vsclang.TextDocument) {
|
||||
return
|
||||
}
|
|
@ -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