Skip to content

Commit

Permalink
Merge pull request #336 from tonybaloney/vscode_dev_redirection
Browse files Browse the repository at this point in the history
Exclusively use extension URIs and not paths.
  • Loading branch information
tonybaloney authored Dec 6, 2022
2 parents b001bed + 31c1cfb commit fba4645
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
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-pets",
"displayName": "vscode-pets",
"description": "Pets for your VS Code",
"version": "1.19.1",
"version": "1.19.2-beta1",
"engines": {
"vscode": "^1.73.0"
},
Expand Down
16 changes: 1 addition & 15 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as path from 'path';
import * as vscode from 'vscode';
import { ColorThemeKind } from 'vscode';
import {
Expand Down Expand Up @@ -287,7 +286,6 @@ export function activate(context: vscode.ExtensionContext) {
const spec = PetSpecification.fromConfiguration();
PetPanel.createOrShow(
context.extensionUri,
context.extensionPath,
spec.color,
spec.type,
spec.size,
Expand Down Expand Up @@ -342,7 +340,6 @@ export function activate(context: vscode.ExtensionContext) {
const spec = PetSpecification.fromConfiguration();
webviewViewProvider = new PetWebviewViewProvider(
context.extensionUri,
context.extensionPath,
spec.color,
spec.type,
spec.size,
Expand Down Expand Up @@ -628,7 +625,6 @@ export function activate(context: vscode.ExtensionContext) {
PetPanel.revive(
webviewPanel,
context.extensionUri,
context.extensionPath,
spec.color,
spec.type,
spec.size,
Expand Down Expand Up @@ -686,7 +682,6 @@ interface IPetPanel {
class PetWebviewContainer implements IPetPanel {
protected _extensionUri: vscode.Uri;
protected _disposables: vscode.Disposable[] = [];
protected _petMediaPath: string;
protected _petColor: PetColor;
protected _petType: PetType;
protected _petSize: PetSize;
Expand All @@ -696,7 +691,6 @@ class PetWebviewContainer implements IPetPanel {

constructor(
extensionUri: vscode.Uri,
extensionPath: string,
color: PetColor,
type: PetType,
size: PetSize,
Expand All @@ -705,7 +699,6 @@ class PetWebviewContainer implements IPetPanel {
throwBallWithMouse: boolean,
) {
this._extensionUri = extensionUri;
this._petMediaPath = path.join(extensionPath, 'media');
this._petColor = color;
this._petType = type;
this._petSize = size;
Expand Down Expand Up @@ -844,7 +837,7 @@ class PetWebviewContainer implements IPetPanel {

// Get path to resource on disk
const basePetUri = webview.asWebviewUri(
vscode.Uri.file(path.join(this._petMediaPath)),
vscode.Uri.joinPath(this._extensionUri, 'media'),
);

// Use a nonce to only allow specific scripts to be run
Expand Down Expand Up @@ -912,7 +905,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {

public static createOrShow(
extensionUri: vscode.Uri,
extensionPath: string,
petColor: PetColor,
petType: PetType,
petSize: PetSize,
Expand Down Expand Up @@ -951,7 +943,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {
PetPanel.currentPanel = new PetPanel(
panel,
extensionUri,
extensionPath,
petColor,
petType,
petSize,
Expand Down Expand Up @@ -980,7 +971,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {
public static revive(
panel: vscode.WebviewPanel,
extensionUri: vscode.Uri,
extensionPath: string,
petColor: PetColor,
petType: PetType,
petSize: PetSize,
Expand All @@ -991,7 +981,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {
PetPanel.currentPanel = new PetPanel(
panel,
extensionUri,
extensionPath,
petColor,
petType,
petSize,
Expand All @@ -1004,7 +993,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {
private constructor(
panel: vscode.WebviewPanel,
extensionUri: vscode.Uri,
extensionPath: string,
color: PetColor,
type: PetType,
size: PetSize,
Expand All @@ -1014,7 +1002,6 @@ class PetPanel extends PetWebviewContainer implements IPetPanel {
) {
super(
extensionUri,
extensionPath,
color,
type,
size,
Expand Down Expand Up @@ -1123,7 +1110,6 @@ function createPetPlayground(context: vscode.ExtensionContext) {
const spec = PetSpecification.fromConfiguration();
PetPanel.createOrShow(
context.extensionUri,
context.extensionPath,
spec.color,
spec.type,
spec.size,
Expand Down

0 comments on commit fba4645

Please sign in to comment.