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

Implement manifest selection #71

Merged
merged 1 commit into from
Feb 27, 2022

Conversation

SeaDve
Copy link
Collaborator

@SeaDve SeaDve commented Feb 15, 2022

Closes #17 and #8

TODO:

  • cleaner implementation and cleanup
  • handle new modules addition changes on manifest
  • watch manifest for on disk changes
  • status bar item for current active manifest

@@ -467,6 +468,12 @@ export class FlatpakManifest {
return new Command('flatpak', args, this.workspace)
}

async deleteBuildDir(): Promise<void> {
Copy link
Owner

Choose a reason for hiding this comment

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

Do we want to do that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we call it on manifest changed and clean command

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and it complains when tried to build init when .flatpak exists. I haven't tested much the edge cases yet, maybe tomorrow

Copy link
Collaborator Author

@SeaDve SeaDve Feb 16, 2022

Choose a reason for hiding this comment

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

hmm maybe just the .flatpak/repo. Since deleting .flatpak deletes every cached dependencies.

Edit: Changed to just delete the repoDir

@SeaDve
Copy link
Collaborator Author

SeaDve commented Feb 16, 2022

Most of the things are now implemented and probably need a commit squash.

One thing I'm not sure about is whether the status bar item should open the active manifest or activate the select-manifest command. Currently, it activates select-manifest if there is no manifest found; otherwise, it opens the active manifest file.

It also needs more testing for edge cases

src/flatpakManifestManager.ts Outdated Show resolved Hide resolved
@SeaDve SeaDve changed the title Draft: Implement manifest selection Implement manifest selection Feb 16, 2022
Copy link
Owner

@bilelmoussaoui bilelmoussaoui left a comment

Choose a reason for hiding this comment

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

I did a quick review, I will get back to this later today

package.json Show resolved Hide resolved
src/workspaceState.ts Show resolved Hide resolved
src/workspaceState.ts Outdated Show resolved Hide resolved
src/workspaceState.ts Outdated Show resolved Hide resolved
src/flatpakRunnerStatusItem.ts Outdated Show resolved Hide resolved
* @param other the more updated FlatpakManifest to get new info from
* @returns whether to request for a rebuild
*/
updateFieldsFrom(other: FlatpakManifest): boolean {
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need to update the fields here? normally we would have separate FlatpakManifest or not?

Copy link
Collaborator Author

@SeaDve SeaDve Feb 16, 2022

Choose a reason for hiding this comment

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

Either could work, but I think the intent is shown better and clearer this way.

Copy link
Owner

Choose a reason for hiding this comment

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

I just noticed you are calling this when the manifest receives changes, I think the best way to handle this is to just the new modified manifest as the active one (if it has the same uri as the currently active one)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to that behavior, and since an activeManifestChanged triggers to clear repoDir. It will ask to initialize a build every manifest modification. So I guess we can remove that message and just handle the build initialization automatically on a build or rebuild command.

Copy link
Owner

Choose a reason for hiding this comment

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

It will ask to initialize a build every manifest modification.

But normally we already know if the manifest uri changed, if not and that manifest state says it was initialized that should give us enough info to know whether we should show the dialog or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nvm, that was not the reason. === operator in js doesn't check by value, but by instance. So had to use util.isDeepStrictEqual, either way, I think it is still better to remove that message, since running any build command should initialize a build

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, sorry. I didn't notice your last message. Was it okay though to remove the message with this reason?

running any build command should initialize a build

Copy link
Owner

Choose a reason for hiding this comment

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

running any build command should initialize a build

It should, but my intention with that dialog is that someone not familiar with Flatpak/VScode could get an idea how to start a build and get the application up and running easily

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should not be a bigger problem with #55. But that makes sense

README.md Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
await this.manifestManager.doWithActiveManifestElseDisplayErr((activeManifest) => {
const runtimeTerminal = window.createTerminal(activeManifest.runtimeTerminal())
this.extCtx.subscriptions.push(runtimeTerminal)
this.activeTerminals.push(runtimeTerminal)
Copy link
Owner

Choose a reason for hiding this comment

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

What happens if the user closes the terminal, is it dropped from the activeTerminals list?

Copy link
Collaborator Author

@SeaDve SeaDve Feb 18, 2022

Choose a reason for hiding this comment

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

ah yeah, that seems problematic. It is only used though to kill terminals when manifest changes. I think we can remove that since we can't also kill terminals that are provided by TerminalProviders.

And I realized killing terminals unknowingly maybe unideal

src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
@bilelmoussaoui
Copy link
Owner

Btw, I sent you an invite for having write access to the repository just in case :)

@SeaDve
Copy link
Collaborator Author

SeaDve commented Feb 18, 2022

thanks :D

@bilelmoussaoui
Copy link
Owner

Could use a rebase

@SeaDve
Copy link
Collaborator Author

SeaDve commented Feb 26, 2022

I'll squash every commits for easier rebase

@SeaDve
Copy link
Collaborator Author

SeaDve commented Feb 26, 2022

image

It shows this message when there is some error on the manifest and the error should be gone when the manifest is updated

@SeaDve
Copy link
Collaborator Author

SeaDve commented Feb 26, 2022

there seems no cleaner way to do it

@SeaDve SeaDve force-pushed the manifest-manager branch 3 times, most recently from 04b4f14 to 29faecf Compare February 26, 2022 15:09
@SeaDve SeaDve mentioned this pull request Feb 26, 2022
@bilelmoussaoui
Copy link
Owner

image

It shows this message when there is some error on the manifest and the error should be gone when the manifest is updated

that looks good enough

src/flatpakManifestManager.ts Show resolved Hide resolved
src/flatpakManifestManager.ts Show resolved Hide resolved
src/flatpakManifestManager.ts Outdated Show resolved Hide resolved
src/flatpakManifestManager.ts Outdated Show resolved Hide resolved
src/flatpakManifestManager.ts Outdated Show resolved Hide resolved
src/flatpakRunner.ts Show resolved Hide resolved
src/flatpakRunner.ts Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
await this.ensurePipelineState()
}

private async resetPipelineState(): Promise<void> {
Copy link
Owner

Choose a reason for hiding this comment

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

Should probably be part of workspaceState and called reset :)

Copy link
Collaborator Author

@SeaDve SeaDve Feb 26, 2022

Choose a reason for hiding this comment

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

we don't want to reset activeManifestUri too. Additionally, workspaceState shouldn't know which keys are part of the pipeline state as most of the pipeline state stuffs are handled in the extension.ts

src/extension.ts Show resolved Hide resolved
@SeaDve SeaDve force-pushed the manifest-manager branch 2 times, most recently from fb3473c to 74e16f9 Compare February 27, 2022 00:11
@bilelmoussaoui
Copy link
Owner

Let us land this and do potential bugfixes/cleanups in following merge requests, awesome work!

@bilelmoussaoui bilelmoussaoui merged commit 08e3a14 into bilelmoussaoui:master Feb 27, 2022
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.

Watch manifest & update state accordingly
2 participants