Skip to content

Commit 0fab7bf

Browse files
committed
fixup formatting and eager activation of extension
1 parent 8daac3f commit 0fab7bf

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
},
3434
"icon": "socket-square.png",
3535
"activationEvents": [
36-
"workspaceConatains:**/[pP][aA][cC][kK][aA][gG][eE].[jJ][sS][oO][nN]",
36+
"workspaceContains:**/[pP][aA][cC][kK][aA][gG][eE].[jJ][sS][oO][nN]",
3737
"workspaceContains:**/[rR][eE][qQ][uU][iI][rR][eE][mM][eE][nN][tT][sS].[tT][xX][tT]",
3838
"workspaceContains:**/[pP][yY][pP][rR][oO][jJ][eE][cC][tT].[tT][oO][mM][lL]",
3939
"workspaceContains:**/[pP][iI][pP][fF][iI][lL][eE]",
4040
"workspaceContains:**/[gG][oO].[mM][oO][dD]",
4141
"workspaceContains:**/[gG][oO].[sS][uU][mM]",
4242
"onLanguage:python",
4343
"onLanguage:javascript",
44+
"onLanguage:javascriptreact",
45+
"onLanguage:typescript",
46+
"onLanguage:typescriptreact",
4447
"onLanguage:go"
4548
],
4649
"type": "commonjs",

src/ui/decorations.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,23 +267,35 @@ class DecorationManagerForPURL {
267267
// this is a bit lossy, but better than noise
268268
let typesListed = new Set<string>();
269269
for (const alert of actionGroupedAlertSet) {
270-
let extra = color('#888888', '&nbsp;');
271-
if (alert.props?.alternatePackage) {
272-
extra = `Possible intent: [${name} $(link-external)](https://socket.dev/${eco}/package/${name})`
273-
} else if (alert.props?.lastPublish) {
274-
const lastPublish = new Date(alert.props.lastPublish).toLocaleDateString();
275-
extra = `Last published on: ${lastPublish}`;
276-
} else if (typesListed.has(alert.type)) {
270+
// vscode markdown wants some kind of text for the table layout
271+
let extra = []
272+
let alternatePackage = alert.props?.alternatePackage;
273+
let lastPublish = alert.props?.lastPublish;
274+
let note = alert.props?.note;
275+
if (alternatePackage) {
276+
extra.push(`Possible intent: [${alternatePackage} $(link-external)](https://socket.dev/${eco}/package/${alternatePackage})`)
277+
}
278+
if (lastPublish) {
279+
const lastPublishStr = new Date(alert.props.lastPublish).toLocaleDateString();
280+
extra.push(`Last published on: ${lastPublishStr}`);
281+
}
282+
if (note) {
283+
extra.push(`${note}`);
284+
}
285+
if (typesListed.has(alert.type)) {
277286
continue
278287
}
288+
if (extra.length === 0) {
289+
extra.push(color('#888888', '&nbsp;'));
290+
}
279291
typesListed.add(alert.type);
280292
const rowColor = {
281293
'error': '#ff8800',
282294
'warn': '#cc8800',
283295
'monitor': '#aaaa00',
284296
'ignore': '#888888',
285297
}[alert.action]
286-
ret.push([alert.action, alert.type, extra].map(
298+
ret.push([alert.action, alert.type, extra.join('<br>').replaceAll(/\r?\n/g, '<br>')].map(
287299
(str) => color(rowColor, str) // color the action column
288300
).join(' | '));
289301
}

0 commit comments

Comments
 (0)