mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-09-01 14:27:40 +00:00
Fixed regex thanks @mloc. Using reg.test instead of string.match, mucho speed improvements
This commit is contained in:
parent
188ad2a419
commit
2d37440ab2
1 changed files with 5 additions and 8 deletions
|
@ -91,7 +91,7 @@ export default class GLSLProvider implements vscode.CodeActionProvider {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Do we want this here? ¯\_(ツ)_/¯
|
// Do we want this here? ¯\_(ツ)_/¯
|
||||||
vscode.window.showInformationMessage('[MC-GLSL] glslangValidator found!')
|
//vscode.window.showInformationMessage('[MC-GLSL] glslangValidator found!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,10 +108,7 @@ export default class GLSLProvider implements vscode.CodeActionProvider {
|
||||||
// This doesnt work yet >:( note: use .test instead of .match
|
// This doesnt work yet >:( note: use .test instead of .match
|
||||||
private matchesFilters(s: string): boolean {
|
private matchesFilters(s: string): boolean {
|
||||||
return filters.some((reg: RegExp, i: number, array: RegExp[]) => {
|
return filters.some((reg: RegExp, i: number, array: RegExp[]) => {
|
||||||
let m = s.match(reg)
|
return reg.test(s)
|
||||||
console.log(s)
|
|
||||||
console.log(m)
|
|
||||||
return (m && m.length > 1)!
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +129,7 @@ export default class GLSLProvider implements vscode.CodeActionProvider {
|
||||||
let lines = res.split(/(?:\n)/g)
|
let lines = res.split(/(?:\n)/g)
|
||||||
.filter((s: string) => { return s != '' })
|
.filter((s: string) => { return s != '' })
|
||||||
.slice(1, -1)
|
.slice(1, -1)
|
||||||
//.filter((s: string) => { return !this.matchesFilters(s)} )
|
.filter((s: string) => { return this.matchesFilters(s)} )
|
||||||
|
|
||||||
if (lines.length < 1) {
|
if (lines.length < 1) {
|
||||||
// If there were no errors, we need to set the list empty so that the editor reflects that
|
// If there were no errors, we need to set the list empty so that the editor reflects that
|
||||||
|
@ -143,7 +140,7 @@ export default class GLSLProvider implements vscode.CodeActionProvider {
|
||||||
let diags: vscode.Diagnostic[] = []
|
let diags: vscode.Diagnostic[] = []
|
||||||
|
|
||||||
lines.forEach((line: string) => {
|
lines.forEach((line: string) => {
|
||||||
let matches = line.match(/WARNING:|ERROR:\s\d+:(\d+): (\W.*)/)
|
let matches = line.match(/(?:WARNING:|ERROR:)\s\d+:(\d+): (\W.*)/)
|
||||||
if (!matches || (matches && matches.length < 3)) {
|
if (!matches || (matches && matches.length < 3)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue