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

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

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