Skip to content

Commit 7625e0f

Browse files
committed
Bump version & fix web version error with fs.existsSync that does not exist
1 parent 2f00058 commit 7625e0f

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"color": "#9ad0ff",
88
"theme": "light"
99
},
10-
"version": "0.6.2",
10+
"version": "0.6.3",
1111
"server_version": "0.6.2",
1212
"publisher": "antaalt",
1313
"repository": {

src/validator.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,18 @@ export function isRunningOnWeb() : boolean {
3636
// Web environment is detected with no fallback on child process which is not supported there.
3737
return typeof cp.spawn !== 'function' || typeof process === 'undefined';
3838
}
39-
function getServerVersion(serverPath: string) : string | null{
40-
console.assert(!isRunningOnWeb());
41-
if (fs.existsSync(serverPath)) {
42-
const result = cp.execSync(serverPath + " --version");
43-
const version = result.toString("utf8").trim();
44-
return version;
39+
function getServerVersion(serverPath: string) : string | null {
40+
if (isRunningOnWeb()) {
41+
// Bundled version always used on the web as we cant access external folders.
42+
return "shader-language-server v" + vscode.extensions.getExtension('antaalt.shader-validator')!.packageJSON.server_version;
4543
} else {
46-
return null;
44+
if (fs.existsSync(serverPath)) {
45+
const result = cp.execSync(serverPath + " --version");
46+
const version = result.toString("utf8").trim();
47+
return version;
48+
} else {
49+
return null;
50+
}
4751
}
4852
}
4953
function isValidVersion(serverVersion: string) {

0 commit comments

Comments
 (0)