-
Notifications
You must be signed in to change notification settings - Fork 448
Expand file tree
/
Copy pathvariable-resolver.contribution.ts
More file actions
40 lines (33 loc) · 1.19 KB
/
variable-resolver.contribution.ts
File metadata and controls
40 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Autowired } from '@opensumi/di';
import {
ClientAppContribution,
ContributionProvider,
Command,
CommandContribution,
CommandRegistry,
Domain,
VariableRegistry,
VariableContribution,
} from '@opensumi/ide-core-browser';
import { VariableQuickOpenService } from './variable-quick-open.service';
export const LIST_VARIABLES: Command = {
id: 'variable.list',
label: '%variable.list.all%',
};
@Domain(ClientAppContribution, CommandContribution)
export class VariableResolverContribution implements ClientAppContribution, CommandContribution {
@Autowired(VariableContribution)
protected readonly contributionProvider: ContributionProvider<VariableContribution>;
@Autowired(VariableRegistry)
protected readonly variableRegistry: VariableRegistry;
@Autowired(VariableQuickOpenService)
protected readonly variableQuickOpenService: VariableQuickOpenService;
onStart(): void {
this.contributionProvider.getContributions().forEach((contrib) => contrib.registerVariables(this.variableRegistry));
}
registerCommands(commands: CommandRegistry): void {
commands.registerCommand(LIST_VARIABLES, {
execute: () => this.variableQuickOpenService.open(),
});
}
}