提交 c393e6a3 编写于 作者: B Benjamin Pasero

debt - use some "import type" syntax to ensure the module is not getting loaded

上级 8a3a3d85
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Database, Statement } from 'vscode-sqlite3'; import type { Database, Statement } from 'vscode-sqlite3';
import { Event } from 'vs/base/common/event'; import { Event } from 'vs/base/common/event';
import { timeout } from 'vs/base/common/async'; import { timeout } from 'vs/base/common/async';
import { mapToString, setToString } from 'vs/base/common/map'; import { mapToString, setToString } from 'vs/base/common/map';
......
...@@ -28,9 +28,8 @@ suite('Windows Native Helpers', () => { ...@@ -28,9 +28,8 @@ suite('Windows Native Helpers', () => {
}); });
test('vscode-windows-ca-certs', async () => { test('vscode-windows-ca-certs', async () => {
const windowsCerts = await new Promise<any>((resolve, reject) => { // @ts-ignore Windows only
require(['vscode-windows-ca-certs'], resolve, reject); const windowsCerts = await import('vscode-windows-ca-certs');
});
assert.ok(windowsCerts, 'Unable to load vscode-windows-ca-certs dependency.'); assert.ok(windowsCerts, 'Unable to load vscode-windows-ca-certs dependency.');
}); });
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import type * as keytar from 'keytar';
import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials';
import { IdleValue } from 'vs/base/common/async'; import { IdleValue } from 'vs/base/common/async';
type KeytarModule = typeof import('keytar');
export class KeytarCredentialsService implements ICredentialsService { export class KeytarCredentialsService implements ICredentialsService {
declare readonly _serviceBrand: undefined; declare readonly _serviceBrand: undefined;
private readonly _keytar = new IdleValue<Promise<KeytarModule>>(() => import('keytar')); private readonly _keytar = new IdleValue<Promise<typeof keytar>>(() => import('keytar'));
async getPassword(service: string, account: string): Promise<string | null> { async getPassword(service: string, account: string): Promise<string | null> {
const keytar = await this._keytar.value; const keytar = await this._keytar.value;
......
...@@ -610,7 +610,7 @@ class NativeMenubarControl extends MenubarControl { ...@@ -610,7 +610,7 @@ class NativeMenubarControl extends MenubarControl {
@IStorageService storageService: IStorageService, @IStorageService storageService: IStorageService,
@INotificationService notificationService: INotificationService, @INotificationService notificationService: INotificationService,
@IPreferencesService preferencesService: IPreferencesService, @IPreferencesService preferencesService: IPreferencesService,
@IWorkbenchEnvironmentService protected readonly environmentService: INativeWorkbenchEnvironmentService, @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService,
@IAccessibilityService accessibilityService: IAccessibilityService, @IAccessibilityService accessibilityService: IAccessibilityService,
@IMenubarService private readonly menubarService: IMenubarService, @IMenubarService private readonly menubarService: IMenubarService,
@IHostService hostService: IHostService, @IHostService hostService: IHostService,
......
...@@ -41,23 +41,21 @@ export class NativeAccessibilityService extends AccessibilityService implements ...@@ -41,23 +41,21 @@ export class NativeAccessibilityService extends AccessibilityService implements
this.setAccessibilitySupport(environmentService.configuration.accessibilitySupport ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled); this.setAccessibilitySupport(environmentService.configuration.accessibilitySupport ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
} }
alwaysUnderlineAccessKeys(): Promise<boolean> { async alwaysUnderlineAccessKeys(): Promise<boolean> {
if (!isWindows) { if (!isWindows) {
return Promise.resolve(false); return false;
} }
return new Promise<boolean>(async (resolve) => { const Registry = await import('vscode-windows-registry');
const Registry = await import('vscode-windows-registry');
let value; let value: string | undefined = undefined;
try { try {
value = Registry.GetStringRegKey('HKEY_CURRENT_USER', 'Control Panel\\Accessibility\\Keyboard Preference', 'On'); value = Registry.GetStringRegKey('HKEY_CURRENT_USER', 'Control Panel\\Accessibility\\Keyboard Preference', 'On');
} catch { } catch {
resolve(false); return false;
} }
resolve(value === '1'); return value === '1';
});
} }
setAccessibilitySupport(accessibilitySupport: AccessibilitySupport): void { setAccessibilitySupport(accessibilitySupport: AccessibilitySupport): void {
......
...@@ -493,9 +493,8 @@ async function readCaCertificates() { ...@@ -493,9 +493,8 @@ async function readCaCertificates() {
} }
async function readWindowsCaCertificates() { async function readWindowsCaCertificates() {
const winCA = await new Promise<any>((resolve, reject) => { // @ts-ignore Windows only
require(['vscode-windows-ca-certs'], resolve, reject); const winCA = await import('vscode-windows-ca-certs');
});
let ders: any[] = []; let ders: any[] = [];
const store = winCA(); const store = winCA();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册