This commit is contained in:
Noah Santschi-Cooney 2021-02-12 03:23:43 +00:00
parent bbcfe009bb
commit 30bd0dd7f4
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
6 changed files with 19 additions and 11 deletions

View file

@ -83,24 +83,34 @@ export class Extension {
if (!exists) await this.state.updateServerVersion(undefined)
const release = await getReleaseInfo(this.package.version)
log.info(`got release info from Github:\n\t`, JSON.stringify(release))
const platform = platforms[`${process.arch} ${process.platform}`]
if (platform === undefined) {
vscode.window.showErrorMessage('Unfortunately we don\'t ship binaries for your platform yet.')
log.warn(`incompatible architecture/platform:\n\t${process.arch} ${process.platform}`)
return
}
if (release.tag_name === this.state.serverVersion) return
if (release.tag_name === this.state.serverVersion) {
log.info(`server version is same as extension:\n\t`, this.state.serverVersion)
return
}
const artifact = release.assets.find(artifact => artifact.name === `mcshader-lsp-${platform}${(process.platform === 'win32' ? '.exe' : '')}`)
log.info(`artifact with url ${artifact.browser_download_url} found`)
const userResponse = await vscode.window.showInformationMessage(
this.state.serverVersion == undefined ?
`Language server version ${this.package.version} is not installed.` :
`An update is available. Upgrade from ${this.state.serverVersion} to ${release.tag_name}?`,
'Download now'
)
if (userResponse !== 'Download now') return
if (userResponse !== 'Download now') {
log.info('user chose not to download server...')
return
}
await download(artifact.browser_download_url, dest)

View file

@ -29,7 +29,7 @@ export async function getReleaseInfo(releaseTag: string): Promise<GithubRelease>
const json = await response.json()
if(!isRelease(json)) {
throw new TypeError('Received malformed request from Github Release API')
throw new TypeError('Received malformed request from Github Release API ' + JSON.stringify(json))
}
return json
}
@ -72,7 +72,7 @@ async function downloadFile(
const totalBytes = Number(res.headers.get('content-length'))
log.debug('downloading file of', totalBytes, 'bytes size from', url, 'to', destFilePath)
log.debug('downloading file with', totalBytes, 'bytes size from', url, 'to', destFilePath)
let readBytes = 0
res.body.on('data', (chunk: Buffer) => {

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "vscode-mc-shader",
"version": "0.9.0",
"version": "0.9.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -2,7 +2,7 @@
"name": "vscode-mc-shader",
"displayName": "Minecraft GLSL Shaders",
"description": "A Visual Studio Code extension for linting/etc Minecraft GLSL Shaders",
"version": "0.9.1",
"version": "0.9.2",
"publisher": "Strum355",
"author": "Noah Santschi-Cooney (Strum355)",
"license": "MIT",
@ -19,9 +19,7 @@
],
"activationEvents": [
"onLanguage:glsl",
"workspaceContains:**/*.fsh",
"workspaceContains:**/*.vsh",
"workspaceContains:**/*.gsh"
"workspaceContains:shaders/"
],
"extensionDependencies": [
"slevesque.shader"

2
server/Cargo.lock generated
View file

@ -701,7 +701,7 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "mcshader-lsp"
version = "0.1.0"
version = "0.9.2"
dependencies = [
"anyhow",
"bit-set",

View file

@ -1,6 +1,6 @@
[package]
name = "mcshader-lsp"
version = "0.1.0"
version = "0.9.2"
authors = ["Noah Santschi-Cooney <noah@santschi-cooney.ch>"]
edition = "2018"