Skip to content

2.0.1 #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
8 changes: 8 additions & 0 deletions src/lifecycle/uninstall.mjs
Original file line number Diff line number Diff line change
@@ -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 {}
14 changes: 10 additions & 4 deletions src/ui/decorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(', '));
Expand Down Expand Up @@ -482,11 +488,11 @@ class DecorationManagerForDocument {
}
}
const getPURLParts = (purl: SimPURL) => {
const groups = /^pkg:(?<eco>[^\/]+)\/(?<name>.+)$/v.exec(purl)?.groups
return groups as {
const groups = /^pkg:(?<eco>[^\/]+)\/(?<name>.*)$/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.
Expand Down