diff --git a/package.json b/package.json index 69f22e8..8617529 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-socket-security", "displayName": "Socket Security", "description": "Editor integration with Socket Security", - "version": "1.1.5", + "version": "2.0.1", "private": true, "preview": false, "categories": [ diff --git a/src/lifecycle/uninstall.mjs b/src/lifecycle/uninstall.mjs new file mode 100644 index 0000000..2cc0d2a --- /dev/null +++ b/src/lifecycle/uninstall.mjs @@ -0,0 +1,8 @@ +// if this is updated, update purl scripts +import fs from 'fs' +import os from 'os' +import path from 'path' +const cacheDir = path.resolve(os.homedir(), '.socket', 'vscode') +try { + fs.rmSync(cacheDir, { recursive: true, force: true }) +} catch {} diff --git a/src/ui/decorations.ts b/src/ui/decorations.ts index a27148b..cfd3659 100644 --- a/src/ui/decorations.ts +++ b/src/ui/decorations.ts @@ -202,6 +202,9 @@ class DecorationManagerForPURL { // we don't need to watch for builtin or local packages this.isBuiltin = isBuiltin(name, eco) this.isLocalPackage = isLocalPackage(name, eco); + if (this.isBuiltin || this.isLocalPackage) { + return + } this.subscriptionCallback = ((data) => { this.packageData = data; this.#eagerDecoration(); @@ -380,7 +383,10 @@ class DecorationManagerForDocument { this.currentDocUpdate.abort(); this.currentDocUpdate = new AbortController(); const thisDocUpdateSignal = this.currentDocUpdate.signal; - const externals = await parseExternals(doc); + let externals; + try { + externals = await parseExternals(doc); + } catch {} if (!externals) return; logger.debug(`Parsed externals for ${docURI}:`, externals.size, 'externals found, aborted:', thisDocUpdateSignal.aborted); logger.debug([...externals.keys()].join(', ')); @@ -482,11 +488,11 @@ class DecorationManagerForDocument { } } const getPURLParts = (purl: SimPURL) => { - const groups = /^pkg:(?[^\/]+)\/(?.+)$/v.exec(purl)?.groups - return groups as { + const groups = /^pkg:(?[^\/]+)\/(?.*)$/v.exec(purl)?.groups + return (groups as { eco: string; name: string; - } + }) ?? { eco: 'unknown', name: 'unknown' } } /** * VSCode makes strong guarantee about 1<->1 text document URI to TextDocument mapping.