Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/issue/electron-browser/nativeIssueFormService.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { DisposableStore } from '../../../../base/common/lifecycle.js';
7
import { IMenuService } from '../../../../platform/actions/common/actions.js';
8
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
9
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
10
import { INativeEnvironmentService } from '../../../../platform/environment/common/environment.js';
11
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
12
import { ILogService } from '../../../../platform/log/common/log.js';
13
import { INativeHostService } from '../../../../platform/native/common/native.js';
14
import product from '../../../../platform/product/common/product.js';
15
import { IAuxiliaryWindowService } from '../../../services/auxiliaryWindow/browser/auxiliaryWindowService.js';
16
import { IHostService } from '../../../services/host/browser/host.js';
17
import { IssueFormService } from '../browser/issueFormService.js';
18
import { IIssueFormService, IssueReporterData } from '../common/issue.js';
19
import { IssueReporter } from './issueReporterService.js';
20
21
export class NativeIssueFormService extends IssueFormService implements IIssueFormService {
22
private readonly store = new DisposableStore();
23
24
constructor(
25
@IInstantiationService instantiationService: IInstantiationService,
26
@IAuxiliaryWindowService auxiliaryWindowService: IAuxiliaryWindowService,
27
@ILogService logService: ILogService,
28
@IDialogService dialogService: IDialogService,
29
@IMenuService menuService: IMenuService,
30
@IContextKeyService contextKeyService: IContextKeyService,
31
@IHostService hostService: IHostService,
32
@INativeHostService private readonly nativeHostService: INativeHostService,
33
@INativeEnvironmentService private readonly environmentService: INativeEnvironmentService,) {
34
super(instantiationService, auxiliaryWindowService, menuService, contextKeyService, logService, dialogService, hostService);
35
}
36
37
// override to grab platform info
38
override async openReporter(data: IssueReporterData): Promise<void> {
39
if (this.hasToReload(data)) {
40
return;
41
}
42
43
const bounds = await this.nativeHostService.getActiveWindowPosition();
44
if (!bounds) {
45
return;
46
}
47
48
await this.openAuxIssueReporter(data, bounds);
49
50
// Get platform information
51
const { arch, release, type } = await this.nativeHostService.getOSProperties();
52
this.arch = arch;
53
this.release = release;
54
this.type = type;
55
56
// create issue reporter and instantiate
57
if (this.issueReporterWindow) {
58
const issueReporter = this.store.add(this.instantiationService.createInstance(IssueReporter, !!this.environmentService.disableExtensions, data, { type: this.type, arch: this.arch, release: this.release }, product, this.issueReporterWindow));
59
issueReporter.render();
60
} else {
61
this.store.dispose();
62
}
63
}
64
}
65
66