Skip to content
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

Exclusively use extension URIs and not paths. #336

Merged
merged 2 commits into from
Dec 6, 2022
Merged
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-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