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

[workspace] Improved Recently Used Workspace Handling #809

Merged
merged 3 commits into from
Nov 10, 2017

Conversation

svenefftinge
Copy link
Contributor

With this PR, the recently used workspace root is updated when a frontend unloads, such that the next opened frontend app will use that again.
Also the most recently used workspace root is persisted on the backend's file system (user home), wuch that it can be used, in case no argument is provided on start.

Copy link

@hexa00 hexa00 left a comment

Choose a reason for hiding this comment

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

LGTM. Yeee :)

@kittaakos
Copy link
Contributor

I am starting the review now...

export class WorkspaceService {
export class WorkspaceService implements FrontendApplicationContribution {

root: FileStat | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand why do we have a public property here and another public property getter, tryRoot too. Perhaps, you can explain this to me. The tryRoot at least validates whether the root FileStat (if set) is valid or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should not be public

}

/**
* Unlike [root](WorkspaceService.root), this method gets resolved even if the workspace root URI is not yet set on the backend or if it
* is invalid. In such cases, it will resolve to `undefined`.
*/
get tryRoot(): Promise<FileStat | undefined> {
if (this.root) {
return Promise.resolve(this.root);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, the rest of this property getter never sets the root property which is good because it does not have a side-effect, but then the this.root always remains undefined.

Could you please clean up the documentation, I assume it is not valid anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is set in the constructor, but your question tells me that I should move it here :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I believe that would be cleaner. Otherwise, the rest of the code in this getter is just unused.

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

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

I have tried both in the browser and electron. Works cool. Could you please respond to my inline comments too? Thanks!

@kittaakos
Copy link
Contributor

Another thing that might be interesting; if I have two completely different bundled application, for instance, Yangster and something else. They will override each others last WS configuration in the user's home folder. Perhaps, we do not have to provide an exact solution for that in the context of this task.

@svenefftinge
Copy link
Contributor Author

Another thing that might be interesting; if I have two completely different bundled application, for instance, Yangster and something else. They will override each others last WS configuration in the user's home folder. Perhaps, we do not have to provide an exact solution for that in the context of this task.

Good point. Could you create a ticket for that?

@kittaakos
Copy link
Contributor

Could you create a ticket for that?

#811

@svenefftinge svenefftinge force-pushed the workspace_improvements branch from de0c648 to 57e4db4 Compare November 10, 2017 09:47
@svenefftinge
Copy link
Contributor Author

@kittaakos I addressed your feedback and tested again. Good to merge?

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the changes!

@kittaakos
Copy link
Contributor

Please fix these too:

lerna ERR! execute [compile] src/browser/problem/problem-widget.ts(43,31): error TS2339: Property 'tryRoot' does not exist on type 'WorkspaceService'.
lerna ERR! execute [compile] src/browser/problem/problem-widget.ts(43,44): error TS7006: Parameter 'workspaceFileStat' implicitly has an 'any' type.

Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
@svenefftinge svenefftinge force-pushed the workspace_improvements branch from 57e4db4 to c6adddd Compare November 10, 2017 10:24
… home directory and use it when the backend is started without an explicit root argument.

Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
@svenefftinge svenefftinge force-pushed the workspace_improvements branch from c6adddd to c3152ca Compare November 10, 2017 10:37
@svenefftinge svenefftinge merged commit a195030 into master Nov 10, 2017
@svenefftinge svenefftinge deleted the workspace_improvements branch November 10, 2017 10:55
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.

3 participants