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

Does this extension really need Live Preview? #392

Open
phiter opened this issue Feb 10, 2023 · 5 comments
Open

Does this extension really need Live Preview? #392

phiter opened this issue Feb 10, 2023 · 5 comments

Comments

@phiter
Copy link

phiter commented Feb 10, 2023

Hi! I have Live Preview and when trying to disable Live Preview, I get this warning that this extension depends on it. Is this a bug or an actual dependency?

image

@ryanluker
Copy link
Owner

ryanluker commented Feb 11, 2023

Thanks for the issue @phiter!
You are correct that this isn't a hard dependency but instead an optional one if you wish to use to view the coverage reports in vscode.

Preview Report (activated via command palette): Shows you a html preview of your coverage reports in your editor.

https://github.com/ryanluker/vscode-coverage-gutters#common-commands

After looking around the vscode repo, it seems like there is no ability to make an extension optional... microsoft/vscode#6384

@mattseddon might have good insights or more thoughts, but there could also be other ways to using installed extensions without having to add the live server extension as a hard dependency 🤔.

@mattseddon
Copy link
Collaborator

AFAIK there are three options:

  1. Hard dependency.
  2. Rebuild the external extension's functionality internally.
  3. Check to see if dependency is installed, if not then prompt to install/explain why the dependant functionality doesn't currently work.

For 3 you can use something along the lines of:

import { extensions } from 'vscode'
...
export const isInstalled = (id: string): boolean =>
  !!extensions.all.some(extension => extension.id === id)

or around the boundary of https://github.com/ryanluker/vscode-coverage-gutters/blob/master/src/extension/gutters.ts#L48 you need to check if ms-vscode.live-server was returned and show a toast message (window.showErrorMessage or window.showWarningMessage, probably as a modal)/return early if it wasn't.

Hope that helps. Let me know if you need any more context or details.

@ryanluker
Copy link
Owner

AFAIK there are three options:

1. Hard dependency.

2. Rebuild the external extension's functionality internally.

3. Check to see if dependency is installed, if not then prompt to install/explain why the dependant functionality doesn't currently work.

For 3 you can use something along the lines of:

import { extensions } from 'vscode'
...
export const isInstalled = (id: string): boolean =>
  !!extensions.all.some(extension => extension.id === id)

or around the boundary of https://github.com/ryanluker/vscode-coverage-gutters/blob/master/src/extension/gutters.ts#L48 you need to check if ms-vscode.live-server was returned and show a toast message (window.showErrorMessage or window.showWarningMessage, probably as a modal)/return early if it wasn't.

Hope that helps. Let me know if you need any more context or details.

This helps a ton @mattseddon ! I kinda figured option 3 would be what we would need after I saw the 6+ year old ticket hah 😅.

@ryanluker ryanluker added this to the 2.11.0 milestone Mar 19, 2023
@ryanluker ryanluker modified the milestones: 2.11.0, 2.12.0 Jun 5, 2023
@cameronelliott
Copy link

I really think Coverage Gutters is awesome, but was a bit surprised and disappointed that Live Preview can't be uninstalled while Coverage Gutters is installed.
Thanks for making Coverage Gutters!

@ryanluker
Copy link
Owner

I really think Coverage Gutters is awesome, but was a bit surprised and disappointed that Live Preview can't be uninstalled while Coverage Gutters is installed. Thanks for making Coverage Gutters!

Thanks for the input! I felt similar when we were investigating the feature, but it was a vscode extension api limitation last time I checked 🤔. We probably need to implement one of Matt's suggestions above to get around this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants