Skip to content

Commit

Permalink
Link query param (#149)
Browse files Browse the repository at this point in the history
* Change utm_medium query params to be more specific in links to docs

* Add changelog

* Replace link utm_medium param where platform is cli
  • Loading branch information
gememma authored Sep 5, 2024
1 parent cc8e8f1 commit 1edfec2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/148.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change link attributions from plugin or cli source to vscode source for notifications from mirrord.
9 changes: 8 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ interface IdeMessage {
actions: Set<IdeAction>
}

/**
* Replaces the "plugin" platform query parameter in the given link with "vscode"
*/
function changeQueryParam(link: string): string {
return link.replace("utm_medium=cli", "utm_medium=vscode").replace("utm_medium=plugin", "utm_medium=vscode")

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / e2e / vscode-e2e

Missing semicolon

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / e2e / vscode-e2e

Missing semicolon

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / e2e / vscode-e2e

Missing semicolon

Check warning on line 90 in src/api.ts

View workflow job for this annotation

GitHub Actions / e2e / vscode-e2e

Missing semicolon
}

/**
* Handles the mirrord -> IDE messages that come in json format.
*
Expand All @@ -96,7 +103,7 @@ function handleIdeMessage(message: IdeMessage) {
switch (action.kind) {
case "Link": {
notificationBuilder.withGenericAction(action.label, async () => {
vscode.env.openExternal(vscode.Uri.parse(action.link));
vscode.env.openExternal(vscode.Uri.parse(changeQueryParam(action.link)));
});
break;
}
Expand Down

0 comments on commit 1edfec2

Please sign in to comment.