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

Introduce Separate Assay Sidebar #64

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Introduce Separate Assay Sidebar #64

merged 4 commits into from
Jul 11, 2024

Conversation

chrstinalin
Copy link
Contributor

@chrstinalin chrstinalin commented Jun 21, 2024

Closes #58

Changes

  • Replaces the original sidebar menu with a dedicated Assay menu and added the commands to the palette.
  • When add-ons are installed in the root folder, the Assay menu is populated with the add-ons and its (downloaded) versions.
  • The user can then 1) add a new addon, 2) open a version in a new window directly, 3) select two versions and launch their diff tool, or 4) select an add-on or version and delete it.
  • Surfaces getRootFolderPath() Should be Synchronous #65 (see extension.ts#L29-30)

Original:
image

New:
image
image
image
image

@chrstinalin chrstinalin marked this pull request as draft June 21, 2024 17:30
@chrstinalin chrstinalin force-pushed the diff-bar branch 3 times, most recently from 35b0e4a to 1e6e3ea Compare June 24, 2024 13:40
@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 87.56757% with 23 lines in your changes missing coverage. Please review.

Project coverage is 93.01%. Comparing base (087359b) to head (6eb7547).
Report is 2 commits behind head on main.

Files Patch % Lines
src/controller/directoryController.ts 45.00% 11 Missing ⚠️
src/controller/urlController.ts 58.33% 5 Missing ⚠️
src/controller/sidebarController.ts 88.57% 4 Missing ⚠️
src/controller/addonController.ts 60.00% 2 Missing ⚠️
src/model/sidebarTreeDataProvider.ts 98.43% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main      #64    +/-   ##
========================================
  Coverage   93.00%   93.01%            
========================================
  Files          25       27     +2     
  Lines        2589     2763   +174     
  Branches      162      169     +7     
========================================
+ Hits         2408     2570   +162     
- Misses        177      189    +12     
  Partials        4        4            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chrstinalin
Copy link
Contributor Author

chrstinalin commented Jun 24, 2024

Not sure what's causing this:

Just calling await sidebarController.getTreeView() in extension.ts alone causes the command tests to fail, even when no errors are thrown by it and it resolves.

  • This happens even if the entire function is stubbed.
  • The variable names aren't used anywhere else.
  • The entire activate() function is being run, no lines are missing.

Despite that, the tests passing are just a matter of not calling `await sidebarController.getTreeView()...

EDIT 1: Same issue, just with

const rootFolderPath = await directoryController.getRootFolderPath();. The function resolves, but tests fail just by calling it (regardless of whether its a stub).

EDIT 2: It's specifically the RootView.selectRootFolder() call inside getRootFolderPath().

EDIT 3: If not awaited,directoryController.getRootFolderPath()will pass.

EDIT 4: I have a feeling it has something to do with a timing issue with showOpenDialog. Even when stubbed in, for example, the RootView or showRootFolderPath tests, the dialog will always open (unlike QuickPick and other VS Code dialogs). Maybe activate is run through as indicated by the test results, but command registrations do not finish in time?

EDIT 5: I've removed the tests as there's no clear way to fix it.

@chrstinalin chrstinalin marked this pull request as ready for review July 3, 2024 16:46
@chrstinalin chrstinalin requested a review from dotproto July 3, 2024 16:50
@chrstinalin chrstinalin changed the base branch from refactor to main July 3, 2024 20:16
@chrstinalin chrstinalin changed the base branch from main to refactor July 3, 2024 20:17
@willdurand willdurand self-requested a review July 4, 2024 08:23
@chrstinalin chrstinalin force-pushed the diff-bar branch 3 times, most recently from 3d6cd63 to 7c6705f Compare July 8, 2024 14:05
@chrstinalin chrstinalin changed the base branch from refactor to main July 8, 2024 18:10
@chrstinalin chrstinalin changed the base branch from main to refactor July 8, 2024 18:10
@chrstinalin chrstinalin changed the base branch from refactor to main July 8, 2024 18:11
@chrstinalin chrstinalin force-pushed the diff-bar branch 3 times, most recently from 80ad54d to aaca245 Compare July 9, 2024 16:50
@willdurand willdurand removed the request for review from dotproto July 10, 2024 08:39
chrstinalin and others added 2 commits July 10, 2024 08:25
Co-authored-by: William Durand <will+git@drnd.me>
@chrstinalin chrstinalin requested a review from willdurand July 10, 2024 12:43
Copy link
Member

@willdurand willdurand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments before landing this PR.

Comment on lines +114 to +116
const thenable = vscode.workspace.fs.delete(item.uri, { recursive: true });
const promise = Promise.resolve(thenable).catch(() => failedUris.push(item.uri));
promises.push(promise);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably make that simpler:

Suggested change
const thenable = vscode.workspace.fs.delete(item.uri, { recursive: true });
const promise = Promise.resolve(thenable).catch(() => failedUris.push(item.uri));
promises.push(promise);
const promise = vscode.workspace.fs.delete(item.uri, { recursive: true }).catch(() => failedUris.push(item.uri));
promises.push(promise);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript gets mad since 'catch' doesn't exist on type 'Thenable'. As far as I can tell Thenables can do catches, but by using the onRejected parameter of .then() -- and this felt more legible in comparison.

@chrstinalin chrstinalin merged commit 8105041 into main Jul 11, 2024
1 check passed
chrstinalin added a commit that referenced this pull request Jul 11, 2024
* Replaces the original sidebar menu with a dedicated Assay menu and added the commands to the palette.
* When add-ons are installed in the root folder, the Assay menu is populated with the add-ons and its (downloaded) versions.
* The user can then 1) add a new addon, 2) open a version in a new window directly, 3) select two versions and launch their diff tool, or 4) select an add-on or version and delete it.

---------

Co-authored-by: William Durand <will+git@drnd.me>
@chrstinalin chrstinalin deleted the diff-bar branch July 15, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatible Diff Tool Functionality
3 participants