Closed travis1111 closed 6 years ago
You can inject the FileNavigatorContribution
and then call
navigator.openView({
activate: true
})
Howdy, have been looking around related issues for default view (and wish it was in settings.json somewhow!) + pls. excuse my ignorance, am trying to implement the above as mentioned (I'd really like the terminal open too but that's next!). Is this injected via import at the top of the file and then referenced in @injectable
as per a version of my attempts below as am failing trying multiple ways in frontend-application.ts
and then rebuilding. Still getting an empty workspace.
@injectable()
export class FrontendApplication {
constructor(
...
@inject(FileNavigatorContribution) protected readonly browser: NavigatorContribution
and
protected async createDefaultLayout(): Promise<void> {
for (const initializer of this.contributions.getContributions()) {
if (initializer.initializeLayout) {
await initializer.initializeLayout(this);
/* Donal trying to add the default open.View */
navigator.openView({
activate: true
})
}
}
}
Note: I am snapping a linux container off a gold image running theia and it won't even preserve the gold image workspace/layout (hence my focus on the createDefaultLayout or associated initialisation). Also guessing it's using a session based off the hostname, client agent, IP as layout using browser Local Storage
for theia:/ideaccess/10010/:file:///home/candidate/projectA:layout
and I can't get it to replicate gold image nor open fresh default view with files and terminal, what am I goofing above?
You can inject the
FileNavigatorContribution
and then callnavigator.openView({ activate: true })
FileNavigatorContribution can not be imported by other packages.
This works:app.shell.activateWidget(XXX_WIDGET_ID);
@donalod did you ever figure out how to open a default directory view and keep the terminal open?
@IPvSean negative, I sank too much time and was not familiar enough with it, so I bailed unfortunately. Sorry I don't have better news.
hahaha that is where I am @donalod , exact same problem and I wasted too much time on this already, this is where I gave up for sure-> https://stackoverflow.com/questions/59774219/how-to-open-a-default-folder-when-launching-visual-studio-code-on-newly-provisio
@donalod Could you post a question on the community page (https://spectrum.chat/theia?tab=posts) and provide a github repo with what you were able to achieve? Positing on a closed issue does not help, no one will see it.
The solution implemented in the link below worked for me:
https://github.com/bayodesegun/theia/pull/1/files
If the link above goes down, the solution consists of basically modifying the theia/packages/navigator/src/browser/navigator-contribution.ts
file, more specifically initializeLayout
method.
It was changed from this:
async initializeLayout(app: FrontendApplication): Promise<void> {
await this.openView();
}
to this:
async initializeLayout(app: FrontendApplication): Promise<void> {
// Reveal 'Files' view when opening a workspace for the first time
// See:
// https://github.com/bayodesegun/theia/pull/1
// https://github.com/eclipse-theia/theia/issues/830
await this.openView({ activate: true, reveal: true });
}
Hi, as mentioned in this post:
https://github.com/theia-ide/theia/issues/1546
We would like to display something one the user opens up the editor the very first time. For example the Files Tree view at the left. Currently both files and git views are closed.
We saw this commit:
https://github.com/theia-ide/theia/pull/1605/files
So I guess what I need to do is to extend this:
frontend-application.ts
, and override methodcreateDefaultLayout
, is that correct?If yes, so in that method, open up the files view? how?
thanks