mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-07-19 01:05:29 +00:00
Shows error if glslangValidator not found. Also made script to download it
This commit is contained in:
parent
67e9c991a4
commit
44ee663d06
5 changed files with 47 additions and 7 deletions
|
@ -68,7 +68,7 @@ export function preprocess(document: TextDocument) {
|
|||
}
|
||||
if (i === lines.length - 1) lines.splice(0, 0, include)
|
||||
}
|
||||
console.log(lines.join('\n'))
|
||||
//console.log(lines.join('\n'))
|
||||
|
||||
//const root = document.uri.replace(/^file:\/\//, '').replace(conf.minecraftPath, '').replace(path.basename(document.uri), '')
|
||||
lint(lines.join('\n'), document.uri)
|
||||
|
@ -76,6 +76,7 @@ export function preprocess(document: TextDocument) {
|
|||
|
||||
function lint(text: string, uri: string) {
|
||||
const child = exec(`${conf.glslangPath} --stdin -S frag`, (error, out, err) => {
|
||||
if (error) return
|
||||
const diagnostics: Diagnostic[] = []
|
||||
const matches = filterMatches(out) as RegExpMatchArray[]
|
||||
matches.forEach((match) => {
|
||||
|
|
|
@ -2,11 +2,11 @@ import * as vsclang from 'vscode-languageserver'
|
|||
import { Config } from './config'
|
||||
import { completions } from './completionProvider';
|
||||
import { preprocess } from './linter';
|
||||
import { stat } from 'fs';
|
||||
|
||||
export const connection = vsclang.createConnection(new vsclang.IPCMessageReader(process), new vsclang.IPCMessageWriter(process));
|
||||
|
||||
export const documents = new vsclang.TextDocuments();
|
||||
|
||||
documents.listen(connection);
|
||||
|
||||
export let conf = new Config('', '')
|
||||
|
@ -37,6 +37,11 @@ documents.onDidSave((event) => {
|
|||
connection.onDidChangeConfiguration((change) => {
|
||||
const temp = change.settings.mcglsl as Config
|
||||
conf = new Config(temp.minecraftPath, temp.glslangPath)
|
||||
stat(conf.glslangPath, (error) => {
|
||||
if (error) {
|
||||
connection.window.showErrorMessage('glslangValidator not found')
|
||||
}
|
||||
})
|
||||
documents.all().forEach(preprocess);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue