@@ -9,14 +9,22 @@ import { FrontendApplication } from '@theia/core/lib/browser/frontend-applicatio
9
9
import { FocusTracker , Widget } from '@theia/core/lib/browser' ;
10
10
import { DEFAULT_WINDOW_HASH } from '@theia/core/lib/common/window' ;
11
11
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
12
- import { WorkspaceService as TheiaWorkspaceService } from '@theia/workspace/lib/browser/workspace-service' ;
12
+ import {
13
+ WorkspaceInput ,
14
+ WorkspaceService as TheiaWorkspaceService ,
15
+ } from '@theia/workspace/lib/browser/workspace-service' ;
13
16
import { ConfigService } from '../../../common/protocol/config-service' ;
14
17
import {
15
18
SketchesService ,
16
19
Sketch ,
17
20
} from '../../../common/protocol/sketches-service' ;
18
21
import { BoardsServiceProvider } from '../../boards/boards-service-provider' ;
19
22
import { BoardsConfig } from '../../boards/boards-config' ;
23
+ import { Command } from '@theia/core' ;
24
+
25
+ interface WorkspaceOptions extends WorkspaceInput {
26
+ commands : Command [ ] ;
27
+ }
20
28
21
29
@injectable ( )
22
30
export class WorkspaceService extends TheiaWorkspaceService {
@@ -42,6 +50,7 @@ export class WorkspaceService extends TheiaWorkspaceService {
42
50
protected readonly boardsServiceProvider : BoardsServiceProvider ;
43
51
44
52
private version ?: string ;
53
+ private optionsToAppendToURI ?: WorkspaceOptions ;
45
54
46
55
async onStart ( application : FrontendApplication ) : Promise < void > {
47
56
const info = await this . applicationServer . getApplicationInfo ( ) ;
@@ -82,13 +91,25 @@ export class WorkspaceService extends TheiaWorkspaceService {
82
91
}
83
92
}
84
93
94
+ override open ( uri : URI , options ?: WorkspaceOptions ) : void {
95
+ this . optionsToAppendToURI = options ;
96
+ super . doOpen ( uri ) ;
97
+ }
98
+
85
99
protected override openNewWindow ( workspacePath : string ) : void {
86
100
const { boardsConfig } = this . boardsServiceProvider ;
87
101
const url = BoardsConfig . Config . setConfig (
88
102
boardsConfig ,
89
103
new URL ( window . location . href )
90
104
) ; // Set the current boards config for the new browser window.
91
105
url . hash = workspacePath ;
106
+ if ( this . optionsToAppendToURI ) {
107
+ url . searchParams . set (
108
+ 'commands' ,
109
+ encodeURIComponent ( JSON . stringify ( this . optionsToAppendToURI ?. commands ) )
110
+ ) ;
111
+ this . optionsToAppendToURI = undefined ;
112
+ }
92
113
this . windowService . openNewWindow ( url . toString ( ) ) ;
93
114
}
94
115
0 commit comments