-
Notifications
You must be signed in to change notification settings - Fork 80
load packages from workspace-state.json, missing packages can show #370
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
Conversation
Can one of the admins verify this patch? |
3 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this PR just to the fix for local package dependencies.
src/ui/PackageDependencyProvider.ts
Outdated
private async getAllDependencies(folderContext: FolderContext): Promise<PackageNode[]> { | ||
return (await folderContext.getWorkspaceDependencies()).map(dependency => { | ||
const version = | ||
dependency.packageRef.kind === "fileSystem" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested this with swift 5.5 and earlier. Given there was a change to the Package description in 5.6 there is a good chance the workspace state also changed format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for showing version or branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with 5.5, let me check earlier version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5.6, 5.5, 5.4
✅ dependency list OK
✅ edit OK
✅ unedit OK
just kept watching workspace-state.json
changes, it's most relevant to the UI of dependency
- When reset package, it will be deleted, package.resolved has no change
- when edit/unedit package, it will be changed, the path can be read for get the repo, the editing package info will be added into
pins
probably watching the workspace-state.json is the best choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above about watching workspace-state.json. The FileSystemWatcher update triggers on every action we run regardless of whether the workspace-state.json changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revolve
will trigger workspace-state.json
change once even there is no actual change
@swift-server-bot test this please |
@adam-fowler the UI should fully map with |
# Conflicts: # src/ui/PackageDependencyProvider.ts
@swift-server-bot test this please |
I created a quite general project that could cover more test cases, Please check the readme |
@swift-server-bot test this please |
FYI. I noticed that, the dependencies of workspace-state.json is not exactly the showing-list, for example I will fix it |
d693b49
to
65cc690
Compare
65cc690
to
8b72eef
Compare
{ | ||
"command": "swift.uneditDependency", | ||
"when": "view == packageDependencies && viewItem == editing" | ||
"when": "view == packageDependencies && viewItem == edited" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind this change
// view | ||
if (triggerResolvedUpdatedEvent && !folderContext.hasResolveErrors) { | ||
folderContext.fireEvent(FolderEvent.resolvedUpdated); | ||
folderContext.fireEvent(FolderEvent.workspaceStateUpdated); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only trigger UI updates
@@ -194,15 +187,27 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree | |||
.filter(dependency => !dependency.requirement && dependency.url) | |||
.map( | |||
dependency => | |||
new PackageNode(dependency.identity, dependency.url!, "local", "local") | |||
new PackageNode( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added identity
to PackageNote
, so have to change it here
Why are you traversing the packages to run |
The case is when you
I think so? if we watch the if you run Here are some interesting code in spm |
Ok, there should be easier ways to sort this out. This is quite a niche issue and rebuilding the whole code base to fix this seems a bit of an over reaction.
Currently
I would like to break down this PR into smaller sections. I have a very basic branch which gives you the basics of displaying local dependencies of local dependencies #377. It currently loads |
As my observation, it's updated when
I agree, it will trigger
Thank you! But firstly let me confirm something
I just debugged but I didn't see it's loaded twice. Do you mean the case that we watch
|
I've seen updates on every build, maybe I should verify. If this isn't the case then maybe as another PR we could look at adding a workspace-state file watcher and add a new event
I fixed that after writing the comment. That PR is just waiting to be approved and then you can build off of that one. |
Oh, I didn't observe on probably there is no content change but it's still updated, if we want to use
Do you mean just showing the dependencies from |
this is now merged. You can create a PR off that one. Lets first merge the three functions |
Shall we close this now? |
main package --> local A --> local B
if local A depends on local B
local B will not be shown in dependency list unless writting the dependency local B in main package expicitly
I've found
workspaceState?.object.dependencies
is exactly the same results as in the XcodeAnd the other thing is Xcode shows the
name
of packages but this is showingidentify
ofpackage
Here is helping locate the issue fast, Free free to close
edit locally
for remote packageedit locally
anduse local package
both work OKhttps://swift-server.slack.com/archives/C02PV8T5HQD/p1658595325605139