From ede27cfb7824ecb862f69991ff872ebeea0a968f Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 4 Aug 2026 16:38:13 -0700 Subject: [PATCH] Migrate extension and tooling to native ESM Use package-native ESM and NodeNext TypeScript across the extension, tooling, Jest, and integration entry points, with normal tsc emission and a native .mjs extension bundle. Retain only the audited createRequire bridge required by bundled CommonJS dependencies, select the telemetry ESM entry, and update signing, debugging, packaging, and artifact safeguards for .mjs output. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 720632a5-5bd9-43bb-9349-6c1a02fe3347 --- .vscode/launch.json | 46 +- .vscodeignore | 2 +- __mocks__/vscode.ts | 6 +- baseJestConfig.mjs | 37 ++ baseJestConfig.ts | 15 - esbuild.js | 76 --- esbuild.mjs | 129 +++++ eslint.config.mjs | 10 +- jest.config.ts => jest.config.mjs | 23 +- msbuild/signing/signJs/signJs.proj | 3 + package-lock.json | 531 ++++++++++++------ package.json | 69 +-- src/activateOmniSharp.ts | 18 +- src/activateRoslyn.ts | 40 +- src/checkSupportedPlatform.ts | 4 +- src/common.ts | 2 +- src/compositeDisposable.ts | 2 +- src/coreclrDebug/activate.ts | 26 +- src/coreclrDebug/util.ts | 6 +- src/csharpExtensionExports.ts | 8 +- src/eventStream.ts | 2 +- src/installRuntimeDependencies.ts | 14 +- src/lsptoolshost/activate.ts | 55 +- src/lsptoolshost/autoInsert/onAutoInsert.ts | 4 +- .../autoInsert/onAutoInsertFeature.ts | 2 +- src/lsptoolshost/commands.ts | 26 +- src/lsptoolshost/copilot/contextProviders.ts | 6 +- src/lsptoolshost/copilot/copilotChatSurvey.ts | 8 +- src/lsptoolshost/debugger/debugger.ts | 18 +- ...slynWorkspaceDebugConfigurationProvider.ts | 12 +- .../diagnostics/buildDiagnosticsService.ts | 2 +- .../diagnostics/buildResultReporterService.ts | 2 +- .../diagnostics/diagnosticMiddleware.ts | 2 +- .../diagnostics/fixAllCodeAction.ts | 10 +- .../diagnostics/nestedCodeAction.ts | 11 +- .../dotnetRuntimeExtensionResolver.ts | 16 +- .../extensions/builtInComponents.ts | 5 +- .../roslynLanguageServerExportChannel.ts | 2 +- .../generators/sourceGeneratorsRefresh.ts | 6 +- .../handlers/showToastNotification.ts | 10 +- src/lsptoolshost/logging/collectLogs.ts | 10 +- src/lsptoolshost/logging/loggingUtils.ts | 8 +- src/lsptoolshost/logging/profiling.ts | 2 +- .../options/configurationMiddleware.ts | 4 +- src/lsptoolshost/options/optionChanges.ts | 12 +- .../projectContext/projectContextCommands.ts | 6 +- .../projectContext/projectContextFeature.ts | 2 +- .../projectContext/projectContextService.ts | 16 +- .../projectContext/projectContextStatus.ts | 10 +- src/lsptoolshost/projectRestore/restore.ts | 8 +- .../razor/documentContentsRequest.ts | 2 +- src/lsptoolshost/razor/htmlDocument.ts | 2 +- .../razor/htmlDocumentContentProvider.ts | 6 +- src/lsptoolshost/razor/htmlDocumentManager.ts | 14 +- src/lsptoolshost/razor/razorEndpoints.ts | 34 +- .../razor/showGeneratedDocumentCommand.ts | 12 +- .../server/languageServerEvents.ts | 2 +- .../server/roslynLanguageClient.ts | 14 +- .../server/roslynLanguageServer.ts | 69 +-- src/lsptoolshost/server/roslynProtocol.ts | 2 +- src/lsptoolshost/server/serverCommands.ts | 4 +- .../serviceBroker/brokeredServicesHosting.ts | 2 +- .../solutionSnapshotProvider.ts | 4 +- src/lsptoolshost/testing/unitTesting.ts | 12 +- .../workspace/miscellaneousFileNotifier.ts | 8 +- .../workspace/workspaceCommands.ts | 6 +- src/lsptoolshost/workspace/workspaceStatus.ts | 6 +- src/main.ts | 54 +- src/networkSettings.ts | 2 +- src/omnisharp/dotnetResolver.ts | 8 +- src/omnisharp/engines/IEngine.ts | 16 +- src/omnisharp/engines/lspEngine.ts | 87 +-- src/omnisharp/engines/stdioEngine.ts | 82 +-- src/omnisharp/features/abstractProvider.ts | 6 +- src/omnisharp/features/changeForwarding.ts | 10 +- src/omnisharp/features/codeActionProvider.ts | 16 +- src/omnisharp/features/codeLensProvider.ts | 16 +- src/omnisharp/features/commands.ts | 28 +- src/omnisharp/features/completionProvider.ts | 14 +- .../definitionMetadataDocumentProvider.ts | 120 ++-- src/omnisharp/features/definitionProvider.ts | 16 +- src/omnisharp/features/diagnosticsProvider.ts | 24 +- .../features/documentHighlightProvider.ts | 8 +- .../features/documentSymbolProvider.ts | 8 +- src/omnisharp/features/documentation.ts | 2 +- src/omnisharp/features/dotnetTest.ts | 26 +- .../features/fileOpenCloseProvider.ts | 10 +- src/omnisharp/features/fixAll.ts | 2 +- src/omnisharp/features/fixAllProvider.ts | 18 +- .../features/formattingEditProvider.ts | 6 +- src/omnisharp/features/hoverProvider.ts | 8 +- .../features/implementationProvider.ts | 8 +- src/omnisharp/features/inlayHintProvider.ts | 16 +- src/omnisharp/features/referenceProvider.ts | 14 +- src/omnisharp/features/renameProvider.ts | 8 +- .../features/semanticTokensProvider.ts | 14 +- .../features/signatureHelpProvider.ts | 8 +- .../sourceGeneratedDocumentProvider.ts | 8 +- src/omnisharp/features/structureProvider.ts | 6 +- .../features/virtualDocumentTracker.ts | 14 +- .../features/workspaceSymbolProvider.ts | 192 +++---- .../fileOperationsResponseEditBuilder.ts | 6 +- src/omnisharp/languageMiddlewareFeature.ts | 2 +- src/omnisharp/launcher.ts | 8 +- .../backgroundWorkStatusBarObserver.ts | 10 +- .../observers/baseStatusBarItemObserver.ts | 4 +- .../observers/csharpLoggerObserver.ts | 8 +- .../observers/dotnetChannelObserver.ts | 6 +- .../observers/dotnetLoggerObserver.ts | 8 +- .../observers/dotnetTestChannelObserver.ts | 6 +- .../observers/dotnetTestLoggerObserver.ts | 10 +- .../observers/errorMessageObserver.ts | 10 +- .../observers/informationMessageObserver.ts | 10 +- .../observers/omnisharpChannelObserver.ts | 10 +- .../omnisharpDebugModeLoggerObserver.ts | 8 +- .../observers/omnisharpLoggerObserver.ts | 12 +- .../observers/omnisharpStatusBarObserver.ts | 8 +- .../observers/projectStatusBarObserver.ts | 8 +- .../observers/razorLoggerObserver.ts | 8 +- src/omnisharp/observers/telemetryObserver.ts | 22 +- .../observers/warningMessageObserver.ts | 10 +- src/omnisharp/omniSharpMonoResolver.ts | 8 +- src/omnisharp/omnisharpDownloader.ts | 24 +- src/omnisharp/omnisharpLanguageServer.ts | 82 +-- src/omnisharp/omnisharpLoggingEvents.ts | 12 +- src/omnisharp/omnisharpManager.ts | 8 +- src/omnisharp/omnisharpOptionChanges.ts | 8 +- src/omnisharp/omnisharpPackageCreator.ts | 2 +- ...isharpWorkspaceDebugInformationProvider.ts | 10 +- src/omnisharp/prioritization.ts | 2 +- src/omnisharp/protocol.ts | 2 +- src/omnisharp/requestQueue.ts | 6 +- src/omnisharp/requirementCheck.ts | 10 +- src/omnisharp/server.ts | 52 +- src/omnisharp/typeConversion.ts | 2 +- src/omnisharp/utils.ts | 6 +- src/packageManager/IInstallDependencies.ts | 2 +- src/packageManager/absolutePathPackage.ts | 6 +- .../downloadAndInstallPackages.ts | 30 +- src/packageManager/fileDownloader.ts | 10 +- .../getAbsolutePathPackagesToInstall.ts | 8 +- src/packageManager/isValidDownload.ts | 4 +- src/packageManager/package.ts | 2 +- src/packageManager/packageError.ts | 4 +- src/packageManager/packageFilterer.ts | 6 +- src/packageManager/zipInstaller.ts | 14 +- src/razor/razorOmnisharp.ts | 4 +- src/razor/razorOmnisharpDownloader.ts | 18 +- .../blazorDebugConfigurationProvider.ts | 22 +- .../src/blazorDebug/terminateDebugHandler.ts | 2 +- .../colorPresentationHandler.ts | 8 +- .../serializableColorPresentation.ts | 2 +- .../serializableColorPresentationParams.ts | 4 +- .../src/documentColor/documentColorHandler.ts | 4 +- .../serializableColorInformation.ts | 2 +- src/razor/src/folding/foldingRangeHandler.ts | 2 +- src/razor/src/formatting/formattingHandler.ts | 6 +- .../serializableFormattingResponse.ts | 2 +- src/razor/src/razorLanguage.ts | 2 +- src/razor/src/razorLanguageConfiguration.ts | 2 +- src/razor/src/rpc/serializableRange.ts | 2 +- src/razor/src/rpc/serializableTextEdit.ts | 2 +- src/shared/assets.ts | 10 +- src/shared/configurationProvider.ts | 14 +- .../constants/IHostExecutableResolver.ts | 2 +- src/shared/dotnetConfigurationProvider.ts | 14 +- src/shared/limitedActivationStatus.ts | 6 +- src/shared/loggingEvents.ts | 4 +- src/shared/migrateOptions.ts | 6 +- src/shared/observables/createOptionStream.ts | 2 +- src/shared/observers/baseChannelObserver.ts | 4 +- src/shared/observers/baseLoggerObserver.ts | 6 +- src/shared/observers/csharpChannelObserver.ts | 6 +- src/shared/observers/csharpLoggerObserver.ts | 8 +- src/shared/observers/optionChangeObserver.ts | 4 +- src/shared/observers/utils/showMessage.ts | 2 +- src/shared/platform.ts | 8 +- src/shared/processPicker.ts | 6 +- src/shared/projectConfiguration.ts | 10 +- src/shared/reportIssue.ts | 8 +- src/shared/telemetryReporter.ts | 9 +- src/shared/utils.ts | 2 +- src/shared/utils/getDotnetInfo.ts | 6 +- src/shared/workspaceConfigurationProvider.ts | 12 +- src/statusBarItemAdapter.ts | 2 +- src/textEditorAdapter.ts | 2 +- src/tools/runtimeDependencyPackageUtils.ts | 8 +- src/tools/updatePackageDependencies.ts | 14 +- src/utils/dotnetDevCertsHttps.ts | 4 +- src/utils/getCSharpDevKit.ts | 4 +- src/utils/getMonoVersion.ts | 2 +- src/utils/getMsBuildInfo.ts | 4 +- tasks/compilation/bundleAudit.mjs | 195 +++++++ tasks/components/publishRoslynCopilot.ts | 6 +- tasks/debugger/fixLocUrls.ts | 2 +- tasks/debugger/generateOptionsSchema.ts | 4 +- tasks/debugger/updatePackageDependencies.ts | 4 +- .../publishLocalizationContent.ts | 2 +- tasks/packaging/installDependencies.ts | 4 +- tasks/packaging/installDependenciesClean.ts | 4 +- tasks/packaging/offlinePackagingTasks.ts | 26 +- tasks/packaging/updateRoslynVersion.ts | 6 +- tasks/packaging/vsceTasks.ts | 6 +- tasks/packaging/vsixReleasePackage.ts | 4 +- tasks/profiling/profiling.ts | 6 +- tasks/projectPaths.ts | 7 +- tasks/signing/installSignPlugin.ts | 6 +- tasks/signing/signJs.ts | 6 +- tasks/signing/signVsix.ts | 6 +- tasks/signing/signingTasks.ts | 2 +- tasks/signing/verifyVsix.ts | 4 +- tasks/snap/incrementVersion.ts | 4 +- tasks/snap/snapTasks.ts | 2 +- tasks/snap/updateChangelog.ts | 6 +- tasks/snap/updateVersionForStableRelease.ts | 4 +- tasks/spawnNode.ts | 2 +- tasks/tags/createTags.ts | 8 +- tasks/tests/omnisharptest.ts | 4 +- tasks/tests/omnisharptestIntegration.ts | 4 +- tasks/tests/omnisharptestTasks.ts | 8 +- tasks/tests/omnisharptestUnit.ts | 4 +- tasks/tests/test.ts | 4 +- tasks/tests/testArtifacts.ts | 4 +- tasks/tests/testHelpers.ts | 10 +- tasks/tests/testIntegrationCsharp.ts | 4 +- tasks/tests/testIntegrationDevkit.ts | 4 +- tasks/tests/testIntegrationRazorCohost.ts | 4 +- tasks/tests/testIntegrationUntrusted.ts | 4 +- tasks/tests/testTasks.ts | 15 +- tasks/tests/testUnit.ts | 4 +- test/createTmpAsset.ts | 6 +- test/fakes.ts | 11 +- test/jestProjectNames.d.mts | 16 + test/jestProjectNames.mjs | 16 + .../artifactTests/extensionBundle.test.ts | 43 ++ .../{jest.config.ts => jest.config.mjs} | 11 +- test/lsptoolshost/artifactTests/vsix.test.ts | 35 +- .../buildDiagnostics.integration.test.ts | 6 +- .../classification.integration.test.ts | 4 +- .../codeactions.integration.test.ts | 4 +- .../codelens.integration.test.ts | 4 +- .../commandEnablement.integration.test.ts | 6 +- .../completion.integration.test.ts | 4 +- .../integrationTests/diagnosticsHelpers.ts | 2 +- .../documentDiagnostics.integration.test.ts | 8 +- ...documentSymbolProvider.integration.test.ts | 4 +- .../fileBasedPrograms.integration.test.ts | 6 +- .../formatting.integration.test.ts | 6 +- ...formattingEditorConfig.integration.test.ts | 6 +- .../gotoDefinition.integration.test.ts | 4 +- .../gotoImplementation.integration.test.ts | 4 +- .../hover.integration.test.ts | 4 +- test/lsptoolshost/integrationTests/index.ts | 6 +- .../integrationTests/integrationHelpers.ts | 8 +- .../integrationTests/jest.config.mjs} | 13 +- .../lspInlayHints.integration.test.ts | 4 +- .../onAutoInsert.integration.test.ts | 4 +- .../references.integration.test.ts | 4 +- .../signatureHelp.integration.test.ts | 4 +- .../sourceGenerator.integration.test.ts | 4 +- .../integrationTests/testAssets/razorApp.ts | 2 +- .../testAssets/singleCsproj.ts | 2 +- .../testAssets/slnFilterWithCsproj.ts | 2 +- .../testAssets/slnWithCsproj.ts | 2 +- .../testAssets/slnWithGenerator.ts | 2 +- .../testAssets/testAssetWorkspace.ts | 12 +- .../integrationTests/testAssets/testAssets.ts | 6 +- .../unitTests.integration.test.ts | 6 +- .../workspaceDiagnostics.integration.test.ts | 8 +- .../unitTests/captureActivityLogs.test.ts | 2 +- .../unitTests/configurationMiddleware.test.ts | 2 +- .../unitTests/csharpChannelObserver.test.ts | 6 +- .../unitTests/csharpLoggerObserver.test.ts | 12 +- .../{jest.config.ts => jest.config.mjs} | 12 +- test/lsptoolshost/unitTests/json.test.ts | 2 +- ...languageServerConfigChangeObserver.test.ts | 4 +- .../unitTests/migrateOptions.test.ts | 29 +- .../unitTests/roslynLanguageClient.test.ts | 9 +- .../advisor.integration.test.ts | 6 +- .../codeActionRename.integration.test.ts | 8 +- .../codeLensProvider.integration.test.ts | 6 +- .../completionProvider.integration.test.ts | 6 +- .../definitionProvider.test.ts | 10 +- .../diagnostics.integration.test.ts | 8 +- ...documentSymbolProvider.integration.test.ts | 4 +- ...nCommentAutoFormatting.integration.test.ts | 2 +- .../dotnetTest.integration.test.ts | 14 +- .../hoverProvider.integration.test.ts | 4 +- .../implementationProvider.test.ts | 6 +- .../omnisharpIntegrationTests/index.ts | 6 +- .../inlayHints.integration.test.ts | 12 +- .../integrationHelpers.ts | 8 +- .../{jest.config.ts => jest.config.mjs} | 13 +- .../languageMiddleware.integration.test.ts | 6 +- .../launchConfiguration.integration.test.ts | 10 +- .../launcher.test.ts | 4 +- .../omnisharpCommands.integration.test.ts | 9 +- .../parsedEnvironmentFile.test.ts | 2 +- .../reAnalyze.integration.test.ts | 16 +- .../referenceProvider.test.ts | 6 +- .../semanticTokensProvider.test.ts | 4 +- .../signatureHelp.integration.test.ts | 4 +- .../sourceGeneratorDefinitionProvider.test.ts | 8 +- .../testAssets/activeTestAssetWorkspace.ts | 14 +- .../testAssets/omnisharpTestAssetWorkspace.ts | 15 +- .../typeDefinitionProvider.test.ts | 10 +- ...virtualDocumentTracker.integration.test.ts | 6 +- ...orkspaceSymbolProvider.integration.test.ts | 4 +- .../omnisharpUnitTests/absolutePath.test.ts | 4 +- .../omnisharpUnitTests/assets.test.ts | 8 +- .../blazorWebAssemblyDetection.test.ts | 10 +- .../omnisharpUnitTests/common.test.ts | 2 +- .../coreclrDebug/targetArchitecture.test.ts | 6 +- .../fakes/fakeDotnetResolver.ts | 4 +- .../fakes/fakeMonoResolver.ts | 4 +- .../features/reportIssue.test.ts | 8 +- .../informationMessageObserver.test.ts | 4 +- .../installRuntimeDependencies.test.ts | 16 +- .../{jest.config.ts => jest.config.mjs} | 12 +- .../backgroundWorkStatusBarObserver.test.ts | 8 +- .../logging/dotnetChannelObserver.test.ts | 6 +- .../logging/dotnetLoggerObserver.test.ts | 8 +- .../logging/dotnetTestChannelObserver.test.ts | 8 +- .../logging/dotnetTestLoggerObserver.test.ts | 10 +- .../logging/errorMessageObserver.test.ts | 10 +- .../logging/omnisharpChannelObserver.test.ts | 8 +- .../omnisharpDebugModeLoggerObserver.test.ts | 8 +- .../logging/omnisharpLoggerObserver.test.ts | 10 +- .../omnisharpStatusBarObserver.test.ts | 8 +- .../logging/projectStatusBarObserver.test.ts | 8 +- .../logging/razorLoggerObserver.test.ts | 6 +- .../logging/telemetryObserver.test.ts | 27 +- .../logging/warningMessageObserver.test.ts | 6 +- .../omnisharp/omniSharpMonoResolver.test.ts | 4 +- .../omnisharpDownloader.test.ts | 26 +- .../omnisharpManager.test.ts | 24 +- .../omnisharpPackageCreator.test.ts | 8 +- .../optionChangeObserver.test.ts | 4 +- .../omnisharpUnitTests/optionStream.test.ts | 4 +- .../omnisharpUnitTests/options.test.ts | 4 +- .../downloadAndInstallPackages.test.ts | 26 +- .../packages/fileDownloader.test.ts | 12 +- .../packages/isValidDownload.test.ts | 4 +- .../packages/packageFilterer.test.ts | 30 +- .../omnisharpUnitTests/packages/proxy.test.ts | 2 +- .../packages/zipInstaller.test.ts | 22 +- .../omnisharpUnitTests/platform.test.ts | 2 +- .../omnisharpUnitTests/processPicker.test.ts | 2 +- .../testAssets/getConfigChangeEvent.ts | 2 +- .../testAssets/mockHttpsServer.ts | 7 +- .../testAssets/testEventBus.ts | 6 +- .../omnisharpUnitTests/testAssets/testZip.ts | 2 +- test/omnisharp/runFeatureTests.ts | 6 +- .../completion.integration.test.ts | 4 +- .../formatting.integration.test.ts | 4 +- .../hover.integration.test.ts | 4 +- test/razor/razorIntegrationTests/index.ts | 6 +- .../razorIntegrationTests/jest.config.mjs} | 13 +- .../reference.integration.test.ts | 4 +- .../rename.integration.test.ts | 4 +- .../testAssets/testAssetWorkspace.ts | 5 +- .../tests/addTagHelperDirective.ts | 2 +- .../tests/attributeDirective.ts | 2 +- .../tests/codeBlock.ts | 2 +- .../tests/codeDirective.ts | 2 +- .../tests/doStatement.ts | 2 +- .../tests/elsePart.ts | 2 +- .../tests/explicitExpressionInAttribute.ts | 2 +- .../tests/explicitExpressions.ts | 2 +- .../tests/forStatement.ts | 2 +- .../tests/foreachStatement.ts | 2 +- .../tests/functionsDirective.ts | 2 +- .../tests/grammarTests.test.ts | 78 +-- .../tests/htmlDynamicAttribute.ts | 2 +- .../tests/ifStatement.ts | 2 +- .../tests/implementsDirective.ts | 2 +- .../tests/implicitExpressionInAttribute.ts | 2 +- .../tests/implicitExpressions.ts | 2 +- .../tests/infrastructure/snapshotFactory.ts | 2 +- .../tests/infrastructure/testUtilities.ts | 4 +- .../tokenizedContentProvider.ts | 14 +- .../tests/inheritsDirective.ts | 2 +- .../tests/injectDirective.ts | 2 +- .../tests/layoutDirective.ts | 2 +- .../tests/lockStatement.ts | 2 +- .../tests/modelDirective.ts | 2 +- .../tests/namespaceDirective.ts | 2 +- .../tests/pageDirective.ts | 2 +- .../tests/preservewhitespaceDirective.ts | 2 +- .../tests/razorComment.ts | 2 +- .../tests/razorTemplate.ts | 2 +- .../tests/removeTagHelperDirective.ts | 2 +- .../tests/rendermodeDirective.ts | 2 +- .../tests/scriptBlock.ts | 2 +- .../tests/sectionDirective.ts | 2 +- .../tests/styleBlock.ts | 2 +- .../tests/switchStatement.ts | 2 +- .../tests/tagHelperPrefixDirective.ts | 2 +- .../tests/transitions.ts | 2 +- .../tests/tryStatement.ts | 2 +- .../tests/typeparamDirective.ts | 2 +- .../tests/usingDirective.ts | 2 +- .../tests/usingStatement.ts | 2 +- .../tests/whileStatement.ts | 2 +- .../{jest.config.ts => jest.config.mjs} | 11 +- test/runIntegrationTests.ts | 4 +- test/tasks/bundleAudit.test.js | 27 + .../tasks/{jest.config.ts => jest.config.mjs} | 11 +- test/tasks/versionHelper.test.ts | 2 +- .../integrationTests/index.ts | 6 +- .../integrationTests/jest.config.mjs} | 13 +- .../untrustedWorkspace.integration.test.ts | 2 +- test/vsCodeEnvironment.ts | 2 +- test/vsCodeFramework.ts | 1 + test/vsCodeUnitFramework.ts | 10 + test/vscodeLauncher.ts | 2 +- tsconfig.jest.json | 7 + tsconfig.json | 23 +- wallaby.js | 36 +- 419 files changed, 2814 insertions(+), 2161 deletions(-) create mode 100644 baseJestConfig.mjs delete mode 100644 baseJestConfig.ts delete mode 100644 esbuild.js create mode 100644 esbuild.mjs rename jest.config.ts => jest.config.mjs (83%) create mode 100644 tasks/compilation/bundleAudit.mjs create mode 100644 test/jestProjectNames.d.mts create mode 100644 test/jestProjectNames.mjs create mode 100644 test/lsptoolshost/artifactTests/extensionBundle.test.ts rename test/lsptoolshost/artifactTests/{jest.config.ts => jest.config.mjs} (75%) rename test/{untrustedWorkspace/integrationTests/jest.config.ts => lsptoolshost/integrationTests/jest.config.mjs} (67%) rename test/lsptoolshost/unitTests/{jest.config.ts => jest.config.mjs} (78%) rename test/omnisharp/omnisharpIntegrationTests/{jest.config.ts => jest.config.mjs} (67%) rename test/omnisharp/omnisharpUnitTests/{jest.config.ts => jest.config.mjs} (77%) rename test/{lsptoolshost/integrationTests/jest.config.ts => razor/razorIntegrationTests/jest.config.mjs} (67%) rename test/razor/razorTests/{jest.config.ts => jest.config.mjs} (77%) create mode 100644 test/tasks/bundleAudit.test.js rename test/tasks/{jest.config.ts => jest.config.mjs} (71%) rename test/{razor/razorIntegrationTests/jest.config.ts => untrustedWorkspace/integrationTests/jest.config.mjs} (67%) create mode 100644 test/vsCodeUnitFramework.ts create mode 100644 tsconfig.jest.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 6b21f9497a..05202901da 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "runtimeExecutable": "${execPath}", "args": ["--extensionDevelopmentPath=${workspaceRoot}"], "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}"], "preLaunchTask": "packageDev" }, { @@ -24,7 +24,7 @@ "csharp-test-profile", "${workspaceRoot}/test/untrustedWorkspace/integrationTests/testAssets/empty/.vscode/empty.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/untrustedWorkspace/integrationTests", + "--extensionTestsPath=${workspaceRoot}/out/test/untrustedWorkspace/integrationTests/index.js", "--log", "ms-dotnettools.csharp:trace" ], @@ -33,7 +33,7 @@ }, "sourceMaps": true, "outFiles": [ - "${workspaceRoot}/dist/*.js", + "${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js" ], "resolveSourceMapLocations": [ @@ -56,7 +56,7 @@ "csharp-test-profile", "${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/slnWithCsproj.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests", + "--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests/index.js", "--log", "ms-dotnettools.csharp:trace" ], @@ -66,7 +66,7 @@ "RoslynWaiterEnabled": "true" }, "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js"], "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "preLaunchTask": "packageDev", "internalConsoleOptions": "openOnSessionStart" @@ -84,7 +84,7 @@ "csharp-test-profile", "${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/devkit_slnWithCsproj.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests", + "--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests/index.js", "--log", "ms-dotnettools.csharp:trace" ], @@ -94,7 +94,7 @@ "RoslynWaiterEnabled": "true" }, "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js"], "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "preLaunchTask": "packageDev", "internalConsoleOptions": "openOnSessionStart" @@ -112,7 +112,7 @@ "csharp-test-profile", "${workspaceRoot}/test/razor/razorIntegrationTests/testAssets/RazorApp/.vscode/RazorApp.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/razor/razorIntegrationTests", + "--extensionTestsPath=${workspaceRoot}/out/test/razor/razorIntegrationTests/index.js", "--log", "ms-dotnettools.csharp:trace" ], @@ -121,7 +121,7 @@ "TEST_FILE_FILTER": "${file}" }, "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js"], "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "preLaunchTask": "packageDev", "internalConsoleOptions": "openOnSessionStart" @@ -139,7 +139,7 @@ "csharp-test-profile", "${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_${input:omnisharpAssetName}.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests" + "--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests/index.js" ], "env": { "CODE_EXTENSIONS_PATH": "${workspaceRoot}", @@ -147,7 +147,7 @@ "TEST_FILE_FILTER": "${file}" }, "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js"], "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "preLaunchTask": "packageDev" }, @@ -164,7 +164,7 @@ "csharp-test-profile", "${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_lsp_${input:omnisharpAssetName}.code-workspace", "--extensionDevelopmentPath=${workspaceRoot}", - "--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests" + "--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests/index.js" ], "env": { "CODE_EXTENSIONS_PATH": "${workspaceRoot}", @@ -172,7 +172,7 @@ "TEST_FILE_FILTER": "${file}" }, "sourceMaps": true, - "outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"], + "outFiles": ["${workspaceRoot}/dist/*.{js,mjs}", "${workspaceRoot}/out/test/**/*.js"], "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "preLaunchTask": "packageDev" }, @@ -181,8 +181,8 @@ "request": "launch", "name": "Debug task", "preLaunchTask": "build", - "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", - "args": ["tasks/${input:taskScript}"], + "runtimeArgs": ["--import", "tsx"], + "program": "${workspaceFolder}/tasks/${input:taskScript}", "cwd": "${workspaceFolder}" }, { @@ -190,8 +190,8 @@ "request": "launch", "name": "Update OmniSharp package dependencies", "preLaunchTask": "build", - "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", - "args": ["tasks/debugger/updatePackageDependencies.ts"], + "runtimeArgs": ["--import", "tsx"], + "program": "${workspaceFolder}/tasks/debugger/updatePackageDependencies.ts", "env": { "NEW_DEPS_ID": "OmniSharp", "NEW_DEPS_URLS": "https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-x64.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-x86.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-arm64.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-osx.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-win-x64.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-win-arm64.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-musl-x64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-musl-arm64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-x64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-linux-arm64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-osx-x64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-osx-arm64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-win-x64-net6.0.zip,https://roslynomnisharp.blob.core.windows.net/releases/1.39.14/omnisharp-win-arm64-net6.0.zip", @@ -205,8 +205,8 @@ "request": "launch", "name": "Update razor telemetry package dependencies", "preLaunchTask": "build", - "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", - "args": ["tasks/debugger/updatePackageDependencies.ts"], + "runtimeArgs": ["--import", "tsx"], + "program": "${workspaceFolder}/tasks/debugger/updatePackageDependencies.ts", "env": { "NEW_DEPS_URLS": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/704e369c5905f9ece819ebce77fb78d8/devkittelemetry-linux-arm64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/4049a66147717a53860bbc969bf32faa/devkittelemetry-linux-musl-arm64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/c75e84ff813be5c9833d96dc2066a364/devkittelemetry-linux-musl-x64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/f58cf629939f0df77d142be881f9e233/devkittelemetry-linux-x64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/1c912419ea45c8d95cfa28a8a04640dc/devkittelemetry-osx-arm64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/36545ba0998f1fc380e877e38b2f35f1/devkittelemetry-osx-x64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/0a32698e8ba1ab93489d79f34f8ae8d0/devkittelemetry-platformagnostic-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/4f16ff826fedd33ad80d265c5409588b/devkittelemetry-win-arm64-7.0.0-preview.24178.4.zip,https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/5a98d8f4e481dbb7ae3cdb3695b75c46/devkittelemetry-win-x64-7.0.0-preview.24178.4.zip", "NEW_DEPS_VERSION": "7.0.0-preview.24178.4", @@ -219,8 +219,8 @@ "request": "launch", "name": "Generate debugger options schema", "preLaunchTask": "build", - "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", - "args": ["tasks/debugger/generateOptionsSchema.ts"], + "runtimeArgs": ["--import", "tsx"], + "program": "${workspaceFolder}/tasks/debugger/generateOptionsSchema.ts", "cwd": "${workspaceFolder}" }, { @@ -228,8 +228,8 @@ "request": "launch", "name": "Razor Cohost integration tests", "preLaunchTask": "build", - "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", - "args": ["tasks/tests/testIntegrationRazorCohost.ts"], + "runtimeArgs": ["--import", "tsx"], + "program": "${workspaceFolder}/tasks/tests/testIntegrationRazorCohost.ts", "cwd": "${workspaceFolder}" } ], diff --git a/.vscodeignore b/.vscodeignore index b1a2737ee7..57e8717e36 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -49,7 +49,7 @@ package-lock.json tsconfig.json version.json wallaby.js -esbuild.js +esbuild.mjs !src/razor/language-configuration.json !src/razor/syntaxes/* diff --git a/__mocks__/vscode.ts b/__mocks__/vscode.ts index bdd05e7de5..04689a515d 100644 --- a/__mocks__/vscode.ts +++ b/__mocks__/vscode.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscodeAdapter from '../src/vscodeAdapter'; -import { getFakeVsCode } from '../test/fakes'; +import * as vscodeAdapter from '../src/vscodeAdapter.ts'; +import { getFakeVsCode } from '../test/fakes.ts'; // This module creates a manual mock for the vscode module for running in unit tests. // Jest will automatically pick this up as it is in the __mocks__ directory next to node_modules. @@ -12,4 +12,4 @@ import { getFakeVsCode } from '../test/fakes'; // We can consider switching to an actual jest mock (instead of this manual fake) once we entirely // remove the old test framework (mocha/chai). const vscode: vscodeAdapter.vscode = getFakeVsCode(); -module.exports = vscode; +export const { commands, languages, window, workspace, extensions, Uri, version, env, l10n } = vscode; diff --git a/baseJestConfig.mjs b/baseJestConfig.mjs new file mode 100644 index 0000000000..79be385071 --- /dev/null +++ b/baseJestConfig.mjs @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { fileURLToPath } from 'node:url'; +import { createDefaultEsmPreset, createDefaultPreset } from 'ts-jest'; + +const tsconfigPath = fileURLToPath(new URL('./tsconfig.json', import.meta.url)); +const jestTsconfigPath = fileURLToPath(new URL('./tsconfig.jest.json', import.meta.url)); +const commonProjectConfig = { + testEnvironment: 'node', + transformIgnorePatterns: ['/dist/.+\\.js'], +}; + +/** + * Defines a base project config that we can re-use across the project specific jest configs. + * We do this because jest generally does not inherit project configuration settings. + */ +/** @type {import('jest').Config} */ +export const baseProjectConfig = { + ...createDefaultEsmPreset({ tsconfig: tsconfigPath }), + ...commonProjectConfig, + moduleNameMapper: { + // TypeScript rewrites source .ts specifiers to .js before Jest resolves the source module. + '^(\\.{1,2}/.*)\\.js$': '$1', + }, +}; + +// VS Code's packaged extension host strips the Node flag required by Jest's VM-module ESM runtime. +export const baseIntegrationProjectConfig = { + ...createDefaultPreset({ tsconfig: jestTsconfigPath }), + ...commonProjectConfig, + moduleNameMapper: { + // TypeScript rewrites source .ts specifiers to .js before Jest resolves the source module. + '^(\\.{1,2}/.*)\\.js$': '$1', + }, +}; diff --git a/baseJestConfig.ts b/baseJestConfig.ts deleted file mode 100644 index 5b7935c769..0000000000 --- a/baseJestConfig.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; - -/** - * Defines a base project config that we can re-use across the project specific jest configs. - * We do this because jest generally does not inherit project configuration settings. - */ -export const baseProjectConfig: Config = { - preset: 'ts-jest', - testEnvironment: 'node', - transformIgnorePatterns: ['/dist/.+\\.js'], -}; diff --git a/esbuild.js b/esbuild.js deleted file mode 100644 index 54ff1c1803..0000000000 --- a/esbuild.js +++ /dev/null @@ -1,76 +0,0 @@ -const esbuild = require("esbuild"); -const fs = require('fs/promises'); - -const production = process.argv.includes('--production'); -const watch = process.argv.includes('--watch'); - -/** - * @type {import('esbuild').Plugin} - */ -const esbuildProblemMatcherPlugin = { - name: 'esbuild-problem-matcher', - - setup(build) { - build.onStart(() => { - console.log('[watch] build started'); - }); - build.onEnd((result) => { - result.errors.forEach(({ text, location }) => { - console.error(`✘ [ERROR] ${text}`); - console.error(` ${location.file}:${location.line}:${location.column}:`); - }); - console.log('[watch] build finished'); - }); - }, -}; - -/** - * Some VSCode libraries include UMD versions that are not esbuild compatible, and also have broken ESM packages. - * This plugin replaces the UMD imports with the ESM imports. - * See https://github.com/microsoft/vscode/issues/192144 - */ -const umdEsmLoaderPlugin = { - name: 'umdEsmLoaderPlugin', - - setup(build) { - build.onLoad({ filter: /(vscode-html-languageservice|jsonc-parser).*lib[\/\\]umd/ }, async (moduleArgs) => { - // replace the umd path with the esm path from the package. - const newPath = moduleArgs.path.replace(/(.*)lib([\/\\])umd(.*)/, '$1lib$2esm$3'); - const contents = await fs.readFile(newPath, 'utf8'); - return { contents: contents }; - }); - }, -}; - -async function main() { - const ctx = await esbuild.context({ - entryPoints: [ - 'src/main.ts' - ], - bundle: true, - format: 'cjs', - minify: production, - sourcemap: !production, - sourcesContent: false, - platform: 'node', - outfile: 'dist/extension.js', - external: ['vscode', 'applicationinsights-native-metrics', '@opentelemetry/tracing'], - logLevel: 'info', - plugins: [ - umdEsmLoaderPlugin, - /* add to the end of plugins array */ - esbuildProblemMatcherPlugin, - ], - }); - if (watch) { - await ctx.watch(); - } else { - await ctx.rebuild(); - await ctx.dispose(); - } -} - -main().catch(e => { - console.error(e); - process.exit(1); -}); \ No newline at end of file diff --git a/esbuild.mjs b/esbuild.mjs new file mode 100644 index 0000000000..b323017ea0 --- /dev/null +++ b/esbuild.mjs @@ -0,0 +1,129 @@ +import esbuild from 'esbuild'; +import fs from 'node:fs/promises'; +import path from 'node:path'; +import { auditBundle } from './tasks/compilation/bundleAudit.mjs'; + +const production = process.argv.includes('--production'); +const watch = process.argv.includes('--watch'); + +/** + * @type {import('esbuild').Plugin} + */ +const esbuildProblemMatcherPlugin = { + name: 'esbuild-problem-matcher', + + setup(build) { + build.onStart(() => { + console.log('[watch] build started'); + }); + build.onEnd((result) => { + result.errors.forEach(({ text, location }) => { + console.error(`✘ [ERROR] ${text}`); + console.error(` ${location.file}:${location.line}:${location.column}:`); + }); + console.log('[watch] build finished'); + }); + }, +}; + +/** + * Some VSCode libraries include UMD versions that are not esbuild compatible, and also have broken ESM packages. + * This plugin replaces the UMD imports with the ESM imports. + * See https://github.com/microsoft/vscode/issues/192144 + */ +const umdEsmLoaderPlugin = { + name: 'umdEsmLoaderPlugin', + + setup(build) { + build.onLoad({ filter: /(vscode-html-languageservice|jsonc-parser).*lib[\/\\]umd/ }, async (moduleArgs) => { + // replace the umd path with the esm path from the package. + const newPath = moduleArgs.path.replace(/(.*)lib([\/\\])umd(.*)/, '$1lib$2esm$3'); + const contents = await fs.readFile(newPath, 'utf8'); + return { contents: contents }; + }); + }, +}; + +/** + * The telemetry package advertises an ESM module but has no exports map, so esbuild's Node + * resolution otherwise selects its CommonJS main entry. + */ +const telemetryEsmLoaderPlugin = { + name: 'telemetryEsmLoaderPlugin', + + setup(build) { + build.onResolve({ filter: /^@vscode\/extension-telemetry$/ }, async () => { + const packageDirectory = path.resolve('node_modules/@vscode/extension-telemetry'); + const packageMetadata = JSON.parse( + await fs.readFile(path.join(packageDirectory, 'package.json'), 'utf8') + ); + if (typeof packageMetadata.module !== 'string') { + throw new Error('@vscode/extension-telemetry no longer declares an ESM module entry.'); + } + + return { path: path.resolve(packageDirectory, packageMetadata.module) }; + }); + }, +}; + +const bundleAuditPlugin = { + name: 'bundleAuditPlugin', + + setup(build) { + build.onEnd(async (result) => { + if (result.errors.length > 0) { + return; + } + + try { + await auditBundle(result.metafile, production); + } catch (error) { + return { + errors: [{ text: error instanceof Error ? error.message : String(error) }], + }; + } + }); + }, +}; + +async function main() { + const ctx = await esbuild.context({ + entryPoints: ['src/main.ts'], + bundle: true, + format: 'esm', + // Bundled CommonJS dependencies still require Node built-ins at runtime. The exact owners + // are enforced by bundleAuditPlugin so this compatibility bridge cannot grow unnoticed. + banner: { + js: [ + `import { createRequire } from 'node:module';`, + `const require = createRequire(import.meta.url);`, + ].join('\n'), + }, + metafile: true, + minify: production, + sourcemap: !production, + sourcesContent: false, + platform: 'node', + outfile: 'dist/extension.mjs', + external: ['vscode', 'applicationinsights-native-metrics', '@opentelemetry/tracing'], + logLevel: 'info', + plugins: [ + umdEsmLoaderPlugin, + telemetryEsmLoaderPlugin, + /* add to the end of plugins array */ + esbuildProblemMatcherPlugin, + bundleAuditPlugin, + ], + }); + if (watch) { + await ctx.watch(); + } else { + await ctx.rebuild(); + await ctx.dispose(); + } +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/eslint.config.mjs b/eslint.config.mjs index d5c3dfd9f1..f8d8073d55 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -23,7 +23,15 @@ const compatibleHeaderPlugin = fixupPluginRules({ export default defineConfig([ { - ignores: ['out/**', 'dist/**', 'wallaby.js', 'eslint.config.mjs', 'esbuild.js', '**/*.d.ts'], + ignores: [ + 'out/**', + 'dist/**', + '.vscode-test/**', + 'wallaby.js', + 'eslint.config.mjs', + 'esbuild.mjs', + '**/*.d.ts', + ], }, { files: ['**/*.ts'], diff --git a/jest.config.ts b/jest.config.mjs similarity index 83% rename from jest.config.ts rename to jest.config.mjs index 54ca228dea..a27f4be457 100644 --- a/jest.config.ts +++ b/jest.config.mjs @@ -2,19 +2,18 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; - -const config: Config = { +/** @type {import('jest').Config} */ +const config = { projects: [ - '/test/lsptoolshost/artifactTests/jest.config.ts', - '/test/lsptoolshost/integrationTests/jest.config.ts', - '/test/lsptoolshost/unitTests/jest.config.ts', - '/test/omnisharp/omnisharpIntegrationTests/jest.config.ts', - '/test/omnisharp/omnisharpUnitTests/jest.config.ts', - '/test/razor/razorIntegrationTests/jest.config.ts', - '/test/razor/razorTests/jest.config.ts', - '/test/untrustedWorkspace/integrationTests/jest.config.ts', - '/test/tasks/jest.config.ts', + '/test/lsptoolshost/artifactTests/jest.config.mjs', + '/test/lsptoolshost/integrationTests/jest.config.mjs', + '/test/lsptoolshost/unitTests/jest.config.mjs', + '/test/omnisharp/omnisharpIntegrationTests/jest.config.mjs', + '/test/omnisharp/omnisharpUnitTests/jest.config.mjs', + '/test/razor/razorIntegrationTests/jest.config.mjs', + '/test/razor/razorTests/jest.config.mjs', + '/test/untrustedWorkspace/integrationTests/jest.config.mjs', + '/test/tasks/jest.config.mjs', ], // Reporters are a global jest configuration property and cannot be set in the project jest config. // This configuration will create a 'junit.xml' file in the output directory, no matter which test project is running. diff --git a/msbuild/signing/signJs/signJs.proj b/msbuild/signing/signJs/signJs.proj index c2cd518069..502447df9a 100644 --- a/msbuild/signing/signJs/signJs.proj +++ b/msbuild/signing/signJs/signJs.proj @@ -21,5 +21,8 @@ MicrosoftSHA2 + + MicrosoftSHA2 + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 045c1c0871..481b41c06b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@github/copilot-language-server": "1.290.0", "@microsoft/servicehub-framework": "4.2.99-beta", - "@vscode/extension-telemetry": "^0.9.0", + "@vscode/extension-telemetry": "^1.5.2", "@vscode/js-debug-browsers": "^1.1.0", "archiver": "5.3.0", "execa": "4.0.0", @@ -58,9 +58,9 @@ "nerdbank-gitversioning": "^3.6.79-alpha", "prettier": "3.9.6", "tmp": "0.2.7", - "ts-jest": "^29.1.1", - "ts-node": "9.1.1", - "typescript": "5.6.2", + "ts-jest": "^29.4.1", + "tsx": "^4.20.6", + "typescript": "5.7.3", "typescript-eslint": "^8.65.0", "vscode-oniguruma": "^1.6.1", "vscode-textmate": "^6.0.0" @@ -2143,104 +2143,110 @@ } }, "node_modules/@microsoft/1ds-core-js": { - "version": "4.0.4", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-core-js/-/1ds-core-js-4.0.4.tgz", - "integrity": "sha512-QOCE0fTDOMNptB791chnVlfnRvb7faDQTaUIO3DfPBkvjF3PUAJJCsqJKWitw7nwVn8L82TFx+K22UifIr0zkg==", + "version": "4.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-core-js/-/1ds-core-js-4.4.3.tgz", + "integrity": "sha1-4uVAxnLi3V8G9H9iYTirVg5A1z4=", + "license": "MIT", "dependencies": { - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "node_modules/@microsoft/1ds-post-js": { - "version": "4.0.4", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-post-js/-/1ds-post-js-4.0.4.tgz", - "integrity": "sha512-jlPNL16iRXzmXfriGXv0INzrAl3AeDx+eCORjq8ZjRhIvohB6Q88m5E28nL6Drf5hJWE2ehoW4q8Vh612VoEHw==", + "version": "4.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-post-js/-/1ds-post-js-4.4.3.tgz", + "integrity": "sha1-/3LD505NjEkQ3+q0DamOU0H9SHM=", + "license": "MIT", "dependencies": { - "@microsoft/1ds-core-js": "4.0.4", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "node_modules/@microsoft/applicationinsights-channel-js": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.0.5.tgz", - "integrity": "sha512-KfTYY0uZmrQgrz8ErBh1q08eiYfzjUIVzJZHETgEkqv3l2RTndQgpmywDbVNf9wVTB7Mp89ZrFeCciVJFf5geg==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.4.3.tgz", + "integrity": "sha1-lv6aE/XGMzH2jAP+Yfyo0nP87X8=", + "license": "MIT", "dependencies": { - "@microsoft/applicationinsights-common": "3.0.5", - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" }, "peerDependencies": { - "tslib": "*" + "tslib": ">= 1.0.0" } }, "node_modules/@microsoft/applicationinsights-common": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-common/-/applicationinsights-common-3.0.5.tgz", - "integrity": "sha512-ahph1fMqyLcZ1twzDKMzpHRgR9zEIyqNhMQxDgQ45ieVD641bZiYVwSlbntSXhGCtr5G5HE02zlEzwSxbx95ng==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-common/-/applicationinsights-common-3.4.3.tgz", + "integrity": "sha1-gg7ByONwX7NQuJdFMc6lO/+KhWs=", + "license": "MIT", "dependencies": { - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" }, "peerDependencies": { - "tslib": "*" + "tslib": ">= 1.0.0" } }, "node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.5.tgz", - "integrity": "sha512-/x+tkxsVALNWSvwGMyaLwFPdD3p156Pef9WHftXrzrKkJ+685nhrwm9MqHIyEHHpSW09ElOdpJ3rfFVqpKRQyQ==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.4.3.tgz", + "integrity": "sha1-2tJKf5V4gfubq5ZDh2r6Wws54Lo=", + "license": "MIT", "dependencies": { "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" }, "peerDependencies": { - "tslib": "*" + "tslib": ">= 1.0.0" } }, "node_modules/@microsoft/applicationinsights-shims": { "version": "3.0.1", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", - "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", + "integrity": "sha1-OGW3Os6EBbnEYYzFxXHy/jh28G8=", + "license": "MIT", "dependencies": { "@nevware21/ts-utils": ">= 0.9.4 < 2.x" } }, "node_modules/@microsoft/applicationinsights-web-basic": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.0.5.tgz", - "integrity": "sha512-ps4wjmF9X80hakYxywlzBdSlDjfToZrz/cHKA/9yarrW3mbZGqjjksNoaFxtyU5BK4lhOvrgu+2+QcDHeEEnOA==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.4.3.tgz", + "integrity": "sha1-Jq1prhzQVMjUMHCQAeJVKTb6dU0=", + "license": "MIT", "dependencies": { - "@microsoft/applicationinsights-channel-js": "3.0.5", - "@microsoft/applicationinsights-common": "3.0.5", - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-channel-js": "3.4.3", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" }, "peerDependencies": { - "tslib": "*" + "tslib": ">= 1.0.0" } }, "node_modules/@microsoft/dynamicproto-js": { - "version": "2.0.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.2.tgz", - "integrity": "sha512-MB8trWaFREpmb037k/d0bB7T2BP7Ai24w1e1tbz3ASLB0/lwphsq3Nq8S9I5AsI5vs4zAQT+SB5nC5/dLYTiOg==", + "version": "2.0.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.5.tgz", + "integrity": "sha1-9NCLCwbFcNaerXzSq69BQCUITGc=", + "license": "MIT", "dependencies": { - "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "node_modules/@microsoft/servicehub-framework": { @@ -2270,17 +2276,18 @@ } }, "node_modules/@nevware21/ts-async": { - "version": "0.3.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-async/-/ts-async-0.3.0.tgz", - "integrity": "sha512-ZUcgUH12LN/F6nzN0cYd0F/rJaMLmXr0EHVTyYfaYmK55bdwE4338uue4UiVoRqHVqNW4KDUrJc49iGogHKeWA==", + "version": "0.5.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-async/-/ts-async-0.5.5.tgz", + "integrity": "sha1-UJZI48PDqpq2E8AMce7k/pvYo8M=", + "license": "MIT", "dependencies": { - "@nevware21/ts-utils": ">= 0.10.0 < 2.x" + "@nevware21/ts-utils": ">= 0.12.2 < 2.x" } }, "node_modules/@nevware21/ts-utils": { - "version": "0.14.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-utils/-/ts-utils-0.14.0.tgz", - "integrity": "sha1-nmB0zijwsbq3v9rNGndgsrpzaI0=", + "version": "0.16.0", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-utils/-/ts-utils-0.16.0.tgz", + "integrity": "sha1-5KOcjrEi54ESMVx5oAkWI4t/PEw=", "funding": [ { "type": "github", @@ -3475,13 +3482,16 @@ "license": "0BSD" }, "node_modules/@vscode/extension-telemetry": { - "version": "0.9.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/extension-telemetry/-/extension-telemetry-0.9.0.tgz", - "integrity": "sha512-37RxGHXrs3GoXPgCUKQhghEu0gxs8j27RLjQwwtSf4WhPdJKz8UrqMYzpsXlliQ05zURYmtdGZst9C6+hfWXaQ==", + "version": "1.5.2", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/extension-telemetry/-/extension-telemetry-1.5.2.tgz", + "integrity": "sha1-KsL23kVWWOJgGA/l6r9zvNbaUUY=", + "license": "MIT", "dependencies": { - "@microsoft/1ds-core-js": "^4.0.3", - "@microsoft/1ds-post-js": "^4.0.3", - "@microsoft/applicationinsights-web-basic": "^3.0.4" + "@microsoft/1ds-core-js": "^4.4.1", + "@microsoft/1ds-post-js": "^4.4.1", + "@microsoft/applicationinsights-common": "^3.4.1", + "@microsoft/applicationinsights-core-js": "^3.4.1", + "@microsoft/applicationinsights-web-basic": "^3.4.1" }, "engines": { "vscode": "^1.75.0" @@ -4187,7 +4197,9 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/arg/-/arg-4.1.3.tgz", "integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/argparse": { "version": "1.0.10", @@ -5086,7 +5098,9 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/create-require/-/create-require-1.1.1.tgz", "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/cross-spawn": { "version": "7.0.6", @@ -5335,6 +5349,8 @@ "integrity": "sha1-em2/2jJfJfB1F+m1GPiXwIMy4H0=", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "engines": { "node": ">=0.3.1" } @@ -6341,11 +6357,11 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha1-ysZAd4XQNnWipeGlMFxpezR9kNY=", "dev": true, - "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -6606,6 +6622,28 @@ "integrity": "sha1-QYPk6L8Iu24Fu7L30uDI9xLKQOM=", "license": "ISC" }, + "node_modules/handlebars": { + "version": "4.7.9", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/handlebars/-/handlebars-4.7.9.tgz", + "integrity": "sha1-bxOQgqtY3E5aDlHv59ta6JDVag8=", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/has/-/has-1.0.3.tgz", @@ -8668,8 +8706,7 @@ "version": "1.2.6", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true, - "optional": true + "dev": true }, "node_modules/minipass": { "version": "7.1.2", @@ -8775,6 +8812,13 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8=", + "dev": true, + "license": "MIT" + }, "node_modules/nerdbank-gitversioning": { "version": "3.6.79-alpha", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/nerdbank-gitversioning/-/nerdbank-gitversioning-3.6.79-alpha.tgz", @@ -10519,6 +10563,8 @@ "integrity": "sha1-BP58f54e0tZiIzwoyys1ufY/bk8=", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -11078,37 +11124,44 @@ } }, "node_modules/ts-jest": { - "version": "29.1.1", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "version": "29.4.12", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-jest/-/ts-jest-29.4.12.tgz", + "integrity": "sha1-w0zZHwLTZOkobSwBaEMxX9Dv/3Y=", "dev": true, + "license": "MIT", "dependencies": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", + "bs-logger": "^0.2.6", + "fast-json-stable-stringify": "^2.1.0", + "handlebars": "^4.7.9", "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.8.5", + "type-fest": "^4.41.0", + "yargs-parser": "^21.1.1" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", - "@jest/types": "^29.0.0", - "babel-jest": "^29.0.0", - "jest": "^29.0.0", - "typescript": ">=4.3 <6" + "@jest/transform": "^29.0.0 || ^30.0.0", + "@jest/types": "^29.0.0 || ^30.0.0", + "babel-jest": "^29.0.0 || ^30.0.0", + "jest": "^29.0.0 || ^30.0.0", + "jest-util": "^29.0.0 || ^30.0.0", + "typescript": ">=4.3 <7" }, "peerDependenciesMeta": { "@babel/core": { "optional": true }, + "@jest/transform": { + "optional": true + }, "@jest/types": { "optional": true }, @@ -11117,15 +11170,33 @@ }, "esbuild": { "optional": true + }, + "jest-util": { + "optional": true } } }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/semver/-/semver-7.8.5.tgz", + "integrity": "sha1-ObZGA33VDBT7RR5+TKxY7YuGP2k=", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ts-node": { "version": "9.1.1", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-node/-/ts-node-9.1.1.tgz", "integrity": "sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "arg": "^4.1.0", "create-require": "^1.1.0", @@ -11152,6 +11223,25 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tslib/-/tslib-1.13.0.tgz", "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" }, + "node_modules/tsx": { + "version": "4.23.1", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tsx/-/tsx-4.23.1.tgz", + "integrity": "sha1-FwPaAC7kQyuaBTkXQx+RRi/KI1s=", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tunnel/-/tunnel-0.0.6.tgz", @@ -11236,9 +11326,9 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha1-0d5ntr73fEGCP4It+PCzvP9gpaA=", + "version": "5.7.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha1-kZtEp9u4WDqbhW0WK+JKVL+ABz4=", "dev": true, "license": "Apache-2.0", "bin": { @@ -11280,6 +11370,20 @@ "dev": true, "license": "MIT" }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha1-gjFem7xvKyWIiFis0f/4RBA1t38=", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/uid-safe": { "version": "2.1.5", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/uid-safe/-/uid-safe-2.1.5.tgz", @@ -11629,6 +11733,13 @@ "node": ">=0.10.0" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true, + "license": "MIT" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -11795,6 +11906,8 @@ "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -13233,92 +13346,90 @@ } }, "@microsoft/1ds-core-js": { - "version": "4.0.4", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-core-js/-/1ds-core-js-4.0.4.tgz", - "integrity": "sha512-QOCE0fTDOMNptB791chnVlfnRvb7faDQTaUIO3DfPBkvjF3PUAJJCsqJKWitw7nwVn8L82TFx+K22UifIr0zkg==", + "version": "4.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-core-js/-/1ds-core-js-4.4.3.tgz", + "integrity": "sha1-4uVAxnLi3V8G9H9iYTirVg5A1z4=", "requires": { - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/1ds-post-js": { - "version": "4.0.4", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-post-js/-/1ds-post-js-4.0.4.tgz", - "integrity": "sha512-jlPNL16iRXzmXfriGXv0INzrAl3AeDx+eCORjq8ZjRhIvohB6Q88m5E28nL6Drf5hJWE2ehoW4q8Vh612VoEHw==", + "version": "4.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/1ds-post-js/-/1ds-post-js-4.4.3.tgz", + "integrity": "sha1-/3LD505NjEkQ3+q0DamOU0H9SHM=", "requires": { - "@microsoft/1ds-core-js": "4.0.4", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/applicationinsights-channel-js": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.0.5.tgz", - "integrity": "sha512-KfTYY0uZmrQgrz8ErBh1q08eiYfzjUIVzJZHETgEkqv3l2RTndQgpmywDbVNf9wVTB7Mp89ZrFeCciVJFf5geg==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.4.3.tgz", + "integrity": "sha1-lv6aE/XGMzH2jAP+Yfyo0nP87X8=", "requires": { - "@microsoft/applicationinsights-common": "3.0.5", - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/applicationinsights-common": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-common/-/applicationinsights-common-3.0.5.tgz", - "integrity": "sha512-ahph1fMqyLcZ1twzDKMzpHRgR9zEIyqNhMQxDgQ45ieVD641bZiYVwSlbntSXhGCtr5G5HE02zlEzwSxbx95ng==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-common/-/applicationinsights-common-3.4.3.tgz", + "integrity": "sha1-gg7ByONwX7NQuJdFMc6lO/+KhWs=", "requires": { - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/applicationinsights-core-js": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.5.tgz", - "integrity": "sha512-/x+tkxsVALNWSvwGMyaLwFPdD3p156Pef9WHftXrzrKkJ+685nhrwm9MqHIyEHHpSW09ElOdpJ3rfFVqpKRQyQ==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.4.3.tgz", + "integrity": "sha1-2tJKf5V4gfubq5ZDh2r6Wws54Lo=", "requires": { "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/applicationinsights-shims": { "version": "3.0.1", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", - "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", + "integrity": "sha1-OGW3Os6EBbnEYYzFxXHy/jh28G8=", "requires": { "@nevware21/ts-utils": ">= 0.9.4 < 2.x" } }, "@microsoft/applicationinsights-web-basic": { - "version": "3.0.5", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.0.5.tgz", - "integrity": "sha512-ps4wjmF9X80hakYxywlzBdSlDjfToZrz/cHKA/9yarrW3mbZGqjjksNoaFxtyU5BK4lhOvrgu+2+QcDHeEEnOA==", + "version": "3.4.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.4.3.tgz", + "integrity": "sha1-Jq1prhzQVMjUMHCQAeJVKTb6dU0=", "requires": { - "@microsoft/applicationinsights-channel-js": "3.0.5", - "@microsoft/applicationinsights-common": "3.0.5", - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-channel-js": "3.4.3", + "@microsoft/applicationinsights-core-js": "3.4.3", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.5 < 0.6.0", + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/dynamicproto-js": { - "version": "2.0.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.2.tgz", - "integrity": "sha512-MB8trWaFREpmb037k/d0bB7T2BP7Ai24w1e1tbz3ASLB0/lwphsq3Nq8S9I5AsI5vs4zAQT+SB5nC5/dLYTiOg==", + "version": "2.0.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.5.tgz", + "integrity": "sha1-9NCLCwbFcNaerXzSq69BQCUITGc=", "requires": { - "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + "@nevware21/ts-utils": ">= 0.14.0 < 2.x" } }, "@microsoft/servicehub-framework": { @@ -13346,17 +13457,17 @@ } }, "@nevware21/ts-async": { - "version": "0.3.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-async/-/ts-async-0.3.0.tgz", - "integrity": "sha512-ZUcgUH12LN/F6nzN0cYd0F/rJaMLmXr0EHVTyYfaYmK55bdwE4338uue4UiVoRqHVqNW4KDUrJc49iGogHKeWA==", + "version": "0.5.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-async/-/ts-async-0.5.5.tgz", + "integrity": "sha1-UJZI48PDqpq2E8AMce7k/pvYo8M=", "requires": { - "@nevware21/ts-utils": ">= 0.10.0 < 2.x" + "@nevware21/ts-utils": ">= 0.12.2 < 2.x" } }, "@nevware21/ts-utils": { - "version": "0.14.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-utils/-/ts-utils-0.14.0.tgz", - "integrity": "sha1-nmB0zijwsbq3v9rNGndgsrpzaI0=" + "version": "0.16.0", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@nevware21/ts-utils/-/ts-utils-0.16.0.tgz", + "integrity": "sha1-5KOcjrEi54ESMVx5oAkWI4t/PEw=" }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -14262,13 +14373,15 @@ } }, "@vscode/extension-telemetry": { - "version": "0.9.0", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/extension-telemetry/-/extension-telemetry-0.9.0.tgz", - "integrity": "sha512-37RxGHXrs3GoXPgCUKQhghEu0gxs8j27RLjQwwtSf4WhPdJKz8UrqMYzpsXlliQ05zURYmtdGZst9C6+hfWXaQ==", + "version": "1.5.2", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/extension-telemetry/-/extension-telemetry-1.5.2.tgz", + "integrity": "sha1-KsL23kVWWOJgGA/l6r9zvNbaUUY=", "requires": { - "@microsoft/1ds-core-js": "^4.0.3", - "@microsoft/1ds-post-js": "^4.0.3", - "@microsoft/applicationinsights-web-basic": "^3.0.4" + "@microsoft/1ds-core-js": "^4.4.1", + "@microsoft/1ds-post-js": "^4.4.1", + "@microsoft/applicationinsights-common": "^3.4.1", + "@microsoft/applicationinsights-core-js": "^3.4.1", + "@microsoft/applicationinsights-web-basic": "^3.4.1" } }, "@vscode/js-debug-browsers": { @@ -14757,7 +14870,9 @@ "version": "4.1.3", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/arg/-/arg-4.1.3.tgz", "integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "argparse": { "version": "1.0.10", @@ -15410,7 +15525,9 @@ "version": "1.1.1", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/create-require/-/create-require-1.1.1.tgz", "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "cross-spawn": { "version": "7.0.6", @@ -15567,7 +15684,9 @@ "version": "4.0.4", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/diff/-/diff-4.0.4.tgz", "integrity": "sha1-em2/2jJfJfB1F+m1GPiXwIMy4H0=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "diff-sequences": { "version": "29.6.3", @@ -16257,9 +16376,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.3.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha1-ysZAd4XQNnWipeGlMFxpezR9kNY=", "dev": true, "optional": true }, @@ -16421,6 +16540,19 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha1-QYPk6L8Iu24Fu7L30uDI9xLKQOM=" }, + "handlebars": { + "version": "4.7.9", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/handlebars/-/handlebars-4.7.9.tgz", + "integrity": "sha1-bxOQgqtY3E5aDlHv59ta6JDVag8=", + "dev": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/has/-/has-1.0.3.tgz", @@ -17920,8 +18052,7 @@ "version": "1.2.6", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "7.1.2", @@ -18003,6 +18134,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8=", + "dev": true + }, "nerdbank-gitversioning": { "version": "3.6.79-alpha", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/nerdbank-gitversioning/-/nerdbank-gitversioning-3.6.79-alpha.tgz", @@ -19191,6 +19328,8 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha1-BP58f54e0tZiIzwoyys1ufY/bk8=", "dev": true, + "optional": true, + "peer": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -19588,19 +19727,28 @@ "requires": {} }, "ts-jest": { - "version": "29.1.1", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "version": "29.4.12", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-jest/-/ts-jest-29.4.12.tgz", + "integrity": "sha1-w0zZHwLTZOkobSwBaEMxX9Dv/3Y=", "dev": true, "requires": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", + "bs-logger": "^0.2.6", + "fast-json-stable-stringify": "^2.1.0", + "handlebars": "^4.7.9", "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.8.5", + "type-fest": "^4.41.0", + "yargs-parser": "^21.1.1" + }, + "dependencies": { + "semver": { + "version": "7.8.5", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/semver/-/semver-7.8.5.tgz", + "integrity": "sha1-ObZGA33VDBT7RR5+TKxY7YuGP2k=", + "dev": true + } } }, "ts-node": { @@ -19608,6 +19756,8 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ts-node/-/ts-node-9.1.1.tgz", "integrity": "sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=", "dev": true, + "optional": true, + "peer": true, "requires": { "arg": "^4.1.0", "create-require": "^1.1.0", @@ -19622,6 +19772,16 @@ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tslib/-/tslib-1.13.0.tgz", "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" }, + "tsx": { + "version": "4.23.1", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tsx/-/tsx-4.23.1.tgz", + "integrity": "sha1-FwPaAC7kQyuaBTkXQx+RRi/KI1s=", + "dev": true, + "requires": { + "esbuild": "~0.28.0", + "fsevents": "~2.3.3" + } + }, "tunnel": { "version": "0.0.6", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/tunnel/-/tunnel-0.0.6.tgz", @@ -19681,9 +19841,9 @@ } }, "typescript": { - "version": "5.6.2", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha1-0d5ntr73fEGCP4It+PCzvP9gpaA=", + "version": "5.7.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha1-kZtEp9u4WDqbhW0WK+JKVL+ABz4=", "dev": true }, "typescript-eslint": { @@ -19704,6 +19864,13 @@ "integrity": "sha1-+NP30OxMPeo1p+PI76TLi0XJ5+4=", "dev": true }, + "uglify-js": { + "version": "3.19.3", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha1-gjFem7xvKyWIiFis0f/4RBA1t38=", + "dev": true, + "optional": true + }, "uid-safe": { "version": "2.1.5", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/uid-safe/-/uid-safe-2.1.5.tgz", @@ -19948,6 +20115,12 @@ "integrity": "sha1-0sRcbdT7zmIaZvE2y+Mor9BBCzQ=", "dev": true }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -20061,7 +20234,9 @@ "version": "3.1.1", "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/yn/-/yn-3.1.1.tgz", "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index c1fcd5e961..8fd4f7a22b 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "csharp", "publisher": "ms-dotnettools", "version": "42.42.42-placeholder", + "type": "module", "description": "Base language support for C#", "displayName": "C#", "author": "Microsoft Corporation", @@ -47,7 +48,7 @@ "xamlTools": "18.10.12014.341", "testDiscovery": "9.9.223-ge3811b" }, - "main": "./dist/extension", + "main": "./dist/extension.mjs", "l10n": "./l10n", "brokeredServices": [ { @@ -67,43 +68,43 @@ "compile": "tsc -p tsconfig.json && npm run lint && npm run l10nDevGenerateLocalizationBundle && npm run compile:razorTextMate", "compileDev": "tsc -p tsconfig.json && npm run lint && npm run l10nDevGenerateLocalizationBundle && npm run compile:razorTextMate", "compile:razorTextMate": "npx js-yaml src/razor/syntaxes/aspnetcorerazor.tmLanguage.yml > src/razor/syntaxes/aspnetcorerazor.tmLanguage.json", - "createTags": "npx ts-node tasks/tags/createTags.ts", - "fixLocUrls": "npx ts-node tasks/debugger/fixLocUrls.ts", - "generateOptionsSchema": "npx ts-node tasks/debugger/generateOptionsSchema.ts", - "incrementVersion": "npx ts-node tasks/snap/incrementVersion.ts", - "installDependencies": "npx ts-node tasks/packaging/installDependencies.ts", - "installDependenciesClean": "npx ts-node tasks/packaging/installDependenciesClean.ts", - "installSignPlugin": "npx ts-node tasks/signing/installSignPlugin.ts", + "createTags": "npx tsx tasks/tags/createTags.ts", + "fixLocUrls": "npx tsx tasks/debugger/fixLocUrls.ts", + "generateOptionsSchema": "npx tsx tasks/debugger/generateOptionsSchema.ts", + "incrementVersion": "npx tsx tasks/snap/incrementVersion.ts", + "installDependencies": "npx tsx tasks/packaging/installDependencies.ts", + "installDependenciesClean": "npx tsx tasks/packaging/installDependenciesClean.ts", + "installSignPlugin": "npx tsx tasks/signing/installSignPlugin.ts", "l10nDevGenerateLocalizationBundle": "npx @vscode/l10n-dev export --outDir ./l10n ./src", "l10nDevGenerateXlf": "npx @vscode/l10n-dev generate-xlf ./package.nls.json ./l10n/bundle.l10n.json --outFile ./loc/vscode-csharp.xlf", "l10nDevImportXlf": "npx @vscode/l10n-dev import-xlf ./loc/vscode-csharp.*.xlf --outDir ./l10n && move l10n\\package.nls.*.json .", "lint": "npx eslint ./", - "omnisharptest": "npm run packageDev && npx ts-node tasks/tests/omnisharptest.ts", - "omnisharptest:integration": "npm run packageDev && npx ts-node tasks/tests/omnisharptestIntegration.ts", - "omnisharptest:unit": "npm run compileDev && npx ts-node tasks/tests/omnisharptestUnit.ts", - "package": "npm run compile && npm run signJs && node esbuild.js --production", - "packageDev": "npm run compileDev && node esbuild.js", + "omnisharptest": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/omnisharptest.ts", + "omnisharptest:integration": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/omnisharptestIntegration.ts", + "omnisharptest:unit": "npm run compileDev && node --experimental-vm-modules --import tsx tasks/tests/omnisharptestUnit.ts", + "package": "npm run compile && node esbuild.mjs --production && npm run signJs", + "packageDev": "npm run compileDev && node esbuild.mjs", "prepare": "npm run installDependencies", - "profiling": "npm run package && npx ts-node tasks/profiling/profiling.ts", - "publishLocalizationContent": "npx ts-node tasks/localization/publishLocalizationContent.ts", - "publishRoslynCopilot": "npx ts-node tasks/components/publishRoslynCopilot.ts", - "signJs": "npx ts-node tasks/signing/signJs.ts", - "signVsix": "npx ts-node tasks/signing/signVsix.ts", + "profiling": "npm run package && npx tsx tasks/profiling/profiling.ts", + "publishLocalizationContent": "npx tsx tasks/localization/publishLocalizationContent.ts", + "publishRoslynCopilot": "npx tsx tasks/components/publishRoslynCopilot.ts", + "signJs": "npx tsx tasks/signing/signJs.ts", + "signVsix": "npx tsx tasks/signing/signVsix.ts", "test": "npm run test:unit && npm run test:artifacts", - "test:artifacts": "npm run compileDev && npx ts-node tasks/tests/testArtifacts.ts", + "test:artifacts": "npm run compileDev && node --experimental-vm-modules --import tsx tasks/tests/testArtifacts.ts", "test:integration": "npm run test:integration:csharp && npm run test:integration:devkit && npm run test:integration:razor:cohost && npm run test:integration:untrusted", - "test:integration:csharp": "npm run packageDev && npx ts-node tasks/tests/testIntegrationCsharp.ts", - "test:integration:devkit": "npm run packageDev && npx ts-node tasks/tests/testIntegrationDevkit.ts", - "test:integration:razor:cohost": "npm run packageDev && npx ts-node tasks/tests/testIntegrationRazorCohost.ts", - "test:integration:untrusted": "npm run packageDev && npx ts-node tasks/tests/testIntegrationUntrusted.ts", - "test:unit": "npm run compileDev && npx ts-node tasks/tests/testUnit.ts", - "updateChangelog": "npx ts-node tasks/snap/updateChangelog.ts", - "updatePackageDependencies": "npx ts-node tasks/debugger/updatePackageDependencies.ts", - "updateRoslynVersion": "npx ts-node tasks/packaging/updateRoslynVersion.ts", - "updateVersionForStableRelease": "npx ts-node tasks/snap/updateVersionForStableRelease.ts", - "verifyVsix": "npx ts-node tasks/signing/verifyVsix.ts", + "test:integration:csharp": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/testIntegrationCsharp.ts", + "test:integration:devkit": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/testIntegrationDevkit.ts", + "test:integration:razor:cohost": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/testIntegrationRazorCohost.ts", + "test:integration:untrusted": "npm run packageDev && node --experimental-vm-modules --import tsx tasks/tests/testIntegrationUntrusted.ts", + "test:unit": "npm run compileDev && node --experimental-vm-modules --import tsx tasks/tests/testUnit.ts", + "updateChangelog": "npx tsx tasks/snap/updateChangelog.ts", + "updatePackageDependencies": "npx tsx tasks/debugger/updatePackageDependencies.ts", + "updateRoslynVersion": "npx tsx tasks/packaging/updateRoslynVersion.ts", + "updateVersionForStableRelease": "npx tsx tasks/snap/updateVersionForStableRelease.ts", + "verifyVsix": "npx tsx tasks/signing/verifyVsix.ts", "vscode:prepublish": "npm run package", - "vsix:release:package": "npx ts-node tasks/packaging/vsixReleasePackage.ts" + "vsix:release:package": "npx tsx tasks/packaging/vsixReleasePackage.ts" }, "extensionDependencies": [ "ms-dotnettools.vscode-dotnet-runtime" @@ -111,7 +112,7 @@ "dependencies": { "@github/copilot-language-server": "1.290.0", "@microsoft/servicehub-framework": "4.2.99-beta", - "@vscode/extension-telemetry": "^0.9.0", + "@vscode/extension-telemetry": "^1.5.2", "@vscode/js-debug-browsers": "^1.1.0", "archiver": "5.3.0", "execa": "4.0.0", @@ -158,9 +159,9 @@ "nerdbank-gitversioning": "^3.6.79-alpha", "prettier": "3.9.6", "tmp": "0.2.7", - "ts-jest": "^29.1.1", - "ts-node": "9.1.1", - "typescript": "5.6.2", + "ts-jest": "^29.4.1", + "tsx": "^4.20.6", + "typescript": "5.7.3", "typescript-eslint": "^8.65.0", "vscode-oniguruma": "^1.6.1", "vscode-textmate": "^6.0.0" diff --git a/src/activateOmniSharp.ts b/src/activateOmniSharp.ts index 5358fcaab1..bf4ac5a6bb 100644 --- a/src/activateOmniSharp.ts +++ b/src/activateOmniSharp.ts @@ -4,15 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { OmnisharpExtensionExports } from './csharpExtensionExports'; -import { PlatformInformation } from './shared/platform'; +import { OmnisharpExtensionExports } from './csharpExtensionExports.ts'; +import { PlatformInformation } from './shared/platform.ts'; import { Observable } from 'rxjs'; -import { NetworkSettingsProvider } from './networkSettings'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { activateOmniSharpLanguageServer } from './omnisharp/omnisharpLanguageServer'; -import { EventStream } from './eventStream'; -import { razorOptions } from './shared/options'; -import { activateRazorOmniSharpExtension } from './razor/razorOmnisharp'; +import { NetworkSettingsProvider } from './networkSettings.ts'; +import { ITelemetryReporter } from './shared/telemetryReporter.ts'; +import { activateOmniSharpLanguageServer } from './omnisharp/omnisharpLanguageServer.ts'; +import { EventStream } from './eventStream.ts'; +import { razorOptions } from './shared/options.ts'; +import { activateRazorOmniSharpExtension } from './razor/razorOmnisharp.ts'; export function activateOmniSharp( context: vscode.ExtensionContext, @@ -21,7 +21,7 @@ export function activateOmniSharp( networkSettingsProvider: NetworkSettingsProvider, eventStream: EventStream, csharpChannel: vscode.OutputChannel, - reporter: TelemetryReporter, + reporter: ITelemetryReporter, getCoreClrDebugPromise: (languageServerStarted: Promise) => Promise ): OmnisharpExtensionExports { // activate language services diff --git a/src/activateRoslyn.ts b/src/activateRoslyn.ts index d17fb65a9d..7fca7674ce 100644 --- a/src/activateRoslyn.ts +++ b/src/activateRoslyn.ts @@ -4,27 +4,27 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { CSharpExtensionExports } from './csharpExtensionExports'; -import { PlatformInformation } from './shared/platform'; +import { CSharpExtensionExports } from './csharpExtensionExports.ts'; +import { PlatformInformation } from './shared/platform.ts'; import { Observable } from 'rxjs'; -import { EventStream } from './eventStream'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { RoslynLanguageServer } from './lsptoolshost/server/roslynLanguageServer'; -import { CSharpDevKitExports } from './csharpDevKitExports'; -import { RoslynLanguageServerEvents, ServerState } from './lsptoolshost/server/languageServerEvents'; -import { activateRoslynLanguageServer, createCaptureActivityLogs } from './lsptoolshost/activate'; -import Descriptors from './lsptoolshost/solutionSnapshot/descriptors'; -import { getBrokeredServiceContainer } from './lsptoolshost/serviceBroker/brokeredServicesHosting'; -import { debugSessionTracker } from './coreclrDebug/provisionalDebugSessionTracker'; -import { RoslynLanguageServerExport } from './lsptoolshost/extensions/roslynLanguageServerExportChannel'; -import { BlazorDebugConfigurationProvider } from './razor/src/blazorDebug/blazorDebugConfigurationProvider'; -import { languageServerOptions } from './shared/options'; -import { csharpDevkitExtensionId } from './utils/getCSharpDevKit'; +import { EventStream } from './eventStream.ts'; +import { ITelemetryReporterWithLevel } from './shared/telemetryReporter.ts'; +import { RoslynLanguageServer } from './lsptoolshost/server/roslynLanguageServer.ts'; +import { CSharpDevKitExports } from './csharpDevKitExports.ts'; +import { RoslynLanguageServerEvents, ServerState } from './lsptoolshost/server/languageServerEvents.ts'; +import { activateRoslynLanguageServer, createCaptureActivityLogs } from './lsptoolshost/activate.ts'; +import Descriptors from './lsptoolshost/solutionSnapshot/descriptors.ts'; +import { getBrokeredServiceContainer } from './lsptoolshost/serviceBroker/brokeredServicesHosting.ts'; +import { debugSessionTracker } from './coreclrDebug/provisionalDebugSessionTracker.ts'; +import { RoslynLanguageServerExport } from './lsptoolshost/extensions/roslynLanguageServerExportChannel.ts'; +import { BlazorDebugConfigurationProvider } from './razor/src/blazorDebug/blazorDebugConfigurationProvider.ts'; +import { languageServerOptions } from './shared/options.ts'; +import { csharpDevkitExtensionId } from './utils/getCSharpDevKit.ts'; import { GlobalBrokeredServiceContainer } from '@microsoft/servicehub-framework'; -import { SolutionSnapshotProvider } from './lsptoolshost/solutionSnapshot/solutionSnapshotProvider'; -import { BuildResultDiagnostics } from './lsptoolshost/diagnostics/buildResultReporterService'; -import { getComponentFolder } from './lsptoolshost/extensions/builtInComponents'; -import { ObservableLogOutputChannel } from './lsptoolshost/logging/observableLogOutputChannel'; +import { SolutionSnapshotProvider } from './lsptoolshost/solutionSnapshot/solutionSnapshotProvider.ts'; +import { BuildResultDiagnostics } from './lsptoolshost/diagnostics/buildResultReporterService.ts'; +import { getComponentFolder } from './lsptoolshost/extensions/builtInComponents.ts'; +import { ObservableLogOutputChannel } from './lsptoolshost/logging/observableLogOutputChannel.ts'; export function activateRoslyn( context: vscode.ExtensionContext, @@ -32,7 +32,7 @@ export function activateRoslyn( optionStream: Observable, eventStream: EventStream, csharpChannel: vscode.LogOutputChannel, - reporter: TelemetryReporter, + reporter: ITelemetryReporterWithLevel, csharpDevkitExtension: vscode.Extension | undefined, getCoreClrDebugPromise: (languageServerStarted: Promise) => Promise ): CSharpExtensionExports { diff --git a/src/checkSupportedPlatform.ts b/src/checkSupportedPlatform.ts index 36fb5b8bc9..127eec754a 100644 --- a/src/checkSupportedPlatform.ts +++ b/src/checkSupportedPlatform.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { PlatformInformation } from './shared/platform'; -import { ActionOption, showErrorMessage } from './shared/observers/utils/showMessage'; +import { PlatformInformation } from './shared/platform.ts'; +import { ActionOption, showErrorMessage } from './shared/observers/utils/showMessage.ts'; export function checkIsSupportedPlatform(context: vscode.ExtensionContext, platformInfo: PlatformInformation): boolean { if (!isSupportedPlatform(platformInfo)) { diff --git a/src/common.ts b/src/common.ts index d3dc6d33e9..482cbb4019 100644 --- a/src/common.ts +++ b/src/common.ts @@ -7,7 +7,7 @@ import * as cp from 'child_process'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { AbsolutePath } from './packageManager/absolutePath'; +import { AbsolutePath } from './packageManager/absolutePath.ts'; let extensionPath: string; diff --git a/src/compositeDisposable.ts b/src/compositeDisposable.ts index 799577d1d7..6ac79c2917 100644 --- a/src/compositeDisposable.ts +++ b/src/compositeDisposable.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Subscription } from 'rxjs'; -import Disposable, { IDisposable } from './disposable'; +import Disposable, { IDisposable } from './disposable.ts'; export default class CompositeDisposable extends Disposable { private disposables = new Subscription(); diff --git a/src/coreclrDebug/activate.ts b/src/coreclrDebug/activate.ts index 0101c4797a..3fbb5efaf4 100644 --- a/src/coreclrDebug/activate.ts +++ b/src/coreclrDebug/activate.ts @@ -5,23 +5,23 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import * as common from '../common'; -import { CoreClrDebugUtil, getTargetArchitecture, MINIMUM_SUPPORT_MACOS_DISPLAY_NAME } from './util'; -import { PlatformInformation } from '../shared/platform'; +import * as common from '../common.ts'; +import { CoreClrDebugUtil, getTargetArchitecture, MINIMUM_SUPPORT_MACOS_DISPLAY_NAME } from './util.ts'; +import { PlatformInformation } from '../shared/platform.ts'; import { DebuggerPrerequisiteWarning, DebuggerPrerequisiteFailure, DebuggerNotInstalledFailure, -} from '../shared/loggingEvents'; -import { EventStream } from '../eventStream'; -import { getRuntimeDependencyPackageWithId } from '../tools/runtimeDependencyPackageUtils'; -import { getDotnetInfo } from '../shared/utils/getDotnetInfo'; -import { RemoteAttachPicker } from '../shared/processPicker'; -import CompositeDisposable from '../compositeDisposable'; -import { BaseVsDbgConfigurationProvider } from '../shared/configurationProvider'; -import { omnisharpOptions } from '../shared/options'; -import { ActionOption, CommandOption, showErrorMessage } from '../shared/observers/utils/showMessage'; -import { getCSharpDevKit } from '../utils/getCSharpDevKit'; +} from '../shared/loggingEvents.ts'; +import { EventStream } from '../eventStream.ts'; +import { getRuntimeDependencyPackageWithId } from '../tools/runtimeDependencyPackageUtils.ts'; +import { getDotnetInfo } from '../shared/utils/getDotnetInfo.ts'; +import { RemoteAttachPicker } from '../shared/processPicker.ts'; +import CompositeDisposable from '../compositeDisposable.ts'; +import { BaseVsDbgConfigurationProvider } from '../shared/configurationProvider.ts'; +import { omnisharpOptions } from '../shared/options.ts'; +import { ActionOption, CommandOption, showErrorMessage } from '../shared/observers/utils/showMessage.ts'; +import { getCSharpDevKit } from '../utils/getCSharpDevKit.ts'; export async function activate( thisExtension: vscode.Extension, diff --git a/src/coreclrDebug/util.ts b/src/coreclrDebug/util.ts index abbb021af1..52f49d85dd 100644 --- a/src/coreclrDebug/util.ts +++ b/src/coreclrDebug/util.ts @@ -8,9 +8,9 @@ import * as path from 'path'; import * as fs from 'fs'; import * as semver from 'semver'; import * as os from 'os'; -import { PlatformInformation } from '../shared/platform'; -import { getDotnetInfo } from '../shared/utils/getDotnetInfo'; -import { DotnetInfo } from '../shared/utils/dotnetInfo'; +import { PlatformInformation } from '../shared/platform.ts'; +import { getDotnetInfo } from '../shared/utils/getDotnetInfo.ts'; +import { DotnetInfo } from '../shared/utils/dotnetInfo.ts'; const MINIMUM_SUPPORTED_DOTNET_CLI = '1.0.0'; diff --git a/src/csharpExtensionExports.ts b/src/csharpExtensionExports.ts index 7c34d28cd9..9c72d5acc7 100644 --- a/src/csharpExtensionExports.ts +++ b/src/csharpExtensionExports.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { Advisor } from './omnisharp/features/diagnosticsProvider'; -import { EventStream } from './eventStream'; -import TestManager from './omnisharp/features/dotnetTest'; +import { Advisor } from './omnisharp/features/diagnosticsProvider.ts'; +import { EventStream } from './eventStream.ts'; +import TestManager from './omnisharp/features/dotnetTest.ts'; import { GlobalBrokeredServiceContainer } from '@microsoft/servicehub-framework'; -import { LanguageServerEvents } from './lsptoolshost/server/languageServerEvents'; +import { LanguageServerEvents } from './lsptoolshost/server/languageServerEvents.ts'; import { PartialResultParams, ProtocolRequestType, RequestParam, RequestType } from 'vscode-languageclient'; export interface LimitedExtensionExports { diff --git a/src/eventStream.ts b/src/eventStream.ts index 946370b936..dfcea43ea3 100644 --- a/src/eventStream.ts +++ b/src/eventStream.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Subject, Subscription } from 'rxjs'; -import { BaseEvent } from './shared/loggingEvents'; +import { BaseEvent } from './shared/loggingEvents.ts'; export class EventStream { private sink: Subject; diff --git a/src/installRuntimeDependencies.ts b/src/installRuntimeDependencies.ts index 3cdab86cd2..19b532b388 100644 --- a/src/installRuntimeDependencies.ts +++ b/src/installRuntimeDependencies.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from './shared/platform'; -import { PackageInstallation, LogPlatformInfo, InstallationSuccess } from './shared/loggingEvents'; -import { EventStream } from './eventStream'; -import { getRuntimeDependenciesPackages } from './tools/runtimeDependencyPackageUtils'; -import { getAbsolutePathPackagesToInstall } from './packageManager/getAbsolutePathPackagesToInstall'; -import { DependencyInstallationStatus, IInstallDependencies } from './packageManager/IInstallDependencies'; -import { AbsolutePathPackage } from './packageManager/absolutePathPackage'; +import { PlatformInformation } from './shared/platform.ts'; +import { PackageInstallation, LogPlatformInfo, InstallationSuccess } from './shared/loggingEvents.ts'; +import { EventStream } from './eventStream.ts'; +import { getRuntimeDependenciesPackages } from './tools/runtimeDependencyPackageUtils.ts'; +import { getAbsolutePathPackagesToInstall } from './packageManager/getAbsolutePathPackagesToInstall.ts'; +import { DependencyInstallationStatus, IInstallDependencies } from './packageManager/IInstallDependencies.ts'; +import { AbsolutePathPackage } from './packageManager/absolutePathPackage.ts'; export async function installRuntimeDependencies( packageJSON: any, diff --git a/src/lsptoolshost/activate.ts b/src/lsptoolshost/activate.ts index cf5d8aee8d..072a38ed04 100644 --- a/src/lsptoolshost/activate.ts +++ b/src/lsptoolshost/activate.ts @@ -6,32 +6,33 @@ import * as vscode from 'vscode'; import * as fs from 'fs'; import * as path from 'path'; -import { registerCommands } from './commands'; -import { registerDebugger } from './debugger/debugger'; -import { PlatformInformation } from '../shared/platform'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { getCSharpDevKit } from '../utils/getCSharpDevKit'; -import { DotnetRuntimeExtensionResolver } from './dotnetRuntime/dotnetRuntimeExtensionResolver'; -import { registerUnitTestingCommands } from './testing/unitTesting'; -import { registerLanguageServerOptionChanges } from './options/optionChanges'; +import { fileURLToPath } from 'url'; +import { registerCommands } from './commands.ts'; +import { registerDebugger } from './debugger/debugger.ts'; +import { PlatformInformation } from '../shared/platform.ts'; +import { ITelemetryReporterWithLevel } from '../shared/telemetryReporter.ts'; +import { getCSharpDevKit } from '../utils/getCSharpDevKit.ts'; +import { DotnetRuntimeExtensionResolver } from './dotnetRuntime/dotnetRuntimeExtensionResolver.ts'; +import { registerUnitTestingCommands } from './testing/unitTesting.ts'; +import { registerLanguageServerOptionChanges } from './options/optionChanges.ts'; import { Observable } from 'rxjs'; -import { RoslynLanguageServerEvents } from './server/languageServerEvents'; -import { registerCodeActionFixAllCommands } from './diagnostics/fixAllCodeAction'; -import { commonOptions, languageServerOptions } from '../shared/options'; -import { registerNestedCodeActionCommands } from './diagnostics/nestedCodeAction'; -import { registerRestoreCommands } from './projectRestore/restore'; -import { registerMiscellaneousFileNotifier } from './workspace/miscellaneousFileNotifier'; -import { TelemetryEventNames } from '../shared/telemetryEventNames'; -import { WorkspaceStatus } from './workspace/workspaceStatus'; -import { ProjectContextStatus } from './projectContext/projectContextStatus'; -import { RoslynLanguageServer } from './server/roslynLanguageServer'; -import { registerCopilotContextProviders } from './copilot/contextProviders'; -import { registerCopilotChatSurvey } from './copilot/copilotChatSurvey'; -import { registerRazorEndpoints } from './razor/razorEndpoints'; -import { ObservableLogOutputChannel } from './logging/observableLogOutputChannel'; -import { registerSourceGeneratorRefresh } from './generators/sourceGeneratorsRefresh'; -import { ActivityLogCapture } from '../csharpExtensionExports'; -import { createActivityLogCapture } from './logging/loggingUtils'; +import { RoslynLanguageServerEvents } from './server/languageServerEvents.ts'; +import { registerCodeActionFixAllCommands } from './diagnostics/fixAllCodeAction.ts'; +import { commonOptions, languageServerOptions } from '../shared/options.ts'; +import { registerNestedCodeActionCommands } from './diagnostics/nestedCodeAction.ts'; +import { registerRestoreCommands } from './projectRestore/restore.ts'; +import { registerMiscellaneousFileNotifier } from './workspace/miscellaneousFileNotifier.ts'; +import { TelemetryEventNames } from '../shared/telemetryEventNames.ts'; +import { WorkspaceStatus } from './workspace/workspaceStatus.ts'; +import { ProjectContextStatus } from './projectContext/projectContextStatus.ts'; +import { RoslynLanguageServer } from './server/roslynLanguageServer.ts'; +import { registerCopilotContextProviders } from './copilot/contextProviders.ts'; +import { registerCopilotChatSurvey } from './copilot/copilotChatSurvey.ts'; +import { registerRazorEndpoints } from './razor/razorEndpoints.ts'; +import { ObservableLogOutputChannel } from './logging/observableLogOutputChannel.ts'; +import { registerSourceGeneratorRefresh } from './generators/sourceGeneratorsRefresh.ts'; +import { ActivityLogCapture } from '../csharpExtensionExports.ts'; +import { createActivityLogCapture } from './logging/loggingUtils.ts'; let _channel: ObservableLogOutputChannel; let _traceChannel: ObservableLogOutputChannel; @@ -45,7 +46,7 @@ export async function activateRoslynLanguageServer( platformInfo: PlatformInformation, optionObservable: Observable, outputChannel: ObservableLogOutputChannel, - reporter: TelemetryReporter, + reporter: ITelemetryReporterWithLevel, languageServerEvents: RoslynLanguageServerEvents ): Promise { // Create a channel for outputting general logs from the language server. @@ -158,7 +159,7 @@ export function getServerPath(platformInfo: PlatformInformation) { } function getInstalledServerPath(platformInfo: PlatformInformation): string { - const clientRoot = __dirname; + const clientRoot = path.dirname(fileURLToPath(import.meta.url)); const serverFilePath = path.join(clientRoot, '..', '.roslyn', 'Microsoft.CodeAnalysis.LanguageServer'); let extension = ''; diff --git a/src/lsptoolshost/autoInsert/onAutoInsert.ts b/src/lsptoolshost/autoInsert/onAutoInsert.ts index 23bfeb2d35..0bfef6a2ed 100644 --- a/src/lsptoolshost/autoInsert/onAutoInsert.ts +++ b/src/lsptoolshost/autoInsert/onAutoInsert.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as RoslynProtocol from '../server/roslynProtocol'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import * as RoslynProtocol from '../server/roslynProtocol.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import { FormattingOptions, InsertTextFormat, Range, TextDocumentIdentifier } from 'vscode-languageclient'; import { LanguageClient } from 'vscode-languageclient/node'; diff --git a/src/lsptoolshost/autoInsert/onAutoInsertFeature.ts b/src/lsptoolshost/autoInsert/onAutoInsertFeature.ts index a68a9acb6b..ce1007a6dc 100644 --- a/src/lsptoolshost/autoInsert/onAutoInsertFeature.ts +++ b/src/lsptoolshost/autoInsert/onAutoInsertFeature.ts @@ -21,7 +21,7 @@ import { ServerCapabilities, } from 'vscode-languageclient'; -import * as RoslynProtocol from '../server/roslynProtocol'; +import * as RoslynProtocol from '../server/roslynProtocol.ts'; import { randomUUID } from 'crypto'; import { LanguageClient } from 'vscode-languageclient/node'; diff --git a/src/lsptoolshost/commands.ts b/src/lsptoolshost/commands.ts index baf2e95aab..ff7752b85d 100644 --- a/src/lsptoolshost/commands.ts +++ b/src/lsptoolshost/commands.ts @@ -4,23 +4,23 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from './server/roslynLanguageServer'; -import reportIssue from '../shared/reportIssue'; -import { getDotnetInfo } from '../shared/utils/getDotnetInfo'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; -import { registerWorkspaceCommands } from './workspace/workspaceCommands'; -import { registerServerCommands } from './server/serverCommands'; +import { RoslynLanguageServer } from './server/roslynLanguageServer.ts'; +import reportIssue from '../shared/reportIssue.ts'; +import { getDotnetInfo } from '../shared/utils/getDotnetInfo.ts'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; +import { registerWorkspaceCommands } from './workspace/workspaceCommands.ts'; +import { registerServerCommands } from './server/serverCommands.ts'; import { changeProjectContext, changeProjectContextCommandName, changeProjectContextEditor, changeProjectContextFileExplorer, openAndChangeProjectContext, -} from './projectContext/projectContextCommands'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { TelemetryEventNames } from '../shared/telemetryEventNames'; -import { registerCollectLogsCommand } from './logging/collectLogs'; -import { ObservableLogOutputChannel } from './logging/observableLogOutputChannel'; +} from './projectContext/projectContextCommands.ts'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; +import { TelemetryEventNames } from '../shared/telemetryEventNames.ts'; +import { registerCollectLogsCommand } from './logging/collectLogs.ts'; +import { ObservableLogOutputChannel } from './logging/observableLogOutputChannel.ts'; export function registerCommands( context: vscode.ExtensionContext, @@ -28,7 +28,7 @@ export function registerCommands( hostExecutableResolver: IHostExecutableResolver, outputChannel: ObservableLogOutputChannel, csharpTraceChannel: ObservableLogOutputChannel, - reporter: TelemetryReporter + reporter: ITelemetryReporter ) { registerExtensionCommands( context, @@ -51,7 +51,7 @@ function registerExtensionCommands( hostExecutableResolver: IHostExecutableResolver, outputChannel: ObservableLogOutputChannel, csharpTraceChannel: ObservableLogOutputChannel, - reporter: TelemetryReporter + reporter: ITelemetryReporter ) { context.subscriptions.push( vscode.commands.registerCommand( diff --git a/src/lsptoolshost/copilot/contextProviders.ts b/src/lsptoolshost/copilot/contextProviders.ts index 12f1c5c806..48ccf6a3b3 100644 --- a/src/lsptoolshost/copilot/contextProviders.ts +++ b/src/lsptoolshost/copilot/contextProviders.ts @@ -10,9 +10,9 @@ import { } from '@github/copilot-language-server'; import * as vscode from 'vscode'; import * as lsp from 'vscode-languageclient'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { CSharpExtensionId } from '../../constants/csharpExtensionId'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { CSharpExtensionId } from '../../constants/csharpExtensionId.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; type ActiveExperiments = { [name: string]: string | number | boolean | string[] }; diff --git a/src/lsptoolshost/copilot/copilotChatSurvey.ts b/src/lsptoolshost/copilot/copilotChatSurvey.ts index 2365699d8d..2a7ede2d3d 100644 --- a/src/lsptoolshost/copilot/copilotChatSurvey.ts +++ b/src/lsptoolshost/copilot/copilotChatSurvey.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import type { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { LanguageServerEvents, ServerState } from '../server/languageServerEvents'; -import { ITelemetryReporter } from '../../shared/telemetryReporter'; -import { TelemetryEventNames } from '../../shared/telemetryEventNames'; +import type { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { LanguageServerEvents, ServerState } from '../server/languageServerEvents.ts'; +import { ITelemetryReporter } from '../../shared/telemetryReporter.ts'; +import { TelemetryEventNames } from '../../shared/telemetryEventNames.ts'; // Stored under separate keys so a snooze write can never overwrite a terminal "shown" // value set in another window (globalState.update replaces the whole value for a key). diff --git a/src/lsptoolshost/debugger/debugger.ts b/src/lsptoolshost/debugger/debugger.ts index 47ccce90e1..f5ef3a2590 100644 --- a/src/lsptoolshost/debugger/debugger.ts +++ b/src/lsptoolshost/debugger/debugger.ts @@ -4,15 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { addAssetsIfNecessary, generateAssets } from '../../shared/assets'; -import { DotnetWorkspaceConfigurationProvider } from '../../shared/workspaceConfigurationProvider'; -import { IWorkspaceDebugInformationProvider } from '../../shared/IWorkspaceDebugInformationProvider'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { RoslynWorkspaceDebugInformationProvider } from '../debugger/roslynWorkspaceDebugConfigurationProvider'; -import { PlatformInformation } from '../../shared/platform'; -import { DotnetConfigurationResolver } from '../../shared/dotnetConfigurationProvider'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; -import { RoslynLanguageServerEvents, ServerState } from '../server/languageServerEvents'; +import { addAssetsIfNecessary, generateAssets } from '../../shared/assets.ts'; +import { DotnetWorkspaceConfigurationProvider } from '../../shared/workspaceConfigurationProvider.ts'; +import { IWorkspaceDebugInformationProvider } from '../../shared/IWorkspaceDebugInformationProvider.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { RoslynWorkspaceDebugInformationProvider } from '../debugger/roslynWorkspaceDebugConfigurationProvider.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { DotnetConfigurationResolver } from '../../shared/dotnetConfigurationProvider.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; +import { RoslynLanguageServerEvents, ServerState } from '../server/languageServerEvents.ts'; export function registerDebugger( context: vscode.ExtensionContext, diff --git a/src/lsptoolshost/debugger/roslynWorkspaceDebugConfigurationProvider.ts b/src/lsptoolshost/debugger/roslynWorkspaceDebugConfigurationProvider.ts index b3bbb45ae1..dabe9a8945 100644 --- a/src/lsptoolshost/debugger/roslynWorkspaceDebugConfigurationProvider.ts +++ b/src/lsptoolshost/debugger/roslynWorkspaceDebugConfigurationProvider.ts @@ -4,24 +4,24 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { mapAsync } from '../../common'; +import { mapAsync } from '../../common.ts'; import { IWorkspaceDebugInformationProvider, ProjectDebugInformation, -} from '../../shared/IWorkspaceDebugInformationProvider'; +} from '../../shared/IWorkspaceDebugInformationProvider.ts'; import { isBlazorWebAssemblyHosted, isBlazorWebAssemblyHostedServer, isBlazorWebAssemblyProject, isWebProject, -} from '../../shared/utils'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +} from '../../shared/utils.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import { ProjectDebugConfiguration, WorkspaceDebugConfigurationParams, WorkspaceDebugConfigurationRequest, -} from '../server/roslynProtocol'; -import { UriConverter } from '../utils/uriConverter'; +} from '../server/roslynProtocol.ts'; +import { UriConverter } from '../utils/uriConverter.ts'; export class RoslynWorkspaceDebugInformationProvider implements IWorkspaceDebugInformationProvider { constructor( diff --git a/src/lsptoolshost/diagnostics/buildDiagnosticsService.ts b/src/lsptoolshost/diagnostics/buildDiagnosticsService.ts index 70458d3bd5..54ddf5e660 100644 --- a/src/lsptoolshost/diagnostics/buildDiagnosticsService.ts +++ b/src/lsptoolshost/diagnostics/buildDiagnosticsService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { languageServerOptions } from '../../shared/options'; +import { languageServerOptions } from '../../shared/options.ts'; export enum AnalysisSetting { FullSolution = 'fullSolution', diff --git a/src/lsptoolshost/diagnostics/buildResultReporterService.ts b/src/lsptoolshost/diagnostics/buildResultReporterService.ts index ed2587e661..998750de6b 100644 --- a/src/lsptoolshost/diagnostics/buildResultReporterService.ts +++ b/src/lsptoolshost/diagnostics/buildResultReporterService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { CancellationToken } from 'vscode-languageclient'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import * as vscode from 'vscode'; interface IBuildResultDiagnostics { diff --git a/src/lsptoolshost/diagnostics/diagnosticMiddleware.ts b/src/lsptoolshost/diagnostics/diagnosticMiddleware.ts index 5adba60290..739491d25c 100644 --- a/src/lsptoolshost/diagnostics/diagnosticMiddleware.ts +++ b/src/lsptoolshost/diagnostics/diagnosticMiddleware.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import { ProvideDiagnosticSignature, ProvideWorkspaceDiagnosticSignature, vsdiag } from 'vscode-languageclient'; -import { languageServerOptions } from '../../shared/options'; +import { languageServerOptions } from '../../shared/options.ts'; export async function provideDiagnostics( document: vscode.TextDocument | vscode.Uri, diff --git a/src/lsptoolshost/diagnostics/fixAllCodeAction.ts b/src/lsptoolshost/diagnostics/fixAllCodeAction.ts index e3cc327f5f..6975fdfbfb 100644 --- a/src/lsptoolshost/diagnostics/fixAllCodeAction.ts +++ b/src/lsptoolshost/diagnostics/fixAllCodeAction.ts @@ -4,11 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as RoslynProtocol from '../server/roslynProtocol'; +import * as RoslynProtocol from '../server/roslynProtocol.ts'; import { LSPAny } from 'vscode-languageclient'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { URIConverter, createConverter } from 'vscode-languageclient/protocolConverter'; -import { UriConverter } from '../utils/uriConverter'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; export function registerCodeActionFixAllCommands( context: vscode.ExtensionContext, @@ -56,9 +54,7 @@ export async function getFixAllResponse( ); if (response.edit) { - const uriConverter: URIConverter = (value: string): vscode.Uri => UriConverter.deserialize(value); - const protocolConverter = createConverter(uriConverter, true, true, true); - const fixAllEdit = await protocolConverter.asWorkspaceEdit(response.edit); + const fixAllEdit = await languageServer.protocol2CodeConverter.asWorkspaceEdit(response.edit); if (!(await vscode.workspace.applyEdit(fixAllEdit))) { const componentName = '[roslyn.client.fixAllCodeAction]'; const errorMessage = 'Failed to make a fix all edit for completion.'; diff --git a/src/lsptoolshost/diagnostics/nestedCodeAction.ts b/src/lsptoolshost/diagnostics/nestedCodeAction.ts index 0d2d7650ff..a083cf7121 100644 --- a/src/lsptoolshost/diagnostics/nestedCodeAction.ts +++ b/src/lsptoolshost/diagnostics/nestedCodeAction.ts @@ -5,10 +5,8 @@ import * as vscode from 'vscode'; import { CodeAction, CodeActionResolveRequest, LSPAny } from 'vscode-languageclient'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { URIConverter, createConverter } from 'vscode-languageclient/protocolConverter'; -import { UriConverter } from '../utils/uriConverter'; -import { getFixAllResponse } from './fixAllCodeAction'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { getFixAllResponse } from './fixAllCodeAction.ts'; export function registerNestedCodeActionCommands( context: vscode.ExtensionContext, @@ -72,10 +70,7 @@ async function registerNestedResolveCodeAction( throw new Error('Tried to retrieve a code action edit, but an error occurred.'); } - const uriConverter: URIConverter = (value: string): vscode.Uri => - UriConverter.deserialize(value); - const protocolConverter = createConverter(uriConverter, true, true, true); - const fixAllEdit = await protocolConverter.asWorkspaceEdit(response.edit); + const fixAllEdit = await languageServer.protocol2CodeConverter.asWorkspaceEdit(response.edit); if (!(await vscode.workspace.applyEdit(fixAllEdit))) { const componentName = '[roslyn.client.nestedCodeAction]'; const errorMessage = 'Failed to make am edit for completion.'; diff --git a/src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts b/src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts index aebfa77e19..a8314db706 100644 --- a/src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts +++ b/src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts @@ -5,21 +5,21 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import { HostExecutableInformation } from '../../shared/constants/hostExecutableInformation'; -import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver'; -import { PlatformInformation } from '../../shared/platform'; -import { languageServerOptions } from '../../shared/options'; +import { HostExecutableInformation } from '../../shared/constants/hostExecutableInformation.ts'; +import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { languageServerOptions } from '../../shared/options.ts'; import { existsSync } from 'fs'; -import { CSharpExtensionId } from '../../constants/csharpExtensionId'; +import { CSharpExtensionId } from '../../constants/csharpExtensionId.ts'; import { readFile } from 'fs/promises'; import { DotnetInstallMode, IDotnetAcquireContext, IDotnetAcquireResult, IDotnetFindPathContext, -} from './dotnetRuntimeExtensionApi'; -import { DotNetRuntimeExtensionId } from '../../checkDotNetRuntimeExtensionVersion'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; +} from './dotnetRuntimeExtensionApi.ts'; +import { DotNetRuntimeExtensionId } from '../../checkDotNetRuntimeExtensionVersion.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; const DotNetMajorVersion = '10'; const DotNetMinorVersion = '0'; diff --git a/src/lsptoolshost/extensions/builtInComponents.ts b/src/lsptoolshost/extensions/builtInComponents.ts index 26d170326d..74801869f1 100644 --- a/src/lsptoolshost/extensions/builtInComponents.ts +++ b/src/lsptoolshost/extensions/builtInComponents.ts @@ -6,7 +6,8 @@ import * as vscode from 'vscode'; import * as fs from 'fs'; import * as path from 'path'; -import { LanguageServerOptions } from '../../shared/options'; +import { fileURLToPath } from 'url'; +import { LanguageServerOptions } from '../../shared/options.ts'; interface ComponentInfo { defaultFolderName: string; @@ -80,5 +81,5 @@ function getComponentFolderPath(component: ComponentInfo, options: LanguageServe } } - return path.join(__dirname, '..', component.defaultFolderName); + return path.join(path.dirname(fileURLToPath(import.meta.url)), '..', component.defaultFolderName); } diff --git a/src/lsptoolshost/extensions/roslynLanguageServerExportChannel.ts b/src/lsptoolshost/extensions/roslynLanguageServerExportChannel.ts index b158753b9f..f7e1f1b49b 100644 --- a/src/lsptoolshost/extensions/roslynLanguageServerExportChannel.ts +++ b/src/lsptoolshost/extensions/roslynLanguageServerExportChannel.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import { ParameterStructures, PartialResultParams, diff --git a/src/lsptoolshost/generators/sourceGeneratorsRefresh.ts b/src/lsptoolshost/generators/sourceGeneratorsRefresh.ts index a006fa06b8..10ff6a13b3 100644 --- a/src/lsptoolshost/generators/sourceGeneratorsRefresh.ts +++ b/src/lsptoolshost/generators/sourceGeneratorsRefresh.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel'; -import { RefreshSourceGeneratorsNotification } from '../server/roslynProtocol'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel.ts'; +import { RefreshSourceGeneratorsNotification } from '../server/roslynProtocol.ts'; export function registerSourceGeneratorRefresh( context: vscode.ExtensionContext, diff --git a/src/lsptoolshost/handlers/showToastNotification.ts b/src/lsptoolshost/handlers/showToastNotification.ts index e11f52d1b9..eff0f0947d 100644 --- a/src/lsptoolshost/handlers/showToastNotification.ts +++ b/src/lsptoolshost/handlers/showToastNotification.ts @@ -4,10 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageClient } from '../server/roslynLanguageClient'; +import { RoslynLanguageClient } from '../server/roslynLanguageClient.ts'; import { MessageType } from 'vscode-languageclient'; -import { ShowToastNotification } from '../server/roslynProtocol'; -import { showErrorMessage, showInformationMessage, showWarningMessage } from '../../shared/observers/utils/showMessage'; +import { ShowToastNotification } from '../server/roslynProtocol.ts'; +import { + showErrorMessage, + showInformationMessage, + showWarningMessage, +} from '../../shared/observers/utils/showMessage.ts'; export function registerShowToastNotification(client: RoslynLanguageClient) { client.onNotification(ShowToastNotification.type, async (notification) => { diff --git a/src/lsptoolshost/logging/collectLogs.ts b/src/lsptoolshost/logging/collectLogs.ts index fff9750de0..692e0ec927 100644 --- a/src/lsptoolshost/logging/collectLogs.ts +++ b/src/lsptoolshost/logging/collectLogs.ts @@ -6,9 +6,9 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { showErrorMessageWithOptions } from '../../shared/observers/utils/showMessage'; -import { ObservableLogOutputChannel } from './observableLogOutputChannel'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { showErrorMessageWithOptions } from '../../shared/observers/utils/showMessage.ts'; +import { ObservableLogOutputChannel } from './observableLogOutputChannel.ts'; import { DumpRequest, collectDumps, @@ -21,8 +21,8 @@ import { createActivityLogCapture, generateReadmeContent, LogsToCollect, -} from './loggingUtils'; -import { runDotnetTraceInTerminal } from './profiling'; +} from './loggingUtils.ts'; +import { runDotnetTraceInTerminal } from './profiling.ts'; /** Represents the types of data the user can choose to collect */ type CollectOption = 'activityLogs' | 'performanceTrace' | 'memoryDump' | 'gcDump'; diff --git a/src/lsptoolshost/logging/loggingUtils.ts b/src/lsptoolshost/logging/loggingUtils.ts index 33e1d3b6ee..664635c796 100644 --- a/src/lsptoolshost/logging/loggingUtils.ts +++ b/src/lsptoolshost/logging/loggingUtils.ts @@ -7,10 +7,10 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import archiver from 'archiver'; -import { execChildProcess } from '../../common'; -import { ObservableLogOutputChannel } from './observableLogOutputChannel'; -import { ActivityLogCapture, ActivityLogResult } from '../../csharpExtensionExports'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import { execChildProcess } from '../../common.ts'; +import { ObservableLogOutputChannel } from './observableLogOutputChannel.ts'; +import { ActivityLogCapture, ActivityLogResult } from '../../csharpExtensionExports.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; /** * Configuration for a dump tool. diff --git a/src/lsptoolshost/logging/profiling.ts b/src/lsptoolshost/logging/profiling.ts index 0ed2d5cb0d..577d398e84 100644 --- a/src/lsptoolshost/logging/profiling.ts +++ b/src/lsptoolshost/logging/profiling.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import { EOL } from 'os'; -import { ObservableLogOutputChannel } from './observableLogOutputChannel'; +import { ObservableLogOutputChannel } from './observableLogOutputChannel.ts'; const TraceTerminalName = 'dotnet-trace'; diff --git a/src/lsptoolshost/options/configurationMiddleware.ts b/src/lsptoolshost/options/configurationMiddleware.ts index e8bfc1bd89..dde4772ee5 100644 --- a/src/lsptoolshost/options/configurationMiddleware.ts +++ b/src/lsptoolshost/options/configurationMiddleware.ts @@ -5,8 +5,8 @@ import * as vscode from 'vscode'; import { ConfigurationParams } from 'vscode-languageclient'; -import { convertServerOptionNameToClientConfigurationName as convertServerOptionNameToClientConfigurationName } from './optionNameConverter'; -import { readEquivalentVsCodeConfiguration } from './universalEditorConfigProvider'; +import { convertServerOptionNameToClientConfigurationName as convertServerOptionNameToClientConfigurationName } from './optionNameConverter.ts'; +import { readEquivalentVsCodeConfiguration } from './universalEditorConfigProvider.ts'; export function readConfigurations(params: ConfigurationParams): (string | null)[] { // Note: null means there is no such configuration in client. diff --git a/src/lsptoolshost/options/optionChanges.ts b/src/lsptoolshost/options/optionChanges.ts index 0bc5f878d4..d68fbf7348 100644 --- a/src/lsptoolshost/options/optionChanges.ts +++ b/src/lsptoolshost/options/optionChanges.ts @@ -5,10 +5,14 @@ import * as vscode from 'vscode'; import { Observable } from 'rxjs'; -import { CommonOptionsThatTriggerReload, LanguageServerOptionsThatTriggerReload } from '../../shared/options'; -import { HandleOptionChanges, OptionChangeObserver, OptionChanges } from '../../shared/observers/optionChangeObserver'; -import Disposable from '../../disposable'; -import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage'; +import { CommonOptionsThatTriggerReload, LanguageServerOptionsThatTriggerReload } from '../../shared/options.ts'; +import { + HandleOptionChanges, + OptionChangeObserver, + OptionChanges, +} from '../../shared/observers/optionChangeObserver.ts'; +import Disposable from '../../disposable.ts'; +import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage.ts'; export function registerLanguageServerOptionChanges(optionObservable: Observable): Disposable { const optionChangeObserver: OptionChangeObserver = { diff --git a/src/lsptoolshost/projectContext/projectContextCommands.ts b/src/lsptoolshost/projectContext/projectContextCommands.ts index 98e1323205..b2f36c3e30 100644 --- a/src/lsptoolshost/projectContext/projectContextCommands.ts +++ b/src/lsptoolshost/projectContext/projectContextCommands.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { isRelevantDocument } from './projectContextService'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { VSProjectContext } from '../server/roslynProtocol'; +import { isRelevantDocument } from './projectContextService.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { VSProjectContext } from '../server/roslynProtocol.ts'; import { CancellationToken } from 'vscode-languageclient'; export const changeProjectContextCommandName = 'csharp.changeProjectContext'; diff --git a/src/lsptoolshost/projectContext/projectContextFeature.ts b/src/lsptoolshost/projectContext/projectContextFeature.ts index e8759839fc..fbdf9cdcfb 100644 --- a/src/lsptoolshost/projectContext/projectContextFeature.ts +++ b/src/lsptoolshost/projectContext/projectContextFeature.ts @@ -22,7 +22,7 @@ import { TextDocumentRegistrationOptions, } from 'vscode-languageclient'; -import * as RoslynProtocol from '../server/roslynProtocol'; +import * as RoslynProtocol from '../server/roslynProtocol.ts'; import { randomUUID } from 'crypto'; import { LanguageClient } from 'vscode-languageclient/node'; diff --git a/src/lsptoolshost/projectContext/projectContextService.ts b/src/lsptoolshost/projectContext/projectContextService.ts index 53df227d52..0386dfce0f 100644 --- a/src/lsptoolshost/projectContext/projectContextService.ts +++ b/src/lsptoolshost/projectContext/projectContextService.ts @@ -4,20 +4,20 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import { ProjectContextRefreshRequest, VSGetProjectContextsRequest, VSProjectContext, VSProjectContextList, -} from '../server/roslynProtocol'; +} from '../server/roslynProtocol.ts'; import { TextDocumentIdentifier } from 'vscode-languageclient'; -import { UriConverter } from '../utils/uriConverter'; -import { LanguageServerEvents, ServerState } from '../server/languageServerEvents'; -import { RoslynLanguageClient } from '../server/roslynLanguageClient'; -import { languageServerOptions } from '../../shared/options'; -import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors'; -import { RazorLanguage } from '../../razor/src/razorLanguage'; +import { UriConverter } from '../utils/uriConverter.ts'; +import { LanguageServerEvents, ServerState } from '../server/languageServerEvents.ts'; +import { RoslynLanguageClient } from '../server/roslynLanguageClient.ts'; +import { languageServerOptions } from '../../shared/options.ts'; +import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors.ts'; +import { RazorLanguage } from '../../razor/src/razorLanguage.ts'; export interface ProjectContextChangeEvent { document: vscode.TextDocument; diff --git a/src/lsptoolshost/projectContext/projectContextStatus.ts b/src/lsptoolshost/projectContext/projectContextStatus.ts index 7c3028962a..096c043b4a 100644 --- a/src/lsptoolshost/projectContext/projectContextStatus.ts +++ b/src/lsptoolshost/projectContext/projectContextStatus.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { languageServerOptions } from '../../shared/options'; -import { RazorLanguage } from '../../razor/src/razorLanguage'; -import { ServerState } from '../server/languageServerEvents'; -import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { languageServerOptions } from '../../shared/options.ts'; +import { RazorLanguage } from '../../razor/src/razorLanguage.ts'; +import { ServerState } from '../server/languageServerEvents.ts'; +import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors.ts'; export class ProjectContextStatus { static createStatusItem(context: vscode.ExtensionContext, languageServer: RoslynLanguageServer) { diff --git a/src/lsptoolshost/projectRestore/restore.ts b/src/lsptoolshost/projectRestore/restore.ts index dbabc0b2d1..750ca8a3ed 100644 --- a/src/lsptoolshost/projectRestore/restore.ts +++ b/src/lsptoolshost/projectRestore/restore.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { RestorableProjects, RestoreParams, RestoreRequest } from '../server/roslynProtocol'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { RestorableProjects, RestoreParams, RestoreRequest } from '../server/roslynProtocol.ts'; import path from 'path'; -import { showErrorMessage } from '../../shared/observers/utils/showMessage'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; +import { showErrorMessage } from '../../shared/observers/utils/showMessage.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; import { CancellationToken } from 'vscode-languageclient'; let _restoreInProgress = false; diff --git a/src/lsptoolshost/razor/documentContentsRequest.ts b/src/lsptoolshost/razor/documentContentsRequest.ts index ea9584b05f..27f60b0b4f 100644 --- a/src/lsptoolshost/razor/documentContentsRequest.ts +++ b/src/lsptoolshost/razor/documentContentsRequest.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { TextDocumentIdentifier } from 'vscode-languageclient'; -import { GeneratedDocumentKind } from './generatedDocumentKind'; +import { GeneratedDocumentKind } from './generatedDocumentKind.ts'; export class DocumentContentsRequest { constructor( diff --git a/src/lsptoolshost/razor/htmlDocument.ts b/src/lsptoolshost/razor/htmlDocument.ts index e39f2e9773..f470a8df74 100644 --- a/src/lsptoolshost/razor/htmlDocument.ts +++ b/src/lsptoolshost/razor/htmlDocument.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { getUriPath } from '../../razor/src/uriPaths'; +import { getUriPath } from '../../razor/src/uriPaths.ts'; export class HtmlDocument { public readonly path: string; diff --git a/src/lsptoolshost/razor/htmlDocumentContentProvider.ts b/src/lsptoolshost/razor/htmlDocumentContentProvider.ts index 1401a6d05e..2ccfdd0ec2 100644 --- a/src/lsptoolshost/razor/htmlDocumentContentProvider.ts +++ b/src/lsptoolshost/razor/htmlDocumentContentProvider.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel'; -import { HtmlDocumentManager } from './htmlDocumentManager'; -import { getUriPath } from '../../razor/src/uriPaths'; +import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel.ts'; +import { HtmlDocumentManager } from './htmlDocumentManager.ts'; +import { getUriPath } from '../../razor/src/uriPaths.ts'; export class HtmlDocumentContentProvider implements vscode.TextDocumentContentProvider { public static readonly scheme = 'razor-html'; diff --git a/src/lsptoolshost/razor/htmlDocumentManager.ts b/src/lsptoolshost/razor/htmlDocumentManager.ts index 69f0f8531b..64a6b28c3f 100644 --- a/src/lsptoolshost/razor/htmlDocumentManager.ts +++ b/src/lsptoolshost/razor/htmlDocumentManager.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { PlatformInformation } from '../../shared/platform'; -import { getUriPath } from '../../razor/src/uriPaths'; -import { HtmlDocumentContentProvider } from './htmlDocumentContentProvider'; -import { HtmlDocument } from './htmlDocument'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { getUriPath } from '../../razor/src/uriPaths.ts'; +import { HtmlDocumentContentProvider } from './htmlDocumentContentProvider.ts'; +import { HtmlDocument } from './htmlDocument.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel.ts'; import { RequestType, TextDocumentIdentifier } from 'vscode-languageclient'; -import { UriConverter } from '../utils/uriConverter'; +import { UriConverter } from '../utils/uriConverter.ts'; const virtualHtmlSuffix = '__virtual.html'; diff --git a/src/lsptoolshost/razor/razorEndpoints.ts b/src/lsptoolshost/razor/razorEndpoints.ts index 3c619c4f18..c71bb95c32 100644 --- a/src/lsptoolshost/razor/razorEndpoints.ts +++ b/src/lsptoolshost/razor/razorEndpoints.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; +import { ObservableLogOutputChannel } from '../logging/observableLogOutputChannel.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; import { ColorPresentationRequest, CompletionRequest, @@ -29,21 +29,21 @@ import { SignatureHelp, SignatureHelpRequest, } from 'vscode-languageclient'; -import { HtmlUpdateParameters } from './htmlUpdateParameters'; -import { UriConverter } from '../utils/uriConverter'; -import { PlatformInformation } from '../../shared/platform'; -import { HtmlDocumentManager } from './htmlDocumentManager'; -import { DocumentColorHandler } from '../../razor/src/documentColor/documentColorHandler'; -import { ColorPresentationHandler } from '../../razor/src/colorPresentation/colorPresentationHandler'; -import { convertRangeToSerializable } from '../../razor/src/rpc/serializableRange'; -import { FoldingRangeHandler } from '../../razor/src/folding/foldingRangeHandler'; -import { CompletionHandler } from '../../razor/src/completion/completionHandler'; -import { FormattingHandler } from '../../razor/src/formatting/formattingHandler'; -import { HtmlDocument } from './htmlDocument'; -import { HtmlForwardedRequest } from './htmlForwardedRequest'; -import { BlazorDebugConfigurationProvider } from '../../razor/src/blazorDebug/blazorDebugConfigurationProvider'; -import { ShowGeneratedDocumentCommand } from './showGeneratedDocumentCommand'; -import { RazorLanguageConfiguration } from '../../razor/src/razorLanguageConfiguration'; +import { HtmlUpdateParameters } from './htmlUpdateParameters.ts'; +import { UriConverter } from '../utils/uriConverter.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { HtmlDocumentManager } from './htmlDocumentManager.ts'; +import { DocumentColorHandler } from '../../razor/src/documentColor/documentColorHandler.ts'; +import { ColorPresentationHandler } from '../../razor/src/colorPresentation/colorPresentationHandler.ts'; +import { convertRangeToSerializable } from '../../razor/src/rpc/serializableRange.ts'; +import { FoldingRangeHandler } from '../../razor/src/folding/foldingRangeHandler.ts'; +import { CompletionHandler } from '../../razor/src/completion/completionHandler.ts'; +import { FormattingHandler } from '../../razor/src/formatting/formattingHandler.ts'; +import { HtmlDocument } from './htmlDocument.ts'; +import { HtmlForwardedRequest } from './htmlForwardedRequest.ts'; +import { BlazorDebugConfigurationProvider } from '../../razor/src/blazorDebug/blazorDebugConfigurationProvider.ts'; +import { ShowGeneratedDocumentCommand } from './showGeneratedDocumentCommand.ts'; +import { RazorLanguageConfiguration } from '../../razor/src/razorLanguageConfiguration.ts'; export function registerRazorEndpoints( context: vscode.ExtensionContext, diff --git a/src/lsptoolshost/razor/showGeneratedDocumentCommand.ts b/src/lsptoolshost/razor/showGeneratedDocumentCommand.ts index de5f8afab9..94eb4711b5 100644 --- a/src/lsptoolshost/razor/showGeneratedDocumentCommand.ts +++ b/src/lsptoolshost/razor/showGeneratedDocumentCommand.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RazorLanguage } from '../../razor/src/razorLanguage'; -import { getUriPath } from '../../razor/src/uriPaths'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { DocumentContentsRequest } from './documentContentsRequest'; +import { RazorLanguage } from '../../razor/src/razorLanguage.ts'; +import { getUriPath } from '../../razor/src/uriPaths.ts'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { DocumentContentsRequest } from './documentContentsRequest.ts'; import { CancellationToken, RequestType, TextDocumentIdentifier } from 'vscode-languageclient'; -import { UriConverter } from '../utils/uriConverter'; -import { GeneratedDocumentKind } from './generatedDocumentKind'; +import { UriConverter } from '../utils/uriConverter.ts'; +import { GeneratedDocumentKind } from './generatedDocumentKind.ts'; export class ShowGeneratedDocumentCommand { private static requestType = new RequestType( diff --git a/src/lsptoolshost/server/languageServerEvents.ts b/src/lsptoolshost/server/languageServerEvents.ts index 3aa9756ef3..532c4f182b 100644 --- a/src/lsptoolshost/server/languageServerEvents.ts +++ b/src/lsptoolshost/server/languageServerEvents.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { IDisposable } from '../../disposable'; +import { IDisposable } from '../../disposable.ts'; export enum ServerState { Stopped = 0, diff --git a/src/lsptoolshost/server/roslynLanguageClient.ts b/src/lsptoolshost/server/roslynLanguageClient.ts index d063636fea..8c23302790 100644 --- a/src/lsptoolshost/server/roslynLanguageClient.ts +++ b/src/lsptoolshost/server/roslynLanguageClient.ts @@ -6,13 +6,13 @@ import * as vscode from 'vscode'; import { LanguageClient, ServerOptions } from 'vscode-languageclient/node'; import { CancellationToken, ErrorHandler, LanguageClientOptions, MessageSignature, State } from 'vscode-languageclient'; -import CompositeDisposable from '../../compositeDisposable'; -import { IDisposable } from '../../disposable'; -import { languageServerOptions } from '../../shared/options'; -import { RoslynLspErrorCodes } from './roslynProtocol'; -import { showErrorMessageWithOptions } from '../../shared/observers/utils/showMessage'; -import { ITelemetryReporter } from '../../shared/telemetryReporter'; -import { TelemetryEventNames } from '../../shared/telemetryEventNames'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { IDisposable } from '../../disposable.ts'; +import { languageServerOptions } from '../../shared/options.ts'; +import { RoslynLspErrorCodes } from './roslynProtocol.ts'; +import { showErrorMessageWithOptions } from '../../shared/observers/utils/showMessage.ts'; +import { ITelemetryReporter } from '../../shared/telemetryReporter.ts'; +import { TelemetryEventNames } from '../../shared/telemetryEventNames.ts'; /** * Implementation of the base LanguageClient type that allows for additional items to be disposed of diff --git a/src/lsptoolshost/server/roslynLanguageServer.ts b/src/lsptoolshost/server/roslynLanguageServer.ts index bd7fab303f..fddf29ce7b 100644 --- a/src/lsptoolshost/server/roslynLanguageServer.ts +++ b/src/lsptoolshost/server/roslynLanguageServer.ts @@ -12,6 +12,7 @@ import { NotificationHandler0, NotificationType, PartialResultParams, + Protocol2CodeConverter, ProtocolRequestType, RequestHandler, RequestParam, @@ -22,37 +23,37 @@ import { Trace, } from 'vscode-languageclient'; import { Executable, TransportKind } from 'vscode-languageclient/node'; -import { PlatformInformation } from '../../shared/platform'; -import { readConfigurations } from '../options/configurationMiddleware'; -import * as RoslynProtocol from './roslynProtocol'; -import { CSharpDevKitExports } from '../../csharpDevKitExports'; -import { SolutionSnapshotId } from '../solutionSnapshot/ISolutionSnapshotProvider'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { csharpDevkitExtensionId, getCSharpDevKit } from '../../utils/getCSharpDevKit'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { readConfigurations } from '../options/configurationMiddleware.ts'; +import * as RoslynProtocol from './roslynProtocol.ts'; +import { CSharpDevKitExports } from '../../csharpDevKitExports.ts'; +import { SolutionSnapshotId } from '../solutionSnapshot/ISolutionSnapshotProvider.ts'; +import { ITelemetryReporterWithLevel } from '../../shared/telemetryReporter.ts'; +import { csharpDevkitExtensionId, getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; import { randomUUID } from 'crypto'; -import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver'; -import { RoslynLanguageClient } from './roslynLanguageClient'; -import { provideDiagnostics, provideWorkspaceDiagnostics } from '../diagnostics/diagnosticMiddleware'; -import { reportProjectConfigurationEvent } from '../../shared/projectConfiguration'; -import { getDotnetInfo } from '../../shared/utils/getDotnetInfo'; -import { DotnetInfo } from '../../shared/utils/dotnetInfo'; -import { RoslynLanguageServerEvents, ServerState } from './languageServerEvents'; -import { registerShowToastNotification } from '../handlers/showToastNotification'; -import { registerOnAutoInsert } from '../autoInsert/onAutoInsert'; -import { commonOptions, languageServerOptions, omnisharpOptions } from '../../shared/options'; -import { VSTextDocumentIdentifier } from './roslynProtocol'; -import { IDisposable } from '../../disposable'; -import { BuildDiagnosticsService } from '../diagnostics/buildDiagnosticsService'; -import { getComponentPaths } from '../extensions/builtInComponents'; -import { OnAutoInsertFeature } from '../autoInsert/onAutoInsertFeature'; -import { ProjectContextService } from '../projectContext/projectContextService'; -import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage'; -import { TelemetryEventNames } from '../../shared/telemetryEventNames'; -import { getProfilingEnvVars } from '../logging/profiling'; -import { getServerPath } from '../activate'; -import { UriConverter } from '../utils/uriConverter'; -import { ProjectContextFeature } from '../projectContext/projectContextFeature'; +import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver.ts'; +import { RoslynLanguageClient } from './roslynLanguageClient.ts'; +import { provideDiagnostics, provideWorkspaceDiagnostics } from '../diagnostics/diagnosticMiddleware.ts'; +import { reportProjectConfigurationEvent } from '../../shared/projectConfiguration.ts'; +import { getDotnetInfo } from '../../shared/utils/getDotnetInfo.ts'; +import { DotnetInfo } from '../../shared/utils/dotnetInfo.ts'; +import { RoslynLanguageServerEvents, ServerState } from './languageServerEvents.ts'; +import { registerShowToastNotification } from '../handlers/showToastNotification.ts'; +import { registerOnAutoInsert } from '../autoInsert/onAutoInsert.ts'; +import { commonOptions, languageServerOptions, omnisharpOptions } from '../../shared/options.ts'; +import { VSTextDocumentIdentifier } from './roslynProtocol.ts'; +import { IDisposable } from '../../disposable.ts'; +import { BuildDiagnosticsService } from '../diagnostics/buildDiagnosticsService.ts'; +import { getComponentPaths } from '../extensions/builtInComponents.ts'; +import { OnAutoInsertFeature } from '../autoInsert/onAutoInsertFeature.ts'; +import { ProjectContextService } from '../projectContext/projectContextService.ts'; +import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage.ts'; +import { TelemetryEventNames } from '../../shared/telemetryEventNames.ts'; +import { getProfilingEnvVars } from '../logging/profiling.ts'; +import { getServerPath } from '../activate.ts'; +import { UriConverter } from '../utils/uriConverter.ts'; +import { ProjectContextFeature } from '../projectContext/projectContextFeature.ts'; // Flag indicating if C# Devkit was installed the last time we activated. // Used to determine if we need to restart the server on extension changes. @@ -91,7 +92,7 @@ export class RoslynLanguageServer { private _languageClient: RoslynLanguageClient, private _platformInfo: PlatformInformation, private _context: vscode.ExtensionContext, - private _telemetryReporter: TelemetryReporter, + private _telemetryReporter: ITelemetryReporterWithLevel, private _languageServerEvents: RoslynLanguageServerEvents, private _channel: vscode.LogOutputChannel, private _traceChannel: vscode.LogOutputChannel @@ -125,6 +126,10 @@ export class RoslynLanguageServer { return this._state; } + public get protocol2CodeConverter(): Protocol2CodeConverter { + return this._languageClient.protocol2CodeConverter; + } + public static get processId(): number | undefined { return RoslynLanguageServer._processId; } @@ -265,7 +270,7 @@ export class RoslynLanguageServer { platformInfo: PlatformInformation, hostExecutableResolver: IHostExecutableResolver, context: vscode.ExtensionContext, - telemetryReporter: TelemetryReporter, + telemetryReporter: ITelemetryReporterWithLevel, additionalExtensionPaths: string[], languageServerEvents: RoslynLanguageServerEvents, channel: vscode.LogOutputChannel, @@ -641,7 +646,7 @@ export class RoslynLanguageServer { platformInfo: PlatformInformation, hostExecutableResolver: IHostExecutableResolver, context: vscode.ExtensionContext, - telemetryReporter: TelemetryReporter, + telemetryReporter: ITelemetryReporterWithLevel, additionalExtensionPaths: string[], channel: vscode.LogOutputChannel, csharpDevKitExtensionExports?: CSharpDevKitExports diff --git a/src/lsptoolshost/server/roslynProtocol.ts b/src/lsptoolshost/server/roslynProtocol.ts index d54d74c6c6..f0b679aa1e 100644 --- a/src/lsptoolshost/server/roslynProtocol.ts +++ b/src/lsptoolshost/server/roslynProtocol.ts @@ -25,7 +25,7 @@ import { URI, WorkDoneProgressParams, } from 'vscode-languageclient'; -import { ProjectConfigurationMessage } from '../../shared/projectConfiguration'; +import { ProjectConfigurationMessage } from '../../shared/projectConfiguration.ts'; export interface VSProjectContextList { _vs_projectContexts: VSProjectContext[]; diff --git a/src/lsptoolshost/server/serverCommands.ts b/src/lsptoolshost/server/serverCommands.ts index 17cf5914a6..63b323d205 100644 --- a/src/lsptoolshost/server/serverCommands.ts +++ b/src/lsptoolshost/server/serverCommands.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { UriConverter } from '../utils/uriConverter'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { UriConverter } from '../utils/uriConverter.ts'; import * as languageClient from 'vscode-languageclient'; /** diff --git a/src/lsptoolshost/serviceBroker/brokeredServicesHosting.ts b/src/lsptoolshost/serviceBroker/brokeredServicesHosting.ts index f0da662abc..791ac804d6 100644 --- a/src/lsptoolshost/serviceBroker/brokeredServicesHosting.ts +++ b/src/lsptoolshost/serviceBroker/brokeredServicesHosting.ts @@ -11,7 +11,7 @@ import { ServiceMoniker, ServiceRegistration, } from '@microsoft/servicehub-framework'; -import Descriptors from '../solutionSnapshot/descriptors'; +import Descriptors from '../solutionSnapshot/descriptors.ts'; export class CSharpExtensionServiceBroker extends GlobalBrokeredServiceContainer { registerExternalServices(...monikers: ServiceMoniker[]) { diff --git a/src/lsptoolshost/solutionSnapshot/solutionSnapshotProvider.ts b/src/lsptoolshost/solutionSnapshot/solutionSnapshotProvider.ts index f346bed7ac..414d8425e2 100644 --- a/src/lsptoolshost/solutionSnapshot/solutionSnapshotProvider.ts +++ b/src/lsptoolshost/solutionSnapshot/solutionSnapshotProvider.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { ISolutionSnapshotProvider, SolutionSnapshotId } from './ISolutionSnapshotProvider'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { ISolutionSnapshotProvider, SolutionSnapshotId } from './ISolutionSnapshotProvider.ts'; /** * Brokered service implementation. diff --git a/src/lsptoolshost/testing/unitTesting.ts b/src/lsptoolshost/testing/unitTesting.ts index f6a396ba02..6a4cbf0773 100644 --- a/src/lsptoolshost/testing/unitTesting.ts +++ b/src/lsptoolshost/testing/unitTesting.ts @@ -7,12 +7,12 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import * as languageClient from 'vscode-languageclient'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { RunTestsParams, RunTestsPartialResult, RunTestsRequest, TestProgress } from '../server/roslynProtocol'; -import { commonOptions } from '../../shared/options'; -import { UriConverter } from '../utils/uriConverter'; -import { showErrorMessage } from '../../shared/observers/utils/showMessage'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { RunTestsParams, RunTestsPartialResult, RunTestsRequest, TestProgress } from '../server/roslynProtocol.ts'; +import { commonOptions } from '../../shared/options.ts'; +import { UriConverter } from '../utils/uriConverter.ts'; +import { showErrorMessage } from '../../shared/observers/utils/showMessage.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; export function registerUnitTestingCommands(context: vscode.ExtensionContext, languageServer: RoslynLanguageServer) { if (getCSharpDevKit()) { diff --git a/src/lsptoolshost/workspace/miscellaneousFileNotifier.ts b/src/lsptoolshost/workspace/miscellaneousFileNotifier.ts index d1c5833328..ad153e7f57 100644 --- a/src/lsptoolshost/workspace/miscellaneousFileNotifier.ts +++ b/src/lsptoolshost/workspace/miscellaneousFileNotifier.ts @@ -5,10 +5,10 @@ import * as vscode from 'vscode'; import * as crypto from 'crypto'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { ActionOption, showWarningMessage } from '../../shared/observers/utils/showMessage'; -import { languageServerOptions } from '../../shared/options'; -import { ServerState } from '../server/languageServerEvents'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { ActionOption, showWarningMessage } from '../../shared/observers/utils/showMessage.ts'; +import { languageServerOptions } from '../../shared/options.ts'; +import { ServerState } from '../server/languageServerEvents.ts'; const SuppressMiscellaneousFilesToastsOption = 'dotnet.server.suppressMiscellaneousFilesToasts'; const NotifiedDocuments = new Set(); diff --git a/src/lsptoolshost/workspace/workspaceCommands.ts b/src/lsptoolshost/workspace/workspaceCommands.ts index 73ee7764d1..016ed71651 100644 --- a/src/lsptoolshost/workspace/workspaceCommands.ts +++ b/src/lsptoolshost/workspace/workspaceCommands.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServer } from '../server/roslynLanguageServer'; -import { createLaunchTargetForSolution } from '../../shared/launchTarget'; -import { getCSharpDevKit } from '../../utils/getCSharpDevKit'; +import { RoslynLanguageServer } from '../server/roslynLanguageServer.ts'; +import { createLaunchTargetForSolution } from '../../shared/launchTarget.ts'; +import { getCSharpDevKit } from '../../utils/getCSharpDevKit.ts'; /** * Register commands that drive the workspace. diff --git a/src/lsptoolshost/workspace/workspaceStatus.ts b/src/lsptoolshost/workspace/workspaceStatus.ts index f23c81f9d3..15e02e2644 100644 --- a/src/lsptoolshost/workspace/workspaceStatus.ts +++ b/src/lsptoolshost/workspace/workspaceStatus.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RoslynLanguageServerEvents, ServerState } from '../server/languageServerEvents'; -import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors'; -import { languageServerOptions } from '../../shared/options'; +import { RoslynLanguageServerEvents, ServerState } from '../server/languageServerEvents.ts'; +import { combineDocumentSelectors } from '../../shared/utils/combineDocumentSelectors.ts'; +import { languageServerOptions } from '../../shared/options.ts'; export class WorkspaceStatus { static createStatusItem(context: vscode.ExtensionContext, languageServerEvents: RoslynLanguageServerEvents) { diff --git a/src/main.ts b/src/main.ts index 8d81e8327b..00b660b67a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,30 +3,34 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as coreclrdebug from './coreclrDebug/activate'; -import * as util from './common'; +import * as coreclrdebug from './coreclrDebug/activate.ts'; +import * as util from './common.ts'; import * as vscode from 'vscode'; -import { ActivationFailure } from './shared/loggingEvents'; -import { CsharpChannelObserver } from './shared/observers/csharpChannelObserver'; -import { CsharpLoggerObserver } from './shared/observers/csharpLoggerObserver'; -import { EventStream } from './eventStream'; -import { PlatformInformation } from './shared/platform'; -import TelemetryReporter from '@vscode/extension-telemetry'; -import { vscodeNetworkSettingsProvider } from './networkSettings'; -import createOptionStream from './shared/observables/createOptionStream'; -import { AbsolutePathPackage } from './packageManager/absolutePathPackage'; -import { IInstallDependencies } from './packageManager/IInstallDependencies'; -import { installRuntimeDependencies } from './installRuntimeDependencies'; -import { MigrateOptions } from './shared/migrateOptions'; -import { CSharpExtensionExports, LimitedExtensionExports, OmnisharpExtensionExports } from './csharpExtensionExports'; -import { getCSharpDevKit } from './utils/getCSharpDevKit'; -import { commonOptions, omnisharpOptions } from './shared/options'; -import { TelemetryEventNames } from './shared/telemetryEventNames'; -import { checkDotNetRuntimeExtensionVersion } from './checkDotNetRuntimeExtensionVersion'; -import { checkIsSupportedPlatform } from './checkSupportedPlatform'; -import { activateRoslyn } from './activateRoslyn'; -import { LimitedActivationStatus } from './shared/limitedActivationStatus'; +import { ActivationFailure } from './shared/loggingEvents.ts'; +import { CsharpChannelObserver } from './shared/observers/csharpChannelObserver.ts'; +import { CsharpLoggerObserver } from './shared/observers/csharpLoggerObserver.ts'; +import { EventStream } from './eventStream.ts'; +import { PlatformInformation } from './shared/platform.ts'; +import { TelemetryReporter } from '@vscode/extension-telemetry'; +import { vscodeNetworkSettingsProvider } from './networkSettings.ts'; +import createOptionStream from './shared/observables/createOptionStream.ts'; +import { AbsolutePathPackage } from './packageManager/absolutePathPackage.ts'; +import { IInstallDependencies } from './packageManager/IInstallDependencies.ts'; +import { installRuntimeDependencies } from './installRuntimeDependencies.ts'; +import { MigrateOptions } from './shared/migrateOptions.ts'; +import { + CSharpExtensionExports, + LimitedExtensionExports, + OmnisharpExtensionExports, +} from './csharpExtensionExports.ts'; +import { getCSharpDevKit } from './utils/getCSharpDevKit.ts'; +import { commonOptions, omnisharpOptions } from './shared/options.ts'; +import { TelemetryEventNames } from './shared/telemetryEventNames.ts'; +import { checkDotNetRuntimeExtensionVersion } from './checkDotNetRuntimeExtensionVersion.ts'; +import { checkIsSupportedPlatform } from './checkSupportedPlatform.ts'; +import { activateRoslyn } from './activateRoslyn.ts'; +import { LimitedActivationStatus } from './shared/limitedActivationStatus.ts'; export async function activate( context: vscode.ExtensionContext @@ -85,8 +89,8 @@ export async function activate( const installDependencies: IInstallDependencies = async (dependencies: AbsolutePathPackage[]) => { // Defer loading the download/zip stack (yauzl, proxy agents, fs-extra, etc.) until a // component actually needs to be downloaded, which normally never happens after install. - const { downloadAndInstallPackages } = await import('./packageManager/downloadAndInstallPackages'); - const { isValidDownload } = await import('./packageManager/isValidDownload'); + const { downloadAndInstallPackages } = await import('./packageManager/downloadAndInstallPackages.ts'); + const { isValidDownload } = await import('./packageManager/isValidDownload.ts'); return downloadAndInstallPackages( dependencies, networkSettingsProvider, @@ -152,7 +156,7 @@ export async function activate( } else { // Defer loading the OmniSharp implementation and its module graph until we actually // activate it, so the default Roslyn activations don't pay to compile/execute it. - const { activateOmniSharp } = await import('./activateOmniSharp'); + const { activateOmniSharp } = await import('./activateOmniSharp.ts'); exports = activateOmniSharp( context, platformInfo, diff --git a/src/networkSettings.ts b/src/networkSettings.ts index f94e0b5f23..835171d774 100644 --- a/src/networkSettings.ts +++ b/src/networkSettings.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { vscode } from './vscodeAdapter'; +import { vscode } from './vscodeAdapter.ts'; export default class NetworkSettings { constructor( diff --git a/src/omnisharp/dotnetResolver.ts b/src/omnisharp/dotnetResolver.ts index 741f42254e..c8c15a6197 100644 --- a/src/omnisharp/dotnetResolver.ts +++ b/src/omnisharp/dotnetResolver.ts @@ -7,10 +7,10 @@ import { exec } from 'child_process'; import * as path from 'path'; import * as semver from 'semver'; import { promisify } from 'util'; -import { HostExecutableInformation } from '../shared/constants/hostExecutableInformation'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; -import { PlatformInformation } from '../shared/platform'; -import { omnisharpOptions } from '../shared/options'; +import { HostExecutableInformation } from '../shared/constants/hostExecutableInformation.ts'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; +import { PlatformInformation } from '../shared/platform.ts'; +import { omnisharpOptions } from '../shared/options.ts'; export class DotnetResolver implements IHostExecutableResolver { private readonly minimumDotnetVersion = '6.0.100'; diff --git a/src/omnisharp/engines/IEngine.ts b/src/omnisharp/engines/IEngine.ts index 48affd1778..c300ce48f4 100644 --- a/src/omnisharp/engines/IEngine.ts +++ b/src/omnisharp/engines/IEngine.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CancellationToken } from '../../vscodeAdapter'; -import { LaunchTarget } from '../../shared/launchTarget'; -import Disposable from '../../disposable'; -import { OmniSharpServer } from '../server'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { Advisor } from '../features/diagnosticsProvider'; -import TestManager from '../features/dotnetTest'; -import { EventStream } from '../../eventStream'; +import { CancellationToken } from '../../vscodeAdapter.ts'; +import { LaunchTarget } from '../../shared/launchTarget.ts'; +import Disposable from '../../disposable.ts'; +import { OmniSharpServer } from '../server.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { Advisor } from '../features/diagnosticsProvider.ts'; +import TestManager from '../features/dotnetTest.ts'; +import { EventStream } from '../../eventStream.ts'; export interface IEngine { start(cwd: string, args: string[], launchTarget: LaunchTarget, launchPath: string): Promise; diff --git a/src/omnisharp/engines/lspEngine.ts b/src/omnisharp/engines/lspEngine.ts index 793d542ac9..ad06c865d7 100644 --- a/src/omnisharp/engines/lspEngine.ts +++ b/src/omnisharp/engines/lspEngine.ts @@ -3,37 +3,43 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from '../protocol'; -import { CancellationToken } from '../../vscodeAdapter'; -import { configure } from '../launcher'; -import { LaunchTarget } from '../../shared/launchTarget'; +import * as protocol from '../protocol.ts'; +import { CancellationToken } from '../../vscodeAdapter.ts'; +import { configure } from '../launcher.ts'; +import { LaunchTarget } from '../../shared/launchTarget.ts'; import { EventEmitter } from 'events'; import { setTimeout } from 'timers'; -import * as ObservableEvents from '../omnisharpLoggingEvents'; -import { EventStream } from '../../eventStream'; -import CompositeDisposable from '../../compositeDisposable'; -import Disposable from '../../disposable'; +import * as ObservableEvents from '../omnisharpLoggingEvents.ts'; +import { EventStream } from '../../eventStream.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import Disposable from '../../disposable.ts'; import { ExtensionContext, CancellationTokenSource, LogOutputChannel, Location, CodeLens, Uri } from 'vscode'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { Events, OmniSharpServer } from '../server'; -import { IEngine } from './IEngine'; -import { PlatformInformation } from '../../shared/platform'; -import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver'; -import { Command, RequestType, Trace } from 'vscode-languageclient'; -import { DynamicFeature, LanguageClientOptions, StaticFeature } from 'vscode-languageclient'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { Events, OmniSharpServer } from '../server.ts'; +import { IEngine } from './IEngine.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver.ts'; +import { + CallHierarchyPrepareRequest, + Command, + DeclarationRequest, + DidChangeWorkspaceFoldersNotification, + DocumentColorRequest, + DocumentDiagnosticRequest, + DocumentLinkRequest, + DynamicFeature, + InlineValueRequest, + LanguageClientOptions, + NotebookDocumentSyncRegistrationType, + RequestType, + SelectionRangeRequest, + StaticFeature, + Trace, + TypeHierarchyPrepareRequest, +} from 'vscode-languageclient'; import { LanguageClient, ServerOptions } from 'vscode-languageclient/node'; -import { SelectionRangeFeature } from 'vscode-languageclient/selectionRange'; -import { ColorProviderFeature } from 'vscode-languageclient/colorProvider'; -import { WorkspaceFoldersFeature } from 'vscode-languageclient/workspaceFolder'; -import { DeclarationFeature } from 'vscode-languageclient/declaration'; -import { DocumentLinkFeature } from 'vscode-languageclient/documentLink'; -import { InlineValueFeature } from 'vscode-languageclient/inlineValue'; -import { DiagnosticFeature } from 'vscode-languageclient/diagnostic'; -import { NotebookDocumentSyncFeature } from 'vscode-languageclient/notebook'; -import { TypeHierarchyFeature } from 'vscode-languageclient/typeHierarchy'; -import { CallHierarchyFeature } from 'vscode-languageclient/callHierarchy'; -import { Advisor } from '../features/diagnosticsProvider'; -import dotnetTest from '../features/dotnetTest'; +import { Advisor } from '../features/diagnosticsProvider.ts'; +import dotnetTest from '../features/dotnetTest.ts'; export class LspEngine implements IEngine { client: LanguageClient | undefined; @@ -246,41 +252,44 @@ export class LspEngine implements IEngine { // The goal here is to disable all the features and light them up over time. const features: (StaticFeature | DynamicFeature)[] = (client as any)._features; - function disableFeature(ctor: { new (...args: any[]): StaticFeature | DynamicFeature }): void { - const index = features.findIndex((z) => z instanceof ctor); + function disableFeature(featureId: string): void { + const index = features.findIndex((feature) => { + const state = feature.getState(); + return state.kind !== 'static' && state.id === featureId; + }); if (index > -1) { features.splice(index, 1); } } - disableFeature(CallHierarchyFeature); // Not implemented in O# + disableFeature(CallHierarchyPrepareRequest.method); // Not implemented in O# //disableFeature(CodeActionFeature); //disableFeature(CodeLensFeature); // Only supports Reference codelens at this time. Does not support Run/Debug Test codelens. - disableFeature(ColorProviderFeature); // Not implemented in O# + disableFeature(DocumentColorRequest.method); // Not implemented in O# //disableFeature(CompletionItemFeature); - disableFeature(DeclarationFeature); // Not implemented in O# + disableFeature(DeclarationRequest.method); // Not implemented in O# //disableFeature(DefinitionFeature); // Needs metadata document/source generated document support - disableFeature(DiagnosticFeature); + disableFeature(DocumentDiagnosticRequest.method); //disableFeature(DocumentFormattingFeature); //disableFeature(DocumentRangeFormattingFeature); //disableFeature(DocumentOnTypeFormattingFeature); // This feature does not seem to be triggering //disableFeature(DocumentHighlightFeature); - disableFeature(DocumentLinkFeature); // Not implemented in O# + disableFeature(DocumentLinkRequest.method); // Not implemented in O# //disableFeature(DocumentSymbolFeature); //disableFeature(FoldingRangeFeature); //disableFeature(HoverFeature); // This feature does not always seem to be working. Wonder if requests are coming in too early. //disableFeature(ImplementationFeature); // Needs metadata document/source generated document support //disableFeature(InlayHintsFeature); // The csharp-language-server-protocol library needs to update with 3.17 changes - disableFeature(InlineValueFeature); // Not implemented in O# - disableFeature(NotebookDocumentSyncFeature); // Not implemented in O# + disableFeature(InlineValueRequest.method); // Not implemented in O# + disableFeature(NotebookDocumentSyncRegistrationType.method); // Not implemented in O# //disableFeature(ReferencesFeature); // Needs metadata document/source generated document support //disableFeature(RenameFeature); - disableFeature(SelectionRangeFeature); // Not implemented in O# + disableFeature(SelectionRangeRequest.method); // Not implemented in O# //disableFeature(SemanticTokensFeature); // This feature does not always seem to be working. Wonder if requests are coming in too early. //disableFeature(SignatureHelpFeature); //disableFeature(TypeDefinitionFeature); // Needs metadata document/source generated document support - disableFeature(TypeHierarchyFeature); // Not implemented in O# - disableFeature(WorkspaceFoldersFeature); // Not implemented in O# + disableFeature(TypeHierarchyPrepareRequest.method); // Not implemented in O# + disableFeature(DidChangeWorkspaceFoldersNotification.method); // Not implemented in O# //disableFeature(WorkspaceSymbolFeature); const interopFeature = this.createInteropFeature(client); diff --git a/src/omnisharp/engines/stdioEngine.ts b/src/omnisharp/engines/stdioEngine.ts index 5fa9640d8e..63718ac9a0 100644 --- a/src/omnisharp/engines/stdioEngine.ts +++ b/src/omnisharp/engines/stdioEngine.ts @@ -3,52 +3,52 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from '../protocol'; -import * as utils from '../../common'; -import { CancellationToken } from '../../vscodeAdapter'; +import * as protocol from '../protocol.ts'; +import * as utils from '../../common.ts'; +import { CancellationToken } from '../../vscodeAdapter.ts'; import { ChildProcess, exec } from 'child_process'; -import { LaunchTarget } from '../../shared/launchTarget'; +import { LaunchTarget } from '../../shared/launchTarget.ts'; import { ReadLine, createInterface } from 'readline'; -import { Request, RequestQueueCollection } from '../requestQueue'; +import { Request, RequestQueueCollection } from '../requestQueue.ts'; import { EventEmitter } from 'events'; -import { omnisharpOptions } from '../../shared/options'; -import { PlatformInformation } from '../../shared/platform'; -import { launchOmniSharp } from '../launcher'; +import { omnisharpOptions } from '../../shared/options.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { launchOmniSharp } from '../launcher.ts'; import { setTimeout } from 'timers'; -import * as ObservableEvents from '../omnisharpLoggingEvents'; -import { EventStream } from '../../eventStream'; -import CompositeDisposable from '../../compositeDisposable'; -import Disposable from '../../disposable'; -import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver'; -import { removeBOMFromBuffer, removeBOMFromString } from '../../utils/removeBom'; -import { IEngine } from './IEngine'; -import { Events, OmniSharpServer } from '../server'; -import DefinitionMetadataDocumentProvider from '../features/definitionMetadataDocumentProvider'; -import SourceGeneratedDocumentProvider from '../features/sourceGeneratedDocumentProvider'; +import * as ObservableEvents from '../omnisharpLoggingEvents.ts'; +import { EventStream } from '../../eventStream.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import Disposable from '../../disposable.ts'; +import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver.ts'; +import { removeBOMFromBuffer, removeBOMFromString } from '../../utils/removeBom.ts'; +import { IEngine } from './IEngine.ts'; +import { Events, OmniSharpServer } from '../server.ts'; +import DefinitionMetadataDocumentProvider from '../features/definitionMetadataDocumentProvider.ts'; +import SourceGeneratedDocumentProvider from '../features/sourceGeneratedDocumentProvider.ts'; import * as vscode from 'vscode'; -import OmniSharpCodeLensProvider from '../features/codeLensProvider'; -import OmniSharpDocumentHighlightProvider from '../features/documentHighlightProvider'; -import OmniSharpDocumentSymbolProvider from '../features/documentSymbolProvider'; -import OmniSharpHoverProvider from '../features/hoverProvider'; -import OmniSharpRenameProvider from '../features/renameProvider'; -import OmniSharpFormatProvider from '../features/formattingEditProvider'; -import OmniSharpWorkspaceSymbolProvider from '../features/workspaceSymbolProvider'; -import OmniSharpSignatureHelpProvider from '../features/signatureHelpProvider'; -import { OmniSharpFixAllProvider } from '../features/fixAllProvider'; -import OmniSharpCompletionProvider, { CompletionAfterInsertCommand } from '../features/completionProvider'; -import OmniSharpReferenceProvider from '../features/referenceProvider'; -import OmniSharpImplementationProvider from '../features/implementationProvider'; -import OmniSharpSemanticTokensProvider from '../features/semanticTokensProvider'; -import OmniSharpInlayHintProvider from '../features/inlayHintProvider'; -import fileOpenClose from '../features/fileOpenCloseProvider'; -import trackVirtualDocuments from '../features/virtualDocumentTracker'; -import OmniSharpCodeActionProvider from '../features/codeActionProvider'; -import forwardChanges from '../features/changeForwarding'; -import OmniSharpDefinitionProvider from '../features/definitionProvider'; -import reportDiagnostics, { Advisor } from '../features/diagnosticsProvider'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import TestManager from '../features/dotnetTest'; -import { OmniSharpStructureProvider } from '../features/structureProvider'; +import OmniSharpCodeLensProvider from '../features/codeLensProvider.ts'; +import OmniSharpDocumentHighlightProvider from '../features/documentHighlightProvider.ts'; +import OmniSharpDocumentSymbolProvider from '../features/documentSymbolProvider.ts'; +import OmniSharpHoverProvider from '../features/hoverProvider.ts'; +import OmniSharpRenameProvider from '../features/renameProvider.ts'; +import OmniSharpFormatProvider from '../features/formattingEditProvider.ts'; +import OmniSharpWorkspaceSymbolProvider from '../features/workspaceSymbolProvider.ts'; +import OmniSharpSignatureHelpProvider from '../features/signatureHelpProvider.ts'; +import { OmniSharpFixAllProvider } from '../features/fixAllProvider.ts'; +import OmniSharpCompletionProvider, { CompletionAfterInsertCommand } from '../features/completionProvider.ts'; +import OmniSharpReferenceProvider from '../features/referenceProvider.ts'; +import OmniSharpImplementationProvider from '../features/implementationProvider.ts'; +import OmniSharpSemanticTokensProvider from '../features/semanticTokensProvider.ts'; +import OmniSharpInlayHintProvider from '../features/inlayHintProvider.ts'; +import fileOpenClose from '../features/fileOpenCloseProvider.ts'; +import trackVirtualDocuments from '../features/virtualDocumentTracker.ts'; +import OmniSharpCodeActionProvider from '../features/codeActionProvider.ts'; +import forwardChanges from '../features/changeForwarding.ts'; +import OmniSharpDefinitionProvider from '../features/definitionProvider.ts'; +import reportDiagnostics, { Advisor } from '../features/diagnosticsProvider.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import TestManager from '../features/dotnetTest.ts'; +import { OmniSharpStructureProvider } from '../features/structureProvider.ts'; export class StdioEngine implements IEngine { private static _nextId = 1; diff --git a/src/omnisharp/features/abstractProvider.ts b/src/omnisharp/features/abstractProvider.ts index 02ae33c313..6f1a7df1f6 100644 --- a/src/omnisharp/features/abstractProvider.ts +++ b/src/omnisharp/features/abstractProvider.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { OmniSharpServer } from '../server'; -import CompositeDisposable from '../../compositeDisposable'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; +import { OmniSharpServer } from '../server.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; export default abstract class AbstractProvider { protected _server: OmniSharpServer; diff --git a/src/omnisharp/features/changeForwarding.ts b/src/omnisharp/features/changeForwarding.ts index b07394c43b..85bfe3dfbc 100644 --- a/src/omnisharp/features/changeForwarding.ts +++ b/src/omnisharp/features/changeForwarding.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { Uri, workspace } from 'vscode'; -import { OmniSharpServer } from '../server'; -import * as serverUtils from '../utils'; -import { FileChangeType } from '../protocol'; -import { IDisposable } from '../../disposable'; -import CompositeDisposable from '../../compositeDisposable'; +import { OmniSharpServer } from '../server.ts'; +import * as serverUtils from '../utils.ts'; +import { FileChangeType } from '../protocol.ts'; +import { IDisposable } from '../../disposable.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; function forwardDocumentChanges(server: OmniSharpServer): IDisposable { return workspace.onDidChangeTextDocument((event) => { diff --git a/src/omnisharp/features/codeActionProvider.ts b/src/omnisharp/features/codeActionProvider.ts index 736457a937..fa14632369 100644 --- a/src/omnisharp/features/codeActionProvider.ts +++ b/src/omnisharp/features/codeActionProvider.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { OmniSharpServer } from '../server'; -import AbstractProvider from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import CompositeDisposable from '../../compositeDisposable'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { buildEditForResponse } from '../fileOperationsResponseEditBuilder'; -import { omnisharpOptions } from '../../shared/options'; +import { OmniSharpServer } from '../server.ts'; +import AbstractProvider from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { buildEditForResponse } from '../fileOperationsResponseEditBuilder.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; export default class OmniSharpCodeActionProvider extends AbstractProvider diff --git a/src/omnisharp/features/codeLensProvider.ts b/src/omnisharp/features/codeLensProvider.ts index be46b9bf63..9d7900623d 100644 --- a/src/omnisharp/features/codeLensProvider.ts +++ b/src/omnisharp/features/codeLensProvider.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; import * as vscode from 'vscode'; -import { toLocation } from '../typeConversion'; -import AbstractProvider from './abstractProvider'; -import { OmniSharpServer } from '../server'; -import { omnisharpOptions } from '../../shared/options'; -import TestManager from './dotnetTest'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; +import { toLocation } from '../typeConversion.ts'; +import AbstractProvider from './abstractProvider.ts'; +import { OmniSharpServer } from '../server.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; +import TestManager from './dotnetTest.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; import Structure = protocol.V2.Structure; import SymbolKinds = protocol.V2.SymbolKinds; diff --git a/src/omnisharp/features/commands.ts b/src/omnisharp/features/commands.ts index 8f26d58031..6f610dfcf3 100644 --- a/src/omnisharp/features/commands.ts +++ b/src/omnisharp/features/commands.ts @@ -3,30 +3,30 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { OmniSharpServer } from '../server'; -import * as serverUtils from '../utils'; -import { findLaunchTargets } from '../launcher'; -import { LaunchTarget } from '../../shared/launchTarget'; +import { OmniSharpServer } from '../server.ts'; +import * as serverUtils from '../utils.ts'; +import { findLaunchTargets } from '../launcher.ts'; +import { LaunchTarget } from '../../shared/launchTarget.ts'; import * as cp from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; -import * as protocol from '../protocol'; +import * as protocol from '../protocol.ts'; import * as vscode from 'vscode'; -import { generateAssets } from '../../shared/assets'; +import { generateAssets } from '../../shared/assets.ts'; import { ShowOmniSharpChannel, CommandDotNetRestoreStart, CommandDotNetRestoreProgress, CommandDotNetRestoreSucceeded, CommandDotNetRestoreFailed, -} from '../omnisharpLoggingEvents'; -import { EventStream } from '../../eventStream'; -import { PlatformInformation } from '../../shared/platform'; -import CompositeDisposable from '../../compositeDisposable'; -import reportIssue from '../../shared/reportIssue'; -import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver'; -import { getDotnetInfo } from '../../shared/utils/getDotnetInfo'; -import { IWorkspaceDebugInformationProvider } from '../../shared/IWorkspaceDebugInformationProvider'; +} from '../omnisharpLoggingEvents.ts'; +import { EventStream } from '../../eventStream.ts'; +import { PlatformInformation } from '../../shared/platform.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import reportIssue from '../../shared/reportIssue.ts'; +import { IHostExecutableResolver } from '../../shared/constants/IHostExecutableResolver.ts'; +import { getDotnetInfo } from '../../shared/utils/getDotnetInfo.ts'; +import { IWorkspaceDebugInformationProvider } from '../../shared/IWorkspaceDebugInformationProvider.ts'; export default function registerCommands( context: vscode.ExtensionContext, diff --git a/src/omnisharp/features/completionProvider.ts b/src/omnisharp/features/completionProvider.ts index 14ea102e35..d3e3b8e6f6 100644 --- a/src/omnisharp/features/completionProvider.ts +++ b/src/omnisharp/features/completionProvider.ts @@ -20,18 +20,18 @@ import { workspace, CompletionItemLabel, } from 'vscode'; -import AbstractProvider from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; +import AbstractProvider from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; import { CompletionTriggerKind as LspCompletionTriggerKind, InsertTextFormat, CancellationToken, } from 'vscode-languageclient'; -import { createRequest } from '../typeConversion'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { OmniSharpServer } from '../server'; -import { isVirtualCSharpDocument } from './virtualDocumentTracker'; +import { createRequest } from '../typeConversion.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { OmniSharpServer } from '../server.ts'; +import { isVirtualCSharpDocument } from './virtualDocumentTracker.ts'; export const CompletionAfterInsertCommand = 'csharp.completion.afterInsert'; diff --git a/src/omnisharp/features/definitionMetadataDocumentProvider.ts b/src/omnisharp/features/definitionMetadataDocumentProvider.ts index 3762554102..a795df57ec 100644 --- a/src/omnisharp/features/definitionMetadataDocumentProvider.ts +++ b/src/omnisharp/features/definitionMetadataDocumentProvider.ts @@ -1,60 +1,60 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { TextDocument, TextDocumentContentProvider, Uri, workspace } from 'vscode'; -import { MetadataResponse } from '../protocol'; -import { IDisposable } from '../../disposable'; - -export default class DefinitionMetadataDocumentProvider implements TextDocumentContentProvider, IDisposable { - readonly scheme = 'omnisharp-metadata'; - private _registration?: IDisposable; - private _documents: Map; - private _documentClosedSubscription: IDisposable; - - constructor() { - this._documents = new Map(); - this._documentClosedSubscription = workspace.onDidCloseTextDocument(this.onTextDocumentClosed, this); - } - - private onTextDocumentClosed(document: TextDocument): void { - this._documents.delete(document.uri.toString()); - } - - public dispose(): void { - this._registration?.dispose(); - this._documentClosedSubscription.dispose(); - this._documents.clear(); - } - - public addMetadataResponse(metadataResponse: MetadataResponse): Uri { - const uri = this.createUri(metadataResponse.SourceName); - this._documents.set(uri.toString(), metadataResponse); - - return uri; - } - - public getExistingMetadataResponseUri(sourceName: string): Uri { - return this.createUri(sourceName); - } - - public hasMetadataDocument(sourceName: string): boolean { - const uri = this.createUri(sourceName); - return this._documents.has(uri.toString()); - } - - public register(): void { - this._registration = workspace.registerTextDocumentContentProvider(this.scheme, this); - } - - public provideTextDocumentContent(uri: Uri): string | undefined { - return this._documents.get(uri.toString())?.Source; - } - - private createUri(sourceName: string): Uri { - return Uri.parse( - this.scheme + '://' + sourceName.replace(/\\/g, '/').replace(/(.*)\/(.*)/g, '$1/[metadata] $2') - ); - } -} +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { TextDocument, TextDocumentContentProvider, Uri, workspace } from 'vscode'; +import { MetadataResponse } from '../protocol.ts'; +import { IDisposable } from '../../disposable.ts'; + +export default class DefinitionMetadataDocumentProvider implements TextDocumentContentProvider, IDisposable { + readonly scheme = 'omnisharp-metadata'; + private _registration?: IDisposable; + private _documents: Map; + private _documentClosedSubscription: IDisposable; + + constructor() { + this._documents = new Map(); + this._documentClosedSubscription = workspace.onDidCloseTextDocument(this.onTextDocumentClosed, this); + } + + private onTextDocumentClosed(document: TextDocument): void { + this._documents.delete(document.uri.toString()); + } + + public dispose(): void { + this._registration?.dispose(); + this._documentClosedSubscription.dispose(); + this._documents.clear(); + } + + public addMetadataResponse(metadataResponse: MetadataResponse): Uri { + const uri = this.createUri(metadataResponse.SourceName); + this._documents.set(uri.toString(), metadataResponse); + + return uri; + } + + public getExistingMetadataResponseUri(sourceName: string): Uri { + return this.createUri(sourceName); + } + + public hasMetadataDocument(sourceName: string): boolean { + const uri = this.createUri(sourceName); + return this._documents.has(uri.toString()); + } + + public register(): void { + this._registration = workspace.registerTextDocumentContentProvider(this.scheme, this); + } + + public provideTextDocumentContent(uri: Uri): string | undefined { + return this._documents.get(uri.toString())?.Source; + } + + private createUri(sourceName: string): Uri { + return Uri.parse( + this.scheme + '://' + sourceName.replace(/\\/g, '/').replace(/(.*)\/(.*)/g, '$1/[metadata] $2') + ); + } +} diff --git a/src/omnisharp/features/definitionProvider.ts b/src/omnisharp/features/definitionProvider.ts index a57ceb5921..84102cd5e0 100644 --- a/src/omnisharp/features/definitionProvider.ts +++ b/src/omnisharp/features/definitionProvider.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as serverUtils from '../utils'; +import * as serverUtils from '../utils.ts'; import { CancellationToken, TypeDefinitionProvider, @@ -19,13 +19,13 @@ import { MetadataRequest, MetadataSource, V2, -} from '../protocol'; -import { createRequest, toRange3, toVscodeLocation } from '../typeConversion'; -import AbstractSupport from './abstractProvider'; -import DefinitionMetadataOrSourceGeneratedDocumentProvider from './definitionMetadataDocumentProvider'; -import { OmniSharpServer } from '../server'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider'; +} from '../protocol.ts'; +import { createRequest, toRange3, toVscodeLocation } from '../typeConversion.ts'; +import AbstractSupport from './abstractProvider.ts'; +import DefinitionMetadataOrSourceGeneratedDocumentProvider from './definitionMetadataDocumentProvider.ts'; +import { OmniSharpServer } from '../server.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider.ts'; export default class OmniSharpDefinitionProvider extends AbstractSupport diff --git a/src/omnisharp/features/diagnosticsProvider.ts b/src/omnisharp/features/diagnosticsProvider.ts index 2d31cbb0d8..ff494805be 100644 --- a/src/omnisharp/features/diagnosticsProvider.ts +++ b/src/omnisharp/features/diagnosticsProvider.ts @@ -3,21 +3,21 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { OmniSharpServer } from '../server'; -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { toRange } from '../typeConversion'; +import { OmniSharpServer } from '../server.ts'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { toRange } from '../typeConversion.ts'; import * as vscode from 'vscode'; -import CompositeDisposable from '../../compositeDisposable'; -import { IDisposable } from '../../disposable'; -import { isVirtualCSharpDocument } from './virtualDocumentTracker'; -import { TextDocument } from '../../vscodeAdapter'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { IDisposable } from '../../disposable.ts'; +import { isVirtualCSharpDocument } from './virtualDocumentTracker.ts'; +import { TextDocument } from '../../vscodeAdapter.ts'; import { Subject, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; -import { BackgroundDiagnosticStatus } from '../protocol'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { omnisharpOptions } from '../../shared/options'; +import { BackgroundDiagnosticStatus } from '../protocol.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; export class Advisor { private _disposable: CompositeDisposable; diff --git a/src/omnisharp/features/documentHighlightProvider.ts b/src/omnisharp/features/documentHighlightProvider.ts index f93d1fcf8f..25446357fb 100644 --- a/src/omnisharp/features/documentHighlightProvider.ts +++ b/src/omnisharp/features/documentHighlightProvider.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest, toRange } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest, toRange } from '../typeConversion.ts'; import { DocumentHighlightProvider, DocumentHighlight, diff --git a/src/omnisharp/features/documentSymbolProvider.ts b/src/omnisharp/features/documentSymbolProvider.ts index 88bacf3b9f..d16a25a747 100644 --- a/src/omnisharp/features/documentSymbolProvider.ts +++ b/src/omnisharp/features/documentSymbolProvider.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; import * as vscode from 'vscode'; import Structure = protocol.V2.Structure; import SymbolKinds = protocol.V2.SymbolKinds; import SymbolRangeNames = protocol.V2.SymbolRangeNames; -import { toRange3 } from '../typeConversion'; +import { toRange3 } from '../typeConversion.ts'; export default class OmniSharpDocumentSymbolProvider extends AbstractSupport implements vscode.DocumentSymbolProvider { async provideDocumentSymbols( diff --git a/src/omnisharp/features/documentation.ts b/src/omnisharp/features/documentation.ts index 9295367945..feb04c23c1 100644 --- a/src/omnisharp/features/documentation.ts +++ b/src/omnisharp/features/documentation.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from '../protocol'; +import * as protocol from '../protocol.ts'; const summaryStartTag = //i; const summaryEndTag = /<\/summary>/i; diff --git a/src/omnisharp/features/dotnetTest.ts b/src/omnisharp/features/dotnetTest.ts index c9e872d685..9307513b14 100644 --- a/src/omnisharp/features/dotnetTest.ts +++ b/src/omnisharp/features/dotnetTest.ts @@ -6,13 +6,13 @@ import * as net from 'net'; import * as os from 'os'; import * as path from 'path'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import * as utils from '../../common'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import * as utils from '../../common.ts'; import * as vscode from 'vscode'; -import AbstractProvider from './abstractProvider'; -import * as DebuggerEventsProtocol from '../../coreclrDebug/debuggerEventsProtocol'; -import { OmniSharpServer } from '../server'; +import AbstractProvider from './abstractProvider.ts'; +import * as DebuggerEventsProtocol from '../../coreclrDebug/debuggerEventsProtocol.ts'; +import { OmniSharpServer } from '../server.ts'; import { TestExecutionCountReport, ReportDotNetTestResults, @@ -28,13 +28,13 @@ import { DotNetTestDebugStartFailure, DotNetTestRunInContextStart, DotNetTestDebugInContextStart, -} from '../omnisharpLoggingEvents'; -import { EventStream } from '../../eventStream'; -import LaunchConfiguration from './launchConfiguration'; -import Disposable from '../../disposable'; -import CompositeDisposable from '../../compositeDisposable'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { commonOptions } from '../../shared/options'; +} from '../omnisharpLoggingEvents.ts'; +import { EventStream } from '../../eventStream.ts'; +import LaunchConfiguration from './launchConfiguration.ts'; +import Disposable from '../../disposable.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { commonOptions } from '../../shared/options.ts'; const TelemetryReportingDelay = 2 * 60 * 1000; // two minutes diff --git a/src/omnisharp/features/fileOpenCloseProvider.ts b/src/omnisharp/features/fileOpenCloseProvider.ts index 4600387020..d26f5802d8 100644 --- a/src/omnisharp/features/fileOpenCloseProvider.ts +++ b/src/omnisharp/features/fileOpenCloseProvider.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IDisposable } from '../../disposable'; -import { OmniSharpServer } from '../server'; +import { IDisposable } from '../../disposable.ts'; +import { OmniSharpServer } from '../server.ts'; import * as vscode from 'vscode'; -import CompositeDisposable from '../../compositeDisposable'; -import * as serverUtils from '../utils'; -import { isVirtualCSharpDocument } from './virtualDocumentTracker'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import * as serverUtils from '../utils.ts'; +import { isVirtualCSharpDocument } from './virtualDocumentTracker.ts'; export default function fileOpenClose(server: OmniSharpServer): IDisposable { return new FileOpenCloseProvider(server); diff --git a/src/omnisharp/features/fixAll.ts b/src/omnisharp/features/fixAll.ts index c932f814cc..920cf9ca7a 100644 --- a/src/omnisharp/features/fixAll.ts +++ b/src/omnisharp/features/fixAll.ts @@ -3,6 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractProvider from './abstractProvider'; +import AbstractProvider from './abstractProvider.ts'; export class FixAll extends AbstractProvider {} diff --git a/src/omnisharp/features/fixAllProvider.ts b/src/omnisharp/features/fixAllProvider.ts index 20d50d74ff..f9b6f3b1ee 100644 --- a/src/omnisharp/features/fixAllProvider.ts +++ b/src/omnisharp/features/fixAllProvider.ts @@ -4,15 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as serverUtils from '../utils'; -import * as protocol from '../protocol'; -import { OmniSharpServer } from '../server'; -import { FixAllScope, FixAllItem } from '../protocol'; -import CompositeDisposable from '../../compositeDisposable'; -import AbstractProvider from './abstractProvider'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { buildEditForResponse } from '../fileOperationsResponseEditBuilder'; -import { showWarningMessage } from '../../shared/observers/utils/showMessage'; +import * as serverUtils from '../utils.ts'; +import * as protocol from '../protocol.ts'; +import { OmniSharpServer } from '../server.ts'; +import { FixAllScope, FixAllItem } from '../protocol.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import AbstractProvider from './abstractProvider.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { buildEditForResponse } from '../fileOperationsResponseEditBuilder.ts'; +import { showWarningMessage } from '../../shared/observers/utils/showMessage.ts'; import { CancellationToken } from 'vscode-languageclient'; export class OmniSharpFixAllProvider extends AbstractProvider implements vscode.CodeActionProvider { diff --git a/src/omnisharp/features/formattingEditProvider.ts b/src/omnisharp/features/formattingEditProvider.ts index fc1145c025..cb9deb9e1d 100644 --- a/src/omnisharp/features/formattingEditProvider.ts +++ b/src/omnisharp/features/formattingEditProvider.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; import { DocumentRangeFormattingEditProvider, FormattingOptions, diff --git a/src/omnisharp/features/hoverProvider.ts b/src/omnisharp/features/hoverProvider.ts index 6c7f76ebeb..27b4512fcd 100644 --- a/src/omnisharp/features/hoverProvider.ts +++ b/src/omnisharp/features/hoverProvider.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest } from '../typeConversion.ts'; import { HoverProvider, Hover, TextDocument, CancellationToken, Position, MarkdownString } from 'vscode'; export default class OmniSharpHoverProvider extends AbstractSupport implements HoverProvider { diff --git a/src/omnisharp/features/implementationProvider.ts b/src/omnisharp/features/implementationProvider.ts index 1b6db10bc0..d89b2ec5a3 100644 --- a/src/omnisharp/features/implementationProvider.ts +++ b/src/omnisharp/features/implementationProvider.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import { FindImplementationsRequest } from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest, toLocation } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import { FindImplementationsRequest } from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest, toLocation } from '../typeConversion.ts'; import { TextDocument, Position, CancellationToken, ImplementationProvider, Definition } from 'vscode'; export default class OmniSharpImplementationProvider extends AbstractSupport implements ImplementationProvider { diff --git a/src/omnisharp/features/inlayHintProvider.ts b/src/omnisharp/features/inlayHintProvider.ts index d5f32a3f00..fc3ef4290f 100644 --- a/src/omnisharp/features/inlayHintProvider.ts +++ b/src/omnisharp/features/inlayHintProvider.ts @@ -2,20 +2,20 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as serverUtils from '../utils'; +import * as serverUtils from '../utils.ts'; import * as vscode from 'vscode'; -import AbstractProvider from './abstractProvider'; -import { OmniSharpServer } from '../server'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import CompositeDisposable from '../../compositeDisposable'; +import AbstractProvider from './abstractProvider.ts'; +import { OmniSharpServer } from '../server.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; import { InlayHint, InlayHintRequest, InlayHintResolve as InlayHintResolveRequest, LinePositionSpanTextChange, -} from '../protocol'; -import { fromVSCodeRange, toVSCodePosition, toVSCodeTextEdit } from '../typeConversion'; -import { isVirtualCSharpDocument } from './virtualDocumentTracker'; +} from '../protocol.ts'; +import { fromVSCodeRange, toVSCodePosition, toVSCodeTextEdit } from '../typeConversion.ts'; +import { isVirtualCSharpDocument } from './virtualDocumentTracker.ts'; export default class OmniSharpInlayHintProvider extends AbstractProvider implements vscode.InlayHintsProvider { private readonly _onDidChangeInlayHints = new vscode.EventEmitter(); diff --git a/src/omnisharp/features/referenceProvider.ts b/src/omnisharp/features/referenceProvider.ts index 275ccbdc64..fe64c64327 100644 --- a/src/omnisharp/features/referenceProvider.ts +++ b/src/omnisharp/features/referenceProvider.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest, toLocation, toLocationFromUri } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest, toLocation, toLocationFromUri } from '../typeConversion.ts'; import { ReferenceProvider, Location, TextDocument, CancellationToken, Position } from 'vscode'; -import { OmniSharpServer } from '../server'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider'; +import { OmniSharpServer } from '../server.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider.ts'; export default class OmniSharpReferenceProvider extends AbstractSupport implements ReferenceProvider { public constructor( diff --git a/src/omnisharp/features/renameProvider.ts b/src/omnisharp/features/renameProvider.ts index d0a0a347ba..7c14cc135e 100644 --- a/src/omnisharp/features/renameProvider.ts +++ b/src/omnisharp/features/renameProvider.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest } from '../typeConversion.ts'; import { RenameProvider, WorkspaceEdit, TextDocument, Uri, CancellationToken, Position, Range } from 'vscode'; export default class OmniSharpRenameProvider extends AbstractSupport implements RenameProvider { diff --git a/src/omnisharp/features/semanticTokensProvider.ts b/src/omnisharp/features/semanticTokensProvider.ts index d90749eca2..e5fbdab4db 100644 --- a/src/omnisharp/features/semanticTokensProvider.ts +++ b/src/omnisharp/features/semanticTokensProvider.ts @@ -5,13 +5,13 @@ import * as vscode from 'vscode'; import { SemanticTokenTypes } from 'vscode-languageclient'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { createRequest, toRange2 } from '../typeConversion'; -import AbstractProvider from './abstractProvider'; -import { OmniSharpServer } from '../server'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import { omnisharpOptions } from '../../shared/options'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest, toRange2 } from '../typeConversion.ts'; +import AbstractProvider from './abstractProvider.ts'; +import { OmniSharpServer } from '../server.ts'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; // The default TokenTypes defined by VS Code https://github.com/microsoft/vscode/blob/master/src/vs/platform/theme/common/tokenClassificationRegistry.ts#L393 enum DefaultTokenType { diff --git a/src/omnisharp/features/signatureHelpProvider.ts b/src/omnisharp/features/signatureHelpProvider.ts index 44791bf5a3..e081474cfc 100644 --- a/src/omnisharp/features/signatureHelpProvider.ts +++ b/src/omnisharp/features/signatureHelpProvider.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import AbstractSupport from './abstractProvider'; -import * as serverUtils from '../utils'; -import { createRequest } from '../typeConversion'; +import AbstractSupport from './abstractProvider.ts'; +import * as serverUtils from '../utils.ts'; +import { createRequest } from '../typeConversion.ts'; import { SignatureHelpProvider, SignatureHelp, @@ -16,7 +16,7 @@ import { Position, } from 'vscode'; import { MarkdownString } from 'vscode'; -import { SignatureHelpParameter } from '../protocol'; +import { SignatureHelpParameter } from '../protocol.ts'; export default class OmniSharpSignatureHelpProvider extends AbstractSupport implements SignatureHelpProvider { public async provideSignatureHelp( diff --git a/src/omnisharp/features/sourceGeneratedDocumentProvider.ts b/src/omnisharp/features/sourceGeneratedDocumentProvider.ts index e84da6d38d..687b861542 100644 --- a/src/omnisharp/features/sourceGeneratedDocumentProvider.ts +++ b/src/omnisharp/features/sourceGeneratedDocumentProvider.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as serverUtils from '../utils'; +import * as serverUtils from '../utils.ts'; import { CancellationToken, Event, @@ -15,9 +15,9 @@ import { window, workspace, } from 'vscode'; -import { IDisposable } from '../../disposable'; -import { SourceGeneratedFileInfo, SourceGeneratedFileResponse, UpdateType } from '../protocol'; -import { OmniSharpServer } from '../server'; +import { IDisposable } from '../../disposable.ts'; +import { SourceGeneratedFileInfo, SourceGeneratedFileResponse, UpdateType } from '../protocol.ts'; +import { OmniSharpServer } from '../server.ts'; export default class SourceGeneratedDocumentProvider implements TextDocumentContentProvider, IDisposable { readonly scheme = 'omnisharp-source-generated'; diff --git a/src/omnisharp/features/structureProvider.ts b/src/omnisharp/features/structureProvider.ts index 437e50eeb3..cf23760128 100644 --- a/src/omnisharp/features/structureProvider.ts +++ b/src/omnisharp/features/structureProvider.ts @@ -11,9 +11,9 @@ import { FoldingRange, FoldingRangeKind, } from 'vscode'; -import AbstractSupport from './abstractProvider'; -import { blockStructure } from '../utils'; -import { V2 } from '../protocol'; +import AbstractSupport from './abstractProvider.ts'; +import { blockStructure } from '../utils.ts'; +import { V2 } from '../protocol.ts'; export class OmniSharpStructureProvider extends AbstractSupport implements FoldingRangeProvider { async provideFoldingRanges( diff --git a/src/omnisharp/features/virtualDocumentTracker.ts b/src/omnisharp/features/virtualDocumentTracker.ts index 440f5a5ec0..de0b2cc12c 100644 --- a/src/omnisharp/features/virtualDocumentTracker.ts +++ b/src/omnisharp/features/virtualDocumentTracker.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import { workspace, TextDocument, Uri } from 'vscode'; -import { OmniSharpServer } from '../server'; -import * as serverUtils from '../utils'; -import { FileChangeType } from '../protocol'; -import { IDisposable } from '../../disposable'; -import CompositeDisposable from '../../compositeDisposable'; -import { EventStream } from '../../eventStream'; -import { DocumentSynchronizationFailure } from '../omnisharpLoggingEvents'; +import { OmniSharpServer } from '../server.ts'; +import * as serverUtils from '../utils.ts'; +import { FileChangeType } from '../protocol.ts'; +import { IDisposable } from '../../disposable.ts'; +import CompositeDisposable from '../../compositeDisposable.ts'; +import { EventStream } from '../../eventStream.ts'; +import { DocumentSynchronizationFailure } from '../omnisharpLoggingEvents.ts'; async function trackCurrentVirtualDocuments(server: OmniSharpServer, eventStream: EventStream) { for (let i = 0; i < workspace.textDocuments.length; i++) { diff --git a/src/omnisharp/features/workspaceSymbolProvider.ts b/src/omnisharp/features/workspaceSymbolProvider.ts index cb0fdbfd8a..36facb3c68 100644 --- a/src/omnisharp/features/workspaceSymbolProvider.ts +++ b/src/omnisharp/features/workspaceSymbolProvider.ts @@ -1,96 +1,96 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import AbstractSupport from './abstractProvider'; -import { OmniSharpServer } from '../server'; -import * as protocol from '../protocol'; -import * as serverUtils from '../utils'; -import { toRange } from '../typeConversion'; -import { CancellationToken, Uri, WorkspaceSymbolProvider, SymbolInformation, SymbolKind, Location } from 'vscode'; -import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature'; -import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider'; -import { omnisharpOptions } from '../../shared/options'; - -export default class OmniSharpWorkspaceSymbolProvider extends AbstractSupport implements WorkspaceSymbolProvider { - constructor( - server: OmniSharpServer, - languageMiddlewareFeature: LanguageMiddlewareFeature, - private sourceGeneratedDocumentProvider: SourceGeneratedDocumentProvider - ) { - super(server, languageMiddlewareFeature); - } - - public async provideWorkspaceSymbols(search: string, token: CancellationToken): Promise { - const minFindSymbolsFilterLength = omnisharpOptions.minFindSymbolsFilterLength; - const maxFindSymbolsItems = omnisharpOptions.maxFindSymbolsItems; - const minFilterLength = minFindSymbolsFilterLength > 0 ? minFindSymbolsFilterLength : undefined; - const maxItemsToReturn = maxFindSymbolsItems > 0 ? maxFindSymbolsItems : undefined; - - if (minFilterLength !== undefined && search.length < minFilterLength) { - return []; - } - - try { - const res = await serverUtils.findSymbols( - this._server, - { Filter: search, MaxItemsToReturn: maxItemsToReturn }, - token - ); - if (Array.isArray(res?.QuickFixes)) { - return res.QuickFixes.map((symbol) => this._asSymbolInformation(symbol)); - } - } catch { - /* empty */ - } - - return []; - } - - private _asSymbolInformation(symbolInfo: protocol.SymbolLocation): SymbolInformation { - let uri: Uri; - if (symbolInfo.GeneratedFileInfo) { - uri = this.sourceGeneratedDocumentProvider.addSourceGeneratedFileWithoutInitialContent( - symbolInfo.GeneratedFileInfo, - symbolInfo.FileName - ); - } else { - uri = Uri.file(symbolInfo.FileName); - } - - const location = new Location(uri, toRange(symbolInfo)); - - return new SymbolInformation( - symbolInfo.Text, - OmniSharpWorkspaceSymbolProvider._toKind(symbolInfo), - symbolInfo.ContainingSymbolName ?? '', - location - ); - } - - private static _toKind(symbolInfo: protocol.SymbolLocation): SymbolKind { - switch (symbolInfo.Kind) { - case 'Method': - return SymbolKind.Method; - case 'Field': - return SymbolKind.Field; - case 'Property': - return SymbolKind.Property; - case 'Interface': - return SymbolKind.Interface; - case 'Enum': - return SymbolKind.Enum; - case 'Struct': - return SymbolKind.Struct; - case 'Event': - return SymbolKind.Event; - case 'EnumMember': - return SymbolKind.EnumMember; - case 'Class': - return SymbolKind.Class; - default: - return SymbolKind.Class; - } - } -} +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import AbstractSupport from './abstractProvider.ts'; +import { OmniSharpServer } from '../server.ts'; +import * as protocol from '../protocol.ts'; +import * as serverUtils from '../utils.ts'; +import { toRange } from '../typeConversion.ts'; +import { CancellationToken, Uri, WorkspaceSymbolProvider, SymbolInformation, SymbolKind, Location } from 'vscode'; +import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature.ts'; +import SourceGeneratedDocumentProvider from './sourceGeneratedDocumentProvider.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; + +export default class OmniSharpWorkspaceSymbolProvider extends AbstractSupport implements WorkspaceSymbolProvider { + constructor( + server: OmniSharpServer, + languageMiddlewareFeature: LanguageMiddlewareFeature, + private sourceGeneratedDocumentProvider: SourceGeneratedDocumentProvider + ) { + super(server, languageMiddlewareFeature); + } + + public async provideWorkspaceSymbols(search: string, token: CancellationToken): Promise { + const minFindSymbolsFilterLength = omnisharpOptions.minFindSymbolsFilterLength; + const maxFindSymbolsItems = omnisharpOptions.maxFindSymbolsItems; + const minFilterLength = minFindSymbolsFilterLength > 0 ? minFindSymbolsFilterLength : undefined; + const maxItemsToReturn = maxFindSymbolsItems > 0 ? maxFindSymbolsItems : undefined; + + if (minFilterLength !== undefined && search.length < minFilterLength) { + return []; + } + + try { + const res = await serverUtils.findSymbols( + this._server, + { Filter: search, MaxItemsToReturn: maxItemsToReturn }, + token + ); + if (Array.isArray(res?.QuickFixes)) { + return res.QuickFixes.map((symbol) => this._asSymbolInformation(symbol)); + } + } catch { + /* empty */ + } + + return []; + } + + private _asSymbolInformation(symbolInfo: protocol.SymbolLocation): SymbolInformation { + let uri: Uri; + if (symbolInfo.GeneratedFileInfo) { + uri = this.sourceGeneratedDocumentProvider.addSourceGeneratedFileWithoutInitialContent( + symbolInfo.GeneratedFileInfo, + symbolInfo.FileName + ); + } else { + uri = Uri.file(symbolInfo.FileName); + } + + const location = new Location(uri, toRange(symbolInfo)); + + return new SymbolInformation( + symbolInfo.Text, + OmniSharpWorkspaceSymbolProvider._toKind(symbolInfo), + symbolInfo.ContainingSymbolName ?? '', + location + ); + } + + private static _toKind(symbolInfo: protocol.SymbolLocation): SymbolKind { + switch (symbolInfo.Kind) { + case 'Method': + return SymbolKind.Method; + case 'Field': + return SymbolKind.Field; + case 'Property': + return SymbolKind.Property; + case 'Interface': + return SymbolKind.Interface; + case 'Enum': + return SymbolKind.Enum; + case 'Struct': + return SymbolKind.Struct; + case 'Event': + return SymbolKind.Event; + case 'EnumMember': + return SymbolKind.EnumMember; + case 'Class': + return SymbolKind.Class; + default: + return SymbolKind.Class; + } + } +} diff --git a/src/omnisharp/fileOperationsResponseEditBuilder.ts b/src/omnisharp/fileOperationsResponseEditBuilder.ts index cb652e80a7..aff691509c 100644 --- a/src/omnisharp/fileOperationsResponseEditBuilder.ts +++ b/src/omnisharp/fileOperationsResponseEditBuilder.ts @@ -5,9 +5,9 @@ import * as vscode from 'vscode'; import { Uri } from 'vscode'; -import { LanguageMiddlewareFeature } from './languageMiddlewareFeature'; -import { FileModificationType, FileOperationResponse, ModifiedFileResponse, RenamedFileResponse } from './protocol'; -import { toRange2 } from './typeConversion'; +import { LanguageMiddlewareFeature } from './languageMiddlewareFeature.ts'; +import { FileModificationType, FileOperationResponse, ModifiedFileResponse, RenamedFileResponse } from './protocol.ts'; +import { toRange2 } from './typeConversion.ts'; export async function buildEditForResponse( changes: FileOperationResponse[], diff --git a/src/omnisharp/languageMiddlewareFeature.ts b/src/omnisharp/languageMiddlewareFeature.ts index cfaba25aee..2480487fe4 100644 --- a/src/omnisharp/languageMiddlewareFeature.ts +++ b/src/omnisharp/languageMiddlewareFeature.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { IDisposable } from '../disposable'; +import { IDisposable } from '../disposable.ts'; export interface LanguageMiddleware extends RemapApi { language: string; diff --git a/src/omnisharp/launcher.ts b/src/omnisharp/launcher.ts index 3356eccd78..7358820d8b 100644 --- a/src/omnisharp/launcher.ts +++ b/src/omnisharp/launcher.ts @@ -6,12 +6,12 @@ import { spawn } from 'child_process'; import { ChildProcessWithoutNullStreams } from 'child_process'; -import { PlatformInformation } from '../shared/platform'; +import { PlatformInformation } from '../shared/platform.ts'; import * as path from 'path'; import * as vscode from 'vscode'; -import { commonOptions, omnisharpOptions } from '../shared/options'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; -import { LaunchTarget, LaunchTargetKind, createLaunchTargetForSolution } from '../shared/launchTarget'; +import { commonOptions, omnisharpOptions } from '../shared/options.ts'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; +import { LaunchTarget, LaunchTargetKind, createLaunchTargetForSolution } from '../shared/launchTarget.ts'; export const vslsTarget: LaunchTarget = { label: 'VSLS', diff --git a/src/omnisharp/observers/backgroundWorkStatusBarObserver.ts b/src/omnisharp/observers/backgroundWorkStatusBarObserver.ts index 36b69a2c4e..ffc36d5a3b 100644 --- a/src/omnisharp/observers/backgroundWorkStatusBarObserver.ts +++ b/src/omnisharp/observers/backgroundWorkStatusBarObserver.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver'; -import { BaseEvent } from '../../shared/loggingEvents'; -import { OmnisharpBackgroundDiagnosticStatus } from '../omnisharpLoggingEvents'; -import { EventType } from '../../shared/eventType'; -import { BackgroundDiagnosticStatus } from '../protocol'; +import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { OmnisharpBackgroundDiagnosticStatus } from '../omnisharpLoggingEvents.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { BackgroundDiagnosticStatus } from '../protocol.ts'; export class BackgroundWorkStatusBarObserver extends BaseStatusBarItemObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/baseStatusBarItemObserver.ts b/src/omnisharp/observers/baseStatusBarItemObserver.ts index 03594675f3..88da52c11a 100644 --- a/src/omnisharp/observers/baseStatusBarItemObserver.ts +++ b/src/omnisharp/observers/baseStatusBarItemObserver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseEvent } from '../../shared/loggingEvents'; -import { StatusBarItem } from '../../vscodeAdapter'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { StatusBarItem } from '../../vscodeAdapter.ts'; export abstract class BaseStatusBarItemObserver { constructor(private statusBarItem: StatusBarItem) {} diff --git a/src/omnisharp/observers/csharpLoggerObserver.ts b/src/omnisharp/observers/csharpLoggerObserver.ts index c5ccbe252d..d546db6606 100644 --- a/src/omnisharp/observers/csharpLoggerObserver.ts +++ b/src/omnisharp/observers/csharpLoggerObserver.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; -import { EventType } from '../../shared/eventType'; -import { BaseEvent } from '../../shared/loggingEvents'; -import { DocumentSynchronizationFailure } from '../omnisharpLoggingEvents'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { DocumentSynchronizationFailure } from '../omnisharpLoggingEvents.ts'; export class CSharpLoggerObserver extends BaseLoggerObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/dotnetChannelObserver.ts b/src/omnisharp/observers/dotnetChannelObserver.ts index ec05783aef..2535762ae9 100644 --- a/src/omnisharp/observers/dotnetChannelObserver.ts +++ b/src/omnisharp/observers/dotnetChannelObserver.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver'; -import { EventType } from '../../shared/eventType'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export class DotNetChannelObserver extends BaseChannelObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/dotnetLoggerObserver.ts b/src/omnisharp/observers/dotnetLoggerObserver.ts index 2fa1ad80e4..3d9ad5425e 100644 --- a/src/omnisharp/observers/dotnetLoggerObserver.ts +++ b/src/omnisharp/observers/dotnetLoggerObserver.ts @@ -2,14 +2,14 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; import { CommandDotNetRestoreProgress, CommandDotNetRestoreSucceeded, CommandDotNetRestoreFailed, -} from '../omnisharpLoggingEvents'; -import { EventType } from '../../shared/eventType'; +} from '../omnisharpLoggingEvents.ts'; +import { EventType } from '../../shared/eventType.ts'; export class DotnetLoggerObserver extends BaseLoggerObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/dotnetTestChannelObserver.ts b/src/omnisharp/observers/dotnetTestChannelObserver.ts index eab8cd887e..c9c7a3b540 100644 --- a/src/omnisharp/observers/dotnetTestChannelObserver.ts +++ b/src/omnisharp/observers/dotnetTestChannelObserver.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver'; -import { EventType } from '../../shared/eventType'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export default class DotnetTestChannelObserver extends BaseChannelObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/dotnetTestLoggerObserver.ts b/src/omnisharp/observers/dotnetTestLoggerObserver.ts index 876f339a85..7fd16b385a 100644 --- a/src/omnisharp/observers/dotnetTestLoggerObserver.ts +++ b/src/omnisharp/observers/dotnetTestLoggerObserver.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; import { DotNetTestRunStart, DotNetTestMessage, @@ -15,10 +15,10 @@ import { DotNetTestsInClassRunStart, DotNetTestRunInContextStart, DotNetTestDebugInContextStart, -} from '../omnisharpLoggingEvents'; -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; -import * as protocol from '../protocol'; -import { EventType } from '../../shared/eventType'; +} from '../omnisharpLoggingEvents.ts'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; +import * as protocol from '../protocol.ts'; +import { EventType } from '../../shared/eventType.ts'; export default class DotNetTestLoggerObserver extends BaseLoggerObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/errorMessageObserver.ts b/src/omnisharp/observers/errorMessageObserver.ts index 2ac535689f..c96176e718 100644 --- a/src/omnisharp/observers/errorMessageObserver.ts +++ b/src/omnisharp/observers/errorMessageObserver.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseEvent, IntegrityCheckFailure, ZipError } from '../../shared/loggingEvents'; -import { DotNetTestRunFailure, DotNetTestDebugStartFailure } from '../omnisharpLoggingEvents'; -import { vscode } from '../../vscodeAdapter'; -import { EventType } from '../../shared/eventType'; +import { BaseEvent, IntegrityCheckFailure, ZipError } from '../../shared/loggingEvents.ts'; +import { DotNetTestRunFailure, DotNetTestDebugStartFailure } from '../omnisharpLoggingEvents.ts'; +import { vscode } from '../../vscodeAdapter.ts'; +import { EventType } from '../../shared/eventType.ts'; import { l10n } from 'vscode'; -import { showErrorMessage } from '../../shared/observers/utils/showMessage'; +import { showErrorMessage } from '../../shared/observers/utils/showMessage.ts'; export class ErrorMessageObserver { constructor(private vscode: vscode) {} diff --git a/src/omnisharp/observers/informationMessageObserver.ts b/src/omnisharp/observers/informationMessageObserver.ts index 8579793fa3..57131ffa77 100644 --- a/src/omnisharp/observers/informationMessageObserver.ts +++ b/src/omnisharp/observers/informationMessageObserver.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { vscode } from '../../vscodeAdapter'; -import { EventType } from '../../shared/eventType'; -import { omnisharpOptions } from '../../shared/options'; +import { vscode } from '../../vscodeAdapter.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; import { l10n } from 'vscode'; -import { BaseEvent } from '../../shared/loggingEvents'; -import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { CommandOption, showInformationMessage } from '../../shared/observers/utils/showMessage.ts'; export class InformationMessageObserver { constructor(private vscode: vscode) {} diff --git a/src/omnisharp/observers/omnisharpChannelObserver.ts b/src/omnisharp/observers/omnisharpChannelObserver.ts index a47fd3d5c6..3a7b5eb500 100644 --- a/src/omnisharp/observers/omnisharpChannelObserver.ts +++ b/src/omnisharp/observers/omnisharpChannelObserver.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver'; -import { OutputChannel } from '../../vscodeAdapter'; -import { EventType } from '../../shared/eventType'; -import { omnisharpOptions } from '../../shared/options'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseChannelObserver } from '../../shared/observers/baseChannelObserver.ts'; +import { OutputChannel } from '../../vscodeAdapter.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { omnisharpOptions } from '../../shared/options.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export class OmnisharpChannelObserver extends BaseChannelObserver { constructor(channel: OutputChannel) { diff --git a/src/omnisharp/observers/omnisharpDebugModeLoggerObserver.ts b/src/omnisharp/observers/omnisharpDebugModeLoggerObserver.ts index 7a2f0390da..dd0ad47eb5 100644 --- a/src/omnisharp/observers/omnisharpDebugModeLoggerObserver.ts +++ b/src/omnisharp/observers/omnisharpDebugModeLoggerObserver.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; import * as os from 'os'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; import { OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, @@ -14,8 +14,8 @@ import { OmnisharpServerVerboseMessage, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived, -} from '../omnisharpLoggingEvents'; -import { EventType } from '../../shared/eventType'; +} from '../omnisharpLoggingEvents.ts'; +import { EventType } from '../../shared/eventType.ts'; export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/omnisharpLoggerObserver.ts b/src/omnisharp/observers/omnisharpLoggerObserver.ts index 661b3c945f..ef96d7db50 100644 --- a/src/omnisharp/observers/omnisharpLoggerObserver.ts +++ b/src/omnisharp/observers/omnisharpLoggerObserver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; import { OmnisharpInitialisation, OmnisharpLaunch, @@ -15,12 +15,12 @@ import { OmnisharpServerMsBuildProjectDiagnostics, OmnisharpServerOnStdErr, OmnisharpEventPacketReceived, -} from '../omnisharpLoggingEvents'; +} from '../omnisharpLoggingEvents.ts'; import * as os from 'os'; -import { EventType } from '../../shared/eventType'; +import { EventType } from '../../shared/eventType.ts'; import * as vscode from 'vscode'; -import { PlatformInformation } from '../../shared/platform'; -import { Logger } from '../../logger'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { Logger } from '../../logger.ts'; export class OmnisharpLoggerObserver extends BaseLoggerObserver { constructor( diff --git a/src/omnisharp/observers/omnisharpStatusBarObserver.ts b/src/omnisharp/observers/omnisharpStatusBarObserver.ts index a6218d57c0..71c35bc3ab 100644 --- a/src/omnisharp/observers/omnisharpStatusBarObserver.ts +++ b/src/omnisharp/observers/omnisharpStatusBarObserver.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseEvent, DownloadProgress, DownloadStart, InstallationStart } from '../../shared/loggingEvents'; -import { OmnisharpServerOnStdErr } from '../omnisharpLoggingEvents'; -import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver'; -import { EventType } from '../../shared/eventType'; +import { BaseEvent, DownloadProgress, DownloadStart, InstallationStart } from '../../shared/loggingEvents.ts'; +import { OmnisharpServerOnStdErr } from '../omnisharpLoggingEvents.ts'; +import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver.ts'; +import { EventType } from '../../shared/eventType.ts'; export enum StatusBarColors { Red = 'rgb(218,0,0)', diff --git a/src/omnisharp/observers/projectStatusBarObserver.ts b/src/omnisharp/observers/projectStatusBarObserver.ts index 419bd4e232..fce1457d32 100644 --- a/src/omnisharp/observers/projectStatusBarObserver.ts +++ b/src/omnisharp/observers/projectStatusBarObserver.ts @@ -5,10 +5,10 @@ import * as vscode from 'vscode'; import { basename } from 'path'; -import { BaseEvent } from '../../shared/loggingEvents'; -import { WorkspaceInformationUpdated } from '../omnisharpLoggingEvents'; -import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver'; -import { EventType } from '../../shared/eventType'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { WorkspaceInformationUpdated } from '../omnisharpLoggingEvents.ts'; +import { BaseStatusBarItemObserver } from './baseStatusBarItemObserver.ts'; +import { EventType } from '../../shared/eventType.ts'; export class ProjectStatusBarObserver extends BaseStatusBarItemObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/razorLoggerObserver.ts b/src/omnisharp/observers/razorLoggerObserver.ts index b3d2321b05..3358e6ad91 100644 --- a/src/omnisharp/observers/razorLoggerObserver.ts +++ b/src/omnisharp/observers/razorLoggerObserver.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver'; -import { RazorPluginPathSpecified, RazorPluginPathDoesNotExist } from '../omnisharpLoggingEvents'; -import { EventType } from '../../shared/eventType'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseLoggerObserver } from '../../shared/observers/baseLoggerObserver.ts'; +import { RazorPluginPathSpecified, RazorPluginPathDoesNotExist } from '../omnisharpLoggingEvents.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export class RazorLoggerObserver extends BaseLoggerObserver { public post = (event: BaseEvent) => { diff --git a/src/omnisharp/observers/telemetryObserver.ts b/src/omnisharp/observers/telemetryObserver.ts index 35a29f3c12..2dea257571 100644 --- a/src/omnisharp/observers/telemetryObserver.ts +++ b/src/omnisharp/observers/telemetryObserver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from '../../shared/platform'; -import { BaseEvent, InstallationFailure } from '../../shared/loggingEvents'; +import { PlatformInformation } from '../../shared/platform.ts'; +import { BaseEvent, InstallationFailure } from '../../shared/loggingEvents.ts'; import { TestExecutionCountReport, TelemetryEventWithMeasures, @@ -12,13 +12,13 @@ import { ProjectConfiguration, TelemetryErrorEvent, OmnisharpInitialisation, -} from '../omnisharpLoggingEvents'; -import { PackageError } from '../../packageManager/packageError'; -import { EventType } from '../../shared/eventType'; -import { getDotnetInfo } from '../../shared/utils/getDotnetInfo'; -import { DotnetInfo } from '../../shared/utils/dotnetInfo'; -import { ITelemetryReporter, getTelemetryProps } from '../../shared/telemetryReporter'; -import { reportProjectConfigurationEvent } from '../../shared/projectConfiguration'; +} from '../omnisharpLoggingEvents.ts'; +import { PackageError } from '../../packageManager/packageError.ts'; +import { EventType } from '../../shared/eventType.ts'; +import { getDotnetInfo } from '../../shared/utils/getDotnetInfo.ts'; +import { DotnetInfo } from '../../shared/utils/dotnetInfo.ts'; +import { ITelemetryReporter, getTelemetryProps } from '../../shared/telemetryReporter.ts'; +import { reportProjectConfigurationEvent } from '../../shared/projectConfiguration.ts'; export class TelemetryObserver { private reporter: ITelemetryReporter; @@ -66,11 +66,11 @@ export class TelemetryObserver { } case EventType.TelemetryErrorEvent: { const telemetryErrorEvent = event; + // errorProps has been ignored by @vscode/extension-telemetry since v0.6. this.reporter.sendTelemetryErrorEvent( telemetryErrorEvent.eventName, telemetryErrorEvent.properties, - telemetryErrorEvent.measures, - telemetryErrorEvent.errorProps + telemetryErrorEvent.measures ); break; } diff --git a/src/omnisharp/observers/warningMessageObserver.ts b/src/omnisharp/observers/warningMessageObserver.ts index a044e219a7..dc9fba1e95 100644 --- a/src/omnisharp/observers/warningMessageObserver.ts +++ b/src/omnisharp/observers/warningMessageObserver.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { debounceTime } from 'rxjs/operators'; -import { vscode } from '../../vscodeAdapter'; -import { BaseEvent } from '../../shared/loggingEvents'; -import { OmnisharpServerMsBuildProjectDiagnostics } from '../omnisharpLoggingEvents'; +import { vscode } from '../../vscodeAdapter.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; +import { OmnisharpServerMsBuildProjectDiagnostics } from '../omnisharpLoggingEvents.ts'; import { Scheduler, Subject } from 'rxjs'; -import { EventType } from '../../shared/eventType'; +import { EventType } from '../../shared/eventType.ts'; import { l10n } from 'vscode'; -import { CommandOption, showWarningMessage } from '../../shared/observers/utils/showMessage'; +import { CommandOption, showWarningMessage } from '../../shared/observers/utils/showMessage.ts'; export class WarningMessageObserver { private warningMessageDebouncer: Subject; diff --git a/src/omnisharp/omniSharpMonoResolver.ts b/src/omnisharp/omniSharpMonoResolver.ts index 6e3df3434a..43c6744797 100644 --- a/src/omnisharp/omniSharpMonoResolver.ts +++ b/src/omnisharp/omniSharpMonoResolver.ts @@ -5,10 +5,10 @@ import * as semver from 'semver'; import * as path from 'path'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; -import { HostExecutableInformation } from '../shared/constants/hostExecutableInformation'; -import { IGetMonoVersion } from '../constants/IGetMonoVersion'; -import { omnisharpOptions } from '../shared/options'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; +import { HostExecutableInformation } from '../shared/constants/hostExecutableInformation.ts'; +import { IGetMonoVersion } from '../constants/IGetMonoVersion.ts'; +import { omnisharpOptions } from '../shared/options.ts'; export class OmniSharpMonoResolver implements IHostExecutableResolver { private readonly minimumMonoVersion = '6.4.0'; diff --git a/src/omnisharp/omnisharpDownloader.ts b/src/omnisharp/omnisharpDownloader.ts index dd0ea5bab0..c968f09797 100644 --- a/src/omnisharp/omnisharpDownloader.ts +++ b/src/omnisharp/omnisharpDownloader.ts @@ -3,23 +3,23 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { GetPackagesFromVersion } from './omnisharpPackageCreator'; -import { PlatformInformation } from '../shared/platform'; +import { GetPackagesFromVersion } from './omnisharpPackageCreator.ts'; +import { PlatformInformation } from '../shared/platform.ts'; import { PackageInstallation, LogPlatformInfo, InstallationSuccess, InstallationFailure, -} from '../shared/loggingEvents'; -import { EventStream } from '../eventStream'; -import { NetworkSettingsProvider } from '../networkSettings'; -import { downloadAndInstallPackages } from '../packageManager/downloadAndInstallPackages'; -import { DownloadFile } from '../packageManager/fileDownloader'; -import { getRuntimeDependenciesPackages } from '../tools/runtimeDependencyPackageUtils'; -import { getAbsolutePathPackagesToInstall } from '../packageManager/getAbsolutePathPackagesToInstall'; -import { isValidDownload } from '../packageManager/isValidDownload'; -import { LatestBuildDownloadStart } from './omnisharpLoggingEvents'; -import { ITelemetryReporter } from '../shared/telemetryReporter'; +} from '../shared/loggingEvents.ts'; +import { EventStream } from '../eventStream.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; +import { downloadAndInstallPackages } from '../packageManager/downloadAndInstallPackages.ts'; +import { DownloadFile } from '../packageManager/fileDownloader.ts'; +import { getRuntimeDependenciesPackages } from '../tools/runtimeDependencyPackageUtils.ts'; +import { getAbsolutePathPackagesToInstall } from '../packageManager/getAbsolutePathPackagesToInstall.ts'; +import { isValidDownload } from '../packageManager/isValidDownload.ts'; +import { LatestBuildDownloadStart } from './omnisharpLoggingEvents.ts'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; export class OmnisharpDownloader { public constructor( diff --git a/src/omnisharp/omnisharpLanguageServer.ts b/src/omnisharp/omnisharpLanguageServer.ts index 1c5325c328..69619bbd23 100644 --- a/src/omnisharp/omnisharpLanguageServer.ts +++ b/src/omnisharp/omnisharpLanguageServer.ts @@ -4,53 +4,53 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import * as utils from './utils'; -import { DotNetChannelObserver } from './observers/dotnetChannelObserver'; -import { DotnetLoggerObserver } from './observers/dotnetLoggerObserver'; -import DotNetTestLoggerObserver from './observers/dotnetTestLoggerObserver'; -import DotNetTestChannelObserver from './observers/dotnetTestChannelObserver'; -import { OmnisharpLoggerObserver } from './observers/omnisharpLoggerObserver'; -import { OmnisharpChannelObserver } from './observers/omnisharpChannelObserver'; -import { WarningMessageObserver } from './observers/warningMessageObserver'; -import { InformationMessageObserver } from './observers/informationMessageObserver'; -import { ErrorMessageObserver } from './observers/errorMessageObserver'; -import { StatusBarItemAdapter } from '../statusBarItemAdapter'; -import { OmnisharpStatusBarObserver } from './observers/omnisharpStatusBarObserver'; -import { EventStream } from '../eventStream'; -import { NetworkSettingsProvider } from '../networkSettings'; -import { PlatformInformation } from '../shared/platform'; -import { ProjectStatusBarObserver } from './observers/projectStatusBarObserver'; -import { BackgroundWorkStatusBarObserver } from './observers/backgroundWorkStatusBarObserver'; -import { OmnisharpDebugModeLoggerObserver } from './observers/omnisharpDebugModeLoggerObserver'; -import { RazorLoggerObserver } from './observers/razorLoggerObserver'; -import { RazorOmnisharpDownloader } from '../razor/razorOmnisharpDownloader'; -import { omnisharpOptions, razorOptions } from '../shared/options'; -import CompositeDisposable from '../compositeDisposable'; -import { OmniSharpMonoResolver } from './omniSharpMonoResolver'; -import { DotnetResolver } from './dotnetResolver'; -import { LanguageMiddlewareFeature } from './languageMiddlewareFeature'; -import { OmniSharpServer } from './server'; -import { Advisor } from './features/diagnosticsProvider'; -import TestManager from './features/dotnetTest'; -import { OmnisharpWorkspaceDebugInformationProvider } from './omnisharpWorkspaceDebugInformationProvider'; -import Disposable from '../disposable'; -import registerCommands from './features/commands'; -import { addAssetsIfNecessary } from '../shared/assets'; +import * as utils from './utils.ts'; +import { DotNetChannelObserver } from './observers/dotnetChannelObserver.ts'; +import { DotnetLoggerObserver } from './observers/dotnetLoggerObserver.ts'; +import DotNetTestLoggerObserver from './observers/dotnetTestLoggerObserver.ts'; +import DotNetTestChannelObserver from './observers/dotnetTestChannelObserver.ts'; +import { OmnisharpLoggerObserver } from './observers/omnisharpLoggerObserver.ts'; +import { OmnisharpChannelObserver } from './observers/omnisharpChannelObserver.ts'; +import { WarningMessageObserver } from './observers/warningMessageObserver.ts'; +import { InformationMessageObserver } from './observers/informationMessageObserver.ts'; +import { ErrorMessageObserver } from './observers/errorMessageObserver.ts'; +import { StatusBarItemAdapter } from '../statusBarItemAdapter.ts'; +import { OmnisharpStatusBarObserver } from './observers/omnisharpStatusBarObserver.ts'; +import { EventStream } from '../eventStream.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; +import { PlatformInformation } from '../shared/platform.ts'; +import { ProjectStatusBarObserver } from './observers/projectStatusBarObserver.ts'; +import { BackgroundWorkStatusBarObserver } from './observers/backgroundWorkStatusBarObserver.ts'; +import { OmnisharpDebugModeLoggerObserver } from './observers/omnisharpDebugModeLoggerObserver.ts'; +import { RazorLoggerObserver } from './observers/razorLoggerObserver.ts'; +import { RazorOmnisharpDownloader } from '../razor/razorOmnisharpDownloader.ts'; +import { omnisharpOptions, razorOptions } from '../shared/options.ts'; +import CompositeDisposable from '../compositeDisposable.ts'; +import { OmniSharpMonoResolver } from './omniSharpMonoResolver.ts'; +import { DotnetResolver } from './dotnetResolver.ts'; +import { LanguageMiddlewareFeature } from './languageMiddlewareFeature.ts'; +import { OmniSharpServer } from './server.ts'; +import { Advisor } from './features/diagnosticsProvider.ts'; +import TestManager from './features/dotnetTest.ts'; +import { OmnisharpWorkspaceDebugInformationProvider } from './omnisharpWorkspaceDebugInformationProvider.ts'; +import Disposable from '../disposable.ts'; +import registerCommands from './features/commands.ts'; +import { addAssetsIfNecessary } from '../shared/assets.ts'; import { ActiveTextEditorChanged, OmnisharpStart, ProjectJsonDeprecatedWarning, RazorDevModeActive, -} from './omnisharpLoggingEvents'; -import { DotnetWorkspaceConfigurationProvider } from '../shared/workspaceConfigurationProvider'; -import { getMonoVersion } from '../utils/getMonoVersion'; -import { safeLength, sum } from '../common'; -import { TelemetryObserver } from './observers/telemetryObserver'; -import { ITelemetryReporter } from '../shared/telemetryReporter'; +} from './omnisharpLoggingEvents.ts'; +import { DotnetWorkspaceConfigurationProvider } from '../shared/workspaceConfigurationProvider.ts'; +import { getMonoVersion } from '../utils/getMonoVersion.ts'; +import { safeLength, sum } from '../common.ts'; +import { TelemetryObserver } from './observers/telemetryObserver.ts'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; import { Observable } from 'rxjs'; -import { registerOmnisharpOptionChanges } from './omnisharpOptionChanges'; -import { CSharpLoggerObserver } from './observers/csharpLoggerObserver'; -import { showWarningMessage } from '../shared/observers/utils/showMessage'; +import { registerOmnisharpOptionChanges } from './omnisharpOptionChanges.ts'; +import { CSharpLoggerObserver } from './observers/csharpLoggerObserver.ts'; +import { showWarningMessage } from '../shared/observers/utils/showMessage.ts'; export interface ActivationResult { readonly server: OmniSharpServer; diff --git a/src/omnisharp/omnisharpLoggingEvents.ts b/src/omnisharp/omnisharpLoggingEvents.ts index 9fd7fdf1dd..f3efec307e 100644 --- a/src/omnisharp/omnisharpLoggingEvents.ts +++ b/src/omnisharp/omnisharpLoggingEvents.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Request } from './requestQueue'; -import * as protocol from './protocol'; -import { LaunchTarget } from '../shared/launchTarget'; -import { EventType } from '../shared/eventType'; -import { ProjectConfigurationMessage } from '../shared/projectConfiguration'; -import { BaseEvent, EventWithMessage } from '../shared/loggingEvents'; +import { Request } from './requestQueue.ts'; +import * as protocol from './protocol.ts'; +import { LaunchTarget } from '../shared/launchTarget.ts'; +import { EventType } from '../shared/eventType.ts'; +import { ProjectConfigurationMessage } from '../shared/projectConfiguration.ts'; +import { BaseEvent, EventWithMessage } from '../shared/loggingEvents.ts'; export class TelemetryEvent implements BaseEvent { type = EventType.TelemetryEvent; diff --git a/src/omnisharp/omnisharpManager.ts b/src/omnisharp/omnisharpManager.ts index 91159a3690..8a7cd1cc0d 100644 --- a/src/omnisharp/omnisharpManager.ts +++ b/src/omnisharp/omnisharpManager.ts @@ -5,10 +5,10 @@ import * as path from 'path'; import * as semver from 'semver'; -import * as util from '../common'; -import { OmnisharpDownloader } from './omnisharpDownloader'; -import { PlatformInformation } from '../shared/platform'; -import { modernNetVersion } from './omnisharpPackageCreator'; +import * as util from '../common.ts'; +import { OmnisharpDownloader } from './omnisharpDownloader.ts'; +import { PlatformInformation } from '../shared/platform.ts'; +import { modernNetVersion } from './omnisharpPackageCreator.ts'; export class OmnisharpManager { private readonly latestVersionFileServerPath = 'releases/versioninfo.txt'; diff --git a/src/omnisharp/omnisharpOptionChanges.ts b/src/omnisharp/omnisharpOptionChanges.ts index 880f9e7424..954a381432 100644 --- a/src/omnisharp/omnisharpOptionChanges.ts +++ b/src/omnisharp/omnisharpOptionChanges.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { HandleOptionChanges, OptionChangeObserver } from '../shared/observers/optionChangeObserver'; -import { CommonOptionsThatTriggerReload, OmnisharpOptionsThatTriggerReload } from '../shared/options'; +import { HandleOptionChanges, OptionChangeObserver } from '../shared/observers/optionChangeObserver.ts'; +import { CommonOptionsThatTriggerReload, OmnisharpOptionsThatTriggerReload } from '../shared/options.ts'; import { Observable } from 'rxjs'; -import Disposable from '../disposable'; -import { CommandOption, showInformationMessage } from '../shared/observers/utils/showMessage'; +import Disposable from '../disposable.ts'; +import { CommandOption, showInformationMessage } from '../shared/observers/utils/showMessage.ts'; export function registerOmnisharpOptionChanges(optionObservable: Observable): Disposable { const optionChangeObserver: OptionChangeObserver = { diff --git a/src/omnisharp/omnisharpPackageCreator.ts b/src/omnisharp/omnisharpPackageCreator.ts index ff68e4c26c..1dfb08f869 100644 --- a/src/omnisharp/omnisharpPackageCreator.ts +++ b/src/omnisharp/omnisharpPackageCreator.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Package } from '../packageManager/package'; +import { Package } from '../packageManager/package.ts'; export const modernNetVersion = '6.0'; diff --git a/src/omnisharp/omnisharpWorkspaceDebugInformationProvider.ts b/src/omnisharp/omnisharpWorkspaceDebugInformationProvider.ts index 7018dddd0a..9699c38a1f 100644 --- a/src/omnisharp/omnisharpWorkspaceDebugInformationProvider.ts +++ b/src/omnisharp/omnisharpWorkspaceDebugInformationProvider.ts @@ -4,15 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as path from 'path'; -import * as serverUtils from './utils'; +import * as serverUtils from './utils.ts'; import { IWorkspaceDebugInformationProvider, ProjectDebugInformation, -} from '../shared/IWorkspaceDebugInformationProvider'; -import { OmniSharpServer } from './server'; +} from '../shared/IWorkspaceDebugInformationProvider.ts'; +import { OmniSharpServer } from './server.ts'; import { Uri } from 'vscode'; -import { findNetCoreTargetFramework } from '../shared/utils'; -import { isSubfolderOf } from '../common'; +import { findNetCoreTargetFramework } from '../shared/utils.ts'; +import { isSubfolderOf } from '../common.ts'; export class OmnisharpWorkspaceDebugInformationProvider implements IWorkspaceDebugInformationProvider { constructor(private server: OmniSharpServer) {} diff --git a/src/omnisharp/prioritization.ts b/src/omnisharp/prioritization.ts index 9e5641c108..35d9d018ae 100644 --- a/src/omnisharp/prioritization.ts +++ b/src/omnisharp/prioritization.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from './protocol'; +import * as protocol from './protocol.ts'; const priorityCommands = [ protocol.Requests.ChangeBuffer, diff --git a/src/omnisharp/protocol.ts b/src/omnisharp/protocol.ts index 94cf74c397..efe657727c 100644 --- a/src/omnisharp/protocol.ts +++ b/src/omnisharp/protocol.ts @@ -9,7 +9,7 @@ import { findNetCoreTargetFramework, findNetFrameworkTargetFramework, findNetStandardTargetFramework, -} from '../shared/utils'; +} from '../shared/utils.ts'; export namespace Requests { export const AddToProject = '/addtoproject'; diff --git a/src/omnisharp/requestQueue.ts b/src/omnisharp/requestQueue.ts index d7f6439085..bc60e01326 100644 --- a/src/omnisharp/requestQueue.ts +++ b/src/omnisharp/requestQueue.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as prioritization from './prioritization'; +import * as prioritization from './prioritization.ts'; import { OmnisharpServerProcessRequestComplete, OmnisharpServerProcessRequestStart, OmnisharpServerDequeueRequest, OmnisharpServerEnqueueRequest, -} from './omnisharpLoggingEvents'; -import { EventStream } from '../eventStream'; +} from './omnisharpLoggingEvents.ts'; +import { EventStream } from '../eventStream.ts'; export interface Request { command: string; diff --git a/src/omnisharp/requirementCheck.ts b/src/omnisharp/requirementCheck.ts index 2a59f8995a..7810c34314 100644 --- a/src/omnisharp/requirementCheck.ts +++ b/src/omnisharp/requirementCheck.ts @@ -5,11 +5,11 @@ import * as vscode from 'vscode'; import * as semver from 'semver'; -import { getDotnetInfo } from '../shared/utils/getDotnetInfo'; -import { getMonoVersion } from '../utils/getMonoVersion'; -import { OmniSharpMonoResolver } from './omniSharpMonoResolver'; -import { getMSBuildVersion } from '../utils/getMsBuildInfo'; -import { omnisharpOptions } from '../shared/options'; +import { getDotnetInfo } from '../shared/utils/getDotnetInfo.ts'; +import { getMonoVersion } from '../utils/getMonoVersion.ts'; +import { OmniSharpMonoResolver } from './omniSharpMonoResolver.ts'; +import { getMSBuildVersion } from '../utils/getMsBuildInfo.ts'; +import { omnisharpOptions } from '../shared/options.ts'; export interface RequirementResult { needsDotNetSdk: boolean; diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index aa54915492..403d5aff8a 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -5,36 +5,36 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as protocol from './protocol'; -import * as serverUtils from './utils'; -import { vscode, CancellationToken } from '../vscodeAdapter'; -import { LaunchTarget, LaunchTargetKind } from '../shared/launchTarget'; -import { DelayTracker } from './delayTracker'; +import * as protocol from './protocol.ts'; +import * as serverUtils from './utils.ts'; +import { vscode, CancellationToken } from '../vscodeAdapter.ts'; +import { LaunchTarget, LaunchTargetKind } from '../shared/launchTarget.ts'; +import { DelayTracker } from './delayTracker.ts'; import { EventEmitter } from 'events'; -import { OmnisharpManager } from './omnisharpManager'; -import { PlatformInformation } from '../shared/platform'; -import { OmnisharpDownloader } from './omnisharpDownloader'; -import * as ObservableEvents from './omnisharpLoggingEvents'; -import { EventStream } from '../eventStream'; -import { NetworkSettingsProvider } from '../networkSettings'; +import { OmnisharpManager } from './omnisharpManager.ts'; +import { PlatformInformation } from '../shared/platform.ts'; +import { OmnisharpDownloader } from './omnisharpDownloader.ts'; +import * as ObservableEvents from './omnisharpLoggingEvents.ts'; +import { EventStream } from '../eventStream.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; import { Subject } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; -import CompositeDisposable from '../compositeDisposable'; -import Disposable from '../disposable'; +import CompositeDisposable from '../compositeDisposable.ts'; +import Disposable from '../disposable.ts'; import { ExtensionContext, LogOutputChannel, OutputChannel } from 'vscode'; -import { LanguageMiddlewareFeature } from './languageMiddlewareFeature'; -import { LspEngine } from './engines/lspEngine'; -import { IEngine } from './engines/IEngine'; -import { StdioEngine } from './engines/stdioEngine'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; -import { showProjectSelector } from './features/commands'; -import { validateRequirements } from './requirementCheck'; -import { Advisor } from './features/diagnosticsProvider'; -import TestManager from './features/dotnetTest'; -import { findLaunchTargets } from './launcher'; -import { ProjectConfigurationMessage } from '../shared/projectConfiguration'; -import { commonOptions, omnisharpOptions, razorOptions } from '../shared/options'; -import { ITelemetryReporter } from '../shared/telemetryReporter'; +import { LanguageMiddlewareFeature } from './languageMiddlewareFeature.ts'; +import { LspEngine } from './engines/lspEngine.ts'; +import { IEngine } from './engines/IEngine.ts'; +import { StdioEngine } from './engines/stdioEngine.ts'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; +import { showProjectSelector } from './features/commands.ts'; +import { validateRequirements } from './requirementCheck.ts'; +import { Advisor } from './features/diagnosticsProvider.ts'; +import TestManager from './features/dotnetTest.ts'; +import { findLaunchTargets } from './launcher.ts'; +import { ProjectConfigurationMessage } from '../shared/projectConfiguration.ts'; +import { commonOptions, omnisharpOptions, razorOptions } from '../shared/options.ts'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; enum ServerState { Starting, diff --git a/src/omnisharp/typeConversion.ts b/src/omnisharp/typeConversion.ts index 4fa0212385..6c2c5e82e9 100644 --- a/src/omnisharp/typeConversion.ts +++ b/src/omnisharp/typeConversion.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as protocol from './protocol'; +import * as protocol from './protocol.ts'; import * as vscode from 'vscode'; export function toLocation(location: protocol.ResourceLocation | protocol.QuickFix): vscode.Location { diff --git a/src/omnisharp/utils.ts b/src/omnisharp/utils.ts index 56f92b3bf5..55e8805d7b 100644 --- a/src/omnisharp/utils.ts +++ b/src/omnisharp/utils.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { OmniSharpServer } from './server'; -import * as protocol from './protocol'; +import { OmniSharpServer } from './server.ts'; +import * as protocol from './protocol.ts'; import * as vscode from 'vscode'; import { CancellationToken } from 'vscode-languageclient'; import { @@ -13,7 +13,7 @@ import { isBlazorWebAssemblyHosted, isBlazorWebAssemblyHostedServer, findNetCoreTargetFramework, -} from '../shared/utils'; +} from '../shared/utils.ts'; export async function codeCheck(server: OmniSharpServer, request: protocol.Request, token: vscode.CancellationToken) { return server.makeRequest(protocol.Requests.CodeCheck, request, token); diff --git a/src/packageManager/IInstallDependencies.ts b/src/packageManager/IInstallDependencies.ts index d4c12b3cfc..3986b3473c 100644 --- a/src/packageManager/IInstallDependencies.ts +++ b/src/packageManager/IInstallDependencies.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AbsolutePathPackage } from './absolutePathPackage'; +import { AbsolutePathPackage } from './absolutePathPackage.ts'; export type DependencyInstallationStatus = { [name: string]: boolean }; diff --git a/src/packageManager/absolutePathPackage.ts b/src/packageManager/absolutePathPackage.ts index 5505dc43eb..cc31f67762 100644 --- a/src/packageManager/absolutePathPackage.ts +++ b/src/packageManager/absolutePathPackage.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Package } from './package'; -import { IPackage } from './IPackage'; -import { AbsolutePath } from './absolutePath'; +import { Package } from './package.ts'; +import { IPackage } from './IPackage.ts'; +import { AbsolutePath } from './absolutePath.ts'; export class AbsolutePathPackage implements IPackage { constructor( diff --git a/src/packageManager/downloadAndInstallPackages.ts b/src/packageManager/downloadAndInstallPackages.ts index da39e0e352..50a3698232 100644 --- a/src/packageManager/downloadAndInstallPackages.ts +++ b/src/packageManager/downloadAndInstallPackages.ts @@ -3,21 +3,21 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PackageError } from './packageError'; -import { NestedError } from '../nestedError'; -import { DownloadFile } from './fileDownloader'; -import { InstallZip } from './zipInstaller'; -import { EventStream } from '../eventStream'; -import { NetworkSettingsProvider } from '../networkSettings'; -import { AbsolutePathPackage } from './absolutePathPackage'; -import { touchInstallFile, InstallFileType, deleteInstallFile, installFileExists } from '../common'; -import { InstallationFailure, IntegrityCheckFailure } from '../shared/loggingEvents'; -import { mkdirpSync } from 'fs-extra'; -import { PackageInstallStart } from '../shared/loggingEvents'; -import { DownloadValidator } from './isValidDownload'; +import { PackageError } from './packageError.ts'; +import { NestedError } from '../nestedError.ts'; +import { DownloadFile } from './fileDownloader.ts'; +import { InstallZip } from './zipInstaller.ts'; +import { EventStream } from '../eventStream.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; +import { AbsolutePathPackage } from './absolutePathPackage.ts'; +import { touchInstallFile, InstallFileType, deleteInstallFile, installFileExists } from '../common.ts'; +import { InstallationFailure, IntegrityCheckFailure } from '../shared/loggingEvents.ts'; +import fsExtra from 'fs-extra'; +import { PackageInstallStart } from '../shared/loggingEvents.ts'; +import { DownloadValidator } from './isValidDownload.ts'; import { CancellationToken } from 'vscode'; -import { ITelemetryReporter } from '../shared/telemetryReporter'; -import { DependencyInstallationStatus } from './IInstallDependencies'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; +import { DependencyInstallationStatus } from './IInstallDependencies.ts'; export async function downloadAndInstallPackages( packages: AbsolutePathPackage[], @@ -32,7 +32,7 @@ export async function downloadAndInstallPackages( for (const pkg of packages) { let installationStage = 'touchBeginFile'; try { - mkdirpSync(pkg.installPath.value); + fsExtra.mkdirpSync(pkg.installPath.value); await touchInstallFile(pkg.installPath, InstallFileType.Begin); let count = 1; const willTryInstallingPackage = () => count <= 2; // try 2 times diff --git a/src/packageManager/fileDownloader.ts b/src/packageManager/fileDownloader.ts index b1535a2132..4705ec9f47 100644 --- a/src/packageManager/fileDownloader.ts +++ b/src/packageManager/fileDownloader.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as https from 'https'; -import { EventStream } from '../eventStream'; +import { EventStream } from '../eventStream.ts'; import { DownloadSuccess, DownloadStart, @@ -12,11 +12,11 @@ import { DownloadFailure, DownloadProgress, DownloadSizeObtained, -} from '../shared/loggingEvents'; -import { NestedError } from '../nestedError'; +} from '../shared/loggingEvents.ts'; +import { NestedError } from '../nestedError.ts'; import { parse as parseUrl } from 'url'; -import { getProxyAgent } from './proxy'; -import { NetworkSettingsProvider } from '../networkSettings'; +import { getProxyAgent } from './proxy.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; import { CancellationToken } from 'vscode'; export async function DownloadFile( diff --git a/src/packageManager/getAbsolutePathPackagesToInstall.ts b/src/packageManager/getAbsolutePathPackagesToInstall.ts index 3efc604519..4d5c5bbd0e 100644 --- a/src/packageManager/getAbsolutePathPackagesToInstall.ts +++ b/src/packageManager/getAbsolutePathPackagesToInstall.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from '../shared/platform'; -import { AbsolutePathPackage } from './absolutePathPackage'; -import { getNotInstalledPackagesForPlatform } from './packageFilterer'; -import { Package } from './package'; +import { PlatformInformation } from '../shared/platform.ts'; +import { AbsolutePathPackage } from './absolutePathPackage.ts'; +import { getNotInstalledPackagesForPlatform } from './packageFilterer.ts'; +import { Package } from './package.ts'; export async function getAbsolutePathPackagesToInstall( packages: Package[], diff --git a/src/packageManager/isValidDownload.ts b/src/packageManager/isValidDownload.ts index fd592395ff..3b0b5975ac 100644 --- a/src/packageManager/isValidDownload.ts +++ b/src/packageManager/isValidDownload.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as crypto from 'crypto'; -import { EventStream } from '../eventStream'; -import { IntegrityCheckSuccess, DownloadValidation } from '../shared/loggingEvents'; +import { EventStream } from '../eventStream.ts'; +import { IntegrityCheckSuccess, DownloadValidation } from '../shared/loggingEvents.ts'; export interface DownloadValidator { (buffer: Buffer, integrity: string | undefined, eventStream: EventStream): boolean; diff --git a/src/packageManager/package.ts b/src/packageManager/package.ts index da54200e5d..e90539e231 100644 --- a/src/packageManager/package.ts +++ b/src/packageManager/package.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IPackage } from './IPackage'; +import { IPackage } from './IPackage.ts'; export interface Package extends IPackage { installPath?: string; diff --git a/src/packageManager/packageError.ts b/src/packageManager/packageError.ts index 9954ee8ec8..489cd7b48f 100644 --- a/src/packageManager/packageError.ts +++ b/src/packageManager/packageError.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { NestedError } from '../nestedError'; -import { IPackage } from './IPackage'; +import { NestedError } from '../nestedError.ts'; +import { IPackage } from './IPackage.ts'; export class PackageError extends NestedError { // Do not put PII (personally identifiable information) in the 'message' field as it will be logged to telemetry diff --git a/src/packageManager/packageFilterer.ts b/src/packageManager/packageFilterer.ts index 80d22fe4a8..88196fab45 100644 --- a/src/packageManager/packageFilterer.ts +++ b/src/packageManager/packageFilterer.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from '../shared/platform'; -import * as util from '../common'; -import { AbsolutePathPackage } from './absolutePathPackage'; +import { PlatformInformation } from '../shared/platform.ts'; +import * as util from '../common.ts'; +import { AbsolutePathPackage } from './absolutePathPackage.ts'; const NEUTRAL = 'neutral'; diff --git a/src/packageManager/zipInstaller.ts b/src/packageManager/zipInstaller.ts index 8cf57606b8..b4314c3ec8 100644 --- a/src/packageManager/zipInstaller.ts +++ b/src/packageManager/zipInstaller.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as fs from 'fs'; -import { ensureDir } from 'fs-extra'; +import fsExtra from 'fs-extra'; import * as path from 'path'; import * as yauzl from 'yauzl'; -import { EventStream } from '../eventStream'; -import { InstallationStart, ZipError } from '../shared/loggingEvents'; -import { NestedError } from '../nestedError'; -import { AbsolutePath } from './absolutePath'; +import { EventStream } from '../eventStream.ts'; +import { InstallationStart, ZipError } from '../shared/loggingEvents.ts'; +import { NestedError } from '../nestedError.ts'; +import { AbsolutePath } from './absolutePath.ts'; export async function InstallZip( buffer: Buffer, @@ -38,7 +38,7 @@ export async function InstallZip( if (entry.fileName.endsWith('/')) { // Directory - create it try { - await ensureDir(absoluteEntryPath, 0o775); + await fsExtra.ensureDir(absoluteEntryPath, 0o775); zipFile.readEntry(); } catch (err) { const error = err as NodeJS.ErrnoException; // Hack for TypeScript to type err correctly @@ -54,7 +54,7 @@ export async function InstallZip( } try { - await ensureDir(path.dirname(absoluteEntryPath), 0o775); + await fsExtra.ensureDir(path.dirname(absoluteEntryPath), 0o775); // Make sure executable files have correct permissions when extracted const binaryPaths = binaries?.map((binary) => binary.value); diff --git a/src/razor/razorOmnisharp.ts b/src/razor/razorOmnisharp.ts index 21a341e865..b754afef4c 100644 --- a/src/razor/razorOmnisharp.ts +++ b/src/razor/razorOmnisharp.ts @@ -7,8 +7,8 @@ import * as fs from 'fs'; import * as RazorOmniSharp from 'microsoft.aspnetcore.razor.vscode'; import * as path from 'path'; import * as vscode from 'vscode'; -import { EventStream } from '../eventStream'; -import { showWarningMessage } from '../shared/observers/utils/showMessage'; +import { EventStream } from '../eventStream.ts'; +import { showWarningMessage } from '../shared/observers/utils/showMessage.ts'; export async function activateRazorOmniSharpExtension( context: vscode.ExtensionContext, diff --git a/src/razor/razorOmnisharpDownloader.ts b/src/razor/razorOmnisharpDownloader.ts index 83ffd4edc5..ab780cc216 100644 --- a/src/razor/razorOmnisharpDownloader.ts +++ b/src/razor/razorOmnisharpDownloader.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from '../shared/platform'; -import { PackageInstallation, LogPlatformInfo, InstallationSuccess } from '../shared/loggingEvents'; -import { EventStream } from '../eventStream'; -import { NetworkSettingsProvider } from '../networkSettings'; -import { downloadAndInstallPackages } from '../packageManager/downloadAndInstallPackages'; -import { getRuntimeDependenciesPackages } from '../tools/runtimeDependencyPackageUtils'; -import { getAbsolutePathPackagesToInstall } from '../packageManager/getAbsolutePathPackagesToInstall'; -import { isValidDownload } from '../packageManager/isValidDownload'; -import { ITelemetryReporter } from '../shared/telemetryReporter'; +import { PlatformInformation } from '../shared/platform.ts'; +import { PackageInstallation, LogPlatformInfo, InstallationSuccess } from '../shared/loggingEvents.ts'; +import { EventStream } from '../eventStream.ts'; +import { NetworkSettingsProvider } from '../networkSettings.ts'; +import { downloadAndInstallPackages } from '../packageManager/downloadAndInstallPackages.ts'; +import { getRuntimeDependenciesPackages } from '../tools/runtimeDependencyPackageUtils.ts'; +import { getAbsolutePathPackagesToInstall } from '../packageManager/getAbsolutePathPackagesToInstall.ts'; +import { isValidDownload } from '../packageManager/isValidDownload.ts'; +import { ITelemetryReporter } from '../shared/telemetryReporter.ts'; export class RazorOmnisharpDownloader { public constructor( diff --git a/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts b/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts index 2c6238dfc4..ecfd131a3b 100644 --- a/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts +++ b/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts @@ -9,25 +9,25 @@ import { join } from 'path'; import { fileURLToPath } from 'url'; import * as vscode from 'vscode'; import { ChromeBrowserFinder, EdgeBrowserFinder } from '@vscode/js-debug-browsers'; -import { ONLY_JS_DEBUG_NAME, MANAGED_DEBUG_NAME, JS_DEBUG_NAME, SERVER_APP_NAME } from './constants'; -import { isValidEvent, onDidTerminateDebugSession } from './terminateDebugHandler'; -import path = require('path'); +import { ONLY_JS_DEBUG_NAME, MANAGED_DEBUG_NAME, JS_DEBUG_NAME, SERVER_APP_NAME } from './constants.ts'; +import { isValidEvent, onDidTerminateDebugSession } from './terminateDebugHandler.ts'; +import * as path from 'path'; import * as cp from 'child_process'; -import { getExtensionPath } from '../../../common'; -import { getCSharpDevKit } from '../../../utils/getCSharpDevKit'; -import { CSharpExtensionId } from '../../../constants/csharpExtensionId'; -import { DotNetRuntimeVersion } from '../../../lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver'; +import { getExtensionPath } from '../../../common.ts'; +import { getCSharpDevKit } from '../../../utils/getCSharpDevKit.ts'; +import { CSharpExtensionId } from '../../../constants/csharpExtensionId.ts'; +import { DotNetRuntimeVersion } from '../../../lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts'; import { IDotnetAcquireContext, IDotnetAcquireResult, IDotnetFindPathContext, -} from '../../../lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionApi'; -import { IDisposable } from '@microsoft/servicehub-framework'; -import { Observer } from '@microsoft/servicehub-framework/js/src/jsonRpc/Observer'; +} from '../../../lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionApi.ts'; import { EventEmitter } from 'events'; import { Formatters, + IDisposable, MessageDelimiters, + Observer, ServiceJsonRpcDescriptor, ServiceMoniker, ServiceRpcDescriptor, @@ -59,7 +59,7 @@ const targetFrameworkServiceDescriptor: ServiceRpcDescriptor = Object.freeze( ) ); -import { showErrorMessage, showInformationMessage } from '../../../shared/observers/utils/showMessage'; +import { showErrorMessage, showInformationMessage } from '../../../shared/observers/utils/showMessage.ts'; export class BlazorDebugConfigurationProvider implements vscode.DebugConfigurationProvider { private static readonly autoDetectUserNotice: string = vscode.l10n.t( diff --git a/src/razor/src/blazorDebug/terminateDebugHandler.ts b/src/razor/src/blazorDebug/terminateDebugHandler.ts index 6c60d3f5a8..070385abac 100644 --- a/src/razor/src/blazorDebug/terminateDebugHandler.ts +++ b/src/razor/src/blazorDebug/terminateDebugHandler.ts @@ -6,7 +6,7 @@ import psList from 'ps-list'; import { DebugSession } from 'vscode'; import { LogOutputChannel } from 'vscode'; -import { JS_DEBUG_NAME, SERVER_APP_NAME } from './constants'; +import { JS_DEBUG_NAME, SERVER_APP_NAME } from './constants.ts'; export const isValidEvent = (name: string) => { // The name can be of the form: `Debug Blazor Web Assembly in Browser: https://localhost:7291` diff --git a/src/razor/src/colorPresentation/colorPresentationHandler.ts b/src/razor/src/colorPresentation/colorPresentationHandler.ts index dbe21cd5f6..7c7f4f4a1a 100644 --- a/src/razor/src/colorPresentation/colorPresentationHandler.ts +++ b/src/razor/src/colorPresentation/colorPresentationHandler.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { convertTextEditToSerializable, SerializableTextEdit } from '../rpc/serializableTextEdit'; -import { ColorPresentationContext } from './colorPresentationContext'; -import { SerializableColorPresentation } from './serializableColorPresentation'; -import { SerializableColorPresentationParams } from './serializableColorPresentationParams'; +import { convertTextEditToSerializable, SerializableTextEdit } from '../rpc/serializableTextEdit.ts'; +import { ColorPresentationContext } from './colorPresentationContext.ts'; +import { SerializableColorPresentation } from './serializableColorPresentation.ts'; +import { SerializableColorPresentationParams } from './serializableColorPresentationParams.ts'; export class ColorPresentationHandler { constructor() {} diff --git a/src/razor/src/colorPresentation/serializableColorPresentation.ts b/src/razor/src/colorPresentation/serializableColorPresentation.ts index 6d5de76161..f30e3e1fd0 100644 --- a/src/razor/src/colorPresentation/serializableColorPresentation.ts +++ b/src/razor/src/colorPresentation/serializableColorPresentation.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SerializableTextEdit } from '../rpc/serializableTextEdit'; +import { SerializableTextEdit } from '../rpc/serializableTextEdit.ts'; export class SerializableColorPresentation { constructor( diff --git a/src/razor/src/colorPresentation/serializableColorPresentationParams.ts b/src/razor/src/colorPresentation/serializableColorPresentationParams.ts index f9c74c533c..5fc2cbebe5 100644 --- a/src/razor/src/colorPresentation/serializableColorPresentationParams.ts +++ b/src/razor/src/colorPresentation/serializableColorPresentationParams.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { SerializableRange } from '../rpc/serializableRange'; -import { SerializableTextDocumentIdentifier } from '../rpc/serializableTextDocumentIdentifier'; +import { SerializableRange } from '../rpc/serializableRange.ts'; +import { SerializableTextDocumentIdentifier } from '../rpc/serializableTextDocumentIdentifier.ts'; export interface SerializableColorPresentationParams { textDocument: SerializableTextDocumentIdentifier; diff --git a/src/razor/src/documentColor/documentColorHandler.ts b/src/razor/src/documentColor/documentColorHandler.ts index 9a451ea98f..2ce53068da 100644 --- a/src/razor/src/documentColor/documentColorHandler.ts +++ b/src/razor/src/documentColor/documentColorHandler.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { convertRangeToSerializable } from '../rpc/serializableRange'; -import { SerializableColorInformation } from './serializableColorInformation'; +import { convertRangeToSerializable } from '../rpc/serializableRange.ts'; +import { SerializableColorInformation } from './serializableColorInformation.ts'; export class DocumentColorHandler { constructor() {} diff --git a/src/razor/src/documentColor/serializableColorInformation.ts b/src/razor/src/documentColor/serializableColorInformation.ts index 76572b986e..bc909cd0bc 100644 --- a/src/razor/src/documentColor/serializableColorInformation.ts +++ b/src/razor/src/documentColor/serializableColorInformation.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { SerializableRange } from '../rpc/serializableRange'; +import { SerializableRange } from '../rpc/serializableRange.ts'; export class SerializableColorInformation { constructor( diff --git a/src/razor/src/folding/foldingRangeHandler.ts b/src/razor/src/folding/foldingRangeHandler.ts index 762ccadb1a..23e60b6ac6 100644 --- a/src/razor/src/folding/foldingRangeHandler.ts +++ b/src/razor/src/folding/foldingRangeHandler.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import { FoldingRange, FoldingRangeKind } from 'vscode-languageclient'; -import { ObservableLogOutputChannel } from '../../../lsptoolshost/logging/observableLogOutputChannel'; +import { ObservableLogOutputChannel } from '../../../lsptoolshost/logging/observableLogOutputChannel.ts'; export class FoldingRangeHandler { constructor() {} diff --git a/src/razor/src/formatting/formattingHandler.ts b/src/razor/src/formatting/formattingHandler.ts index 15fcc05be6..a072ee86c4 100644 --- a/src/razor/src/formatting/formattingHandler.ts +++ b/src/razor/src/formatting/formattingHandler.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { convertTextEditToSerializable, SerializableTextEdit } from '../rpc/serializableTextEdit'; -import { SerializableFormattingResponse } from './serializableFormattingResponse'; -import { SerializablePosition } from '../rpc/serializablePosition'; +import { convertTextEditToSerializable, SerializableTextEdit } from '../rpc/serializableTextEdit.ts'; +import { SerializableFormattingResponse } from './serializableFormattingResponse.ts'; +import { SerializablePosition } from '../rpc/serializablePosition.ts'; export class FormattingHandler { private static emptyFormattingResponse = new SerializableFormattingResponse(); diff --git a/src/razor/src/formatting/serializableFormattingResponse.ts b/src/razor/src/formatting/serializableFormattingResponse.ts index 615917b6f6..708a689c6f 100644 --- a/src/razor/src/formatting/serializableFormattingResponse.ts +++ b/src/razor/src/formatting/serializableFormattingResponse.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SerializableTextEdit } from '../rpc/serializableTextEdit'; +import { SerializableTextEdit } from '../rpc/serializableTextEdit.ts'; export class SerializableFormattingResponse { constructor(public readonly edits?: SerializableTextEdit[]) {} diff --git a/src/razor/src/razorLanguage.ts b/src/razor/src/razorLanguage.ts index 7e7b29bca3..2cad07658f 100644 --- a/src/razor/src/razorLanguage.ts +++ b/src/razor/src/razorLanguage.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscode from './vscodeAdapter'; +import * as vscode from './vscodeAdapter.ts'; export class RazorLanguage { public static id = 'aspnetcorerazor'; diff --git a/src/razor/src/razorLanguageConfiguration.ts b/src/razor/src/razorLanguageConfiguration.ts index 9b754bc24b..26f701bd7c 100644 --- a/src/razor/src/razorLanguageConfiguration.ts +++ b/src/razor/src/razorLanguageConfiguration.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { RazorLanguage } from './razorLanguage'; +import { RazorLanguage } from './razorLanguage.ts'; const VOID_ELEMENTS: string[] = [ 'area', diff --git a/src/razor/src/rpc/serializableRange.ts b/src/razor/src/rpc/serializableRange.ts index 8f0c8ed55c..d0e865d93f 100644 --- a/src/razor/src/rpc/serializableRange.ts +++ b/src/razor/src/rpc/serializableRange.ts @@ -8,7 +8,7 @@ import { convertPositionFromSerializable, convertPositionToSerializable, SerializablePosition, -} from './serializablePosition'; +} from './serializablePosition.ts'; // We'd typically just use vscode.Range here; however, that type doesn't serialize properly over the wire. export interface SerializableRange { diff --git a/src/razor/src/rpc/serializableTextEdit.ts b/src/razor/src/rpc/serializableTextEdit.ts index 6a5ae5565d..c069659cf0 100644 --- a/src/razor/src/rpc/serializableTextEdit.ts +++ b/src/razor/src/rpc/serializableTextEdit.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { convertRangeFromSerializable, convertRangeToSerializable, SerializableRange } from './serializableRange'; +import { convertRangeFromSerializable, convertRangeToSerializable, SerializableRange } from './serializableRange.ts'; // We'd typically just use vscode.TextEdit here; however, that type doesn't serialize properly over the wire. export interface SerializableTextEdit { diff --git a/src/shared/assets.ts b/src/shared/assets.ts index 333738ccc1..3d373e2c2d 100644 --- a/src/shared/assets.ts +++ b/src/shared/assets.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as jsonc from 'jsonc-parser'; import { FormattingOptions, ModificationOptions } from 'jsonc-parser'; import * as os from 'os'; import * as path from 'path'; import * as tasks from 'vscode-tasks'; -import * as util from '../common'; +import * as util from '../common.ts'; import * as vscode from 'vscode'; -import { tolerantParse } from '../json'; -import { IWorkspaceDebugInformationProvider, ProjectDebugInformation } from './IWorkspaceDebugInformationProvider'; -import { showErrorMessage } from './observers/utils/showMessage'; +import { tolerantParse } from '../json.ts'; +import { IWorkspaceDebugInformationProvider, ProjectDebugInformation } from './IWorkspaceDebugInformationProvider.ts'; +import { showErrorMessage } from './observers/utils/showMessage.ts'; type DebugConsoleOptions = { console: string }; diff --git a/src/shared/configurationProvider.ts b/src/shared/configurationProvider.ts index d4c9e943dd..3afaa558a1 100644 --- a/src/shared/configurationProvider.ts +++ b/src/shared/configurationProvider.ts @@ -4,24 +4,24 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { ParsedEnvironmentFile } from '../coreclrDebug/parsedEnvironmentFile'; -import { debugSessionTracker } from '../coreclrDebug/provisionalDebugSessionTracker'; +import { ParsedEnvironmentFile } from '../coreclrDebug/parsedEnvironmentFile.ts'; +import { debugSessionTracker } from '../coreclrDebug/provisionalDebugSessionTracker.ts'; -import { CertToolStatusCodes, createSelfSignedCert, hasDotnetDevCertsHttps } from '../utils/dotnetDevCertsHttps'; +import { CertToolStatusCodes, createSelfSignedCert, hasDotnetDevCertsHttps } from '../utils/dotnetDevCertsHttps.ts'; import { AttachItem, RemoteAttachPicker, DotNetAttachItemsProviderFactory, AttachPicker, -} from '../shared/processPicker'; -import { PlatformInformation } from './platform'; -import { getCSharpDevKit } from '../utils/getCSharpDevKit'; +} from '../shared/processPicker.ts'; +import { PlatformInformation } from './platform.ts'; +import { getCSharpDevKit } from '../utils/getCSharpDevKit.ts'; import { ActionOption, showErrorMessageWithOptions, showInformationMessage, showWarningMessage, -} from './observers/utils/showMessage'; +} from './observers/utils/showMessage.ts'; /** * Class used for debug configurations that will be sent to the debugger registered by {@link DebugAdapterExecutableFactory} diff --git a/src/shared/constants/IHostExecutableResolver.ts b/src/shared/constants/IHostExecutableResolver.ts index f1c783ef63..16172a9264 100644 --- a/src/shared/constants/IHostExecutableResolver.ts +++ b/src/shared/constants/IHostExecutableResolver.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { HostExecutableInformation } from './hostExecutableInformation'; +import { HostExecutableInformation } from './hostExecutableInformation.ts'; export interface IHostExecutableResolver { getHostExecutableInfo(): Promise; diff --git a/src/shared/dotnetConfigurationProvider.ts b/src/shared/dotnetConfigurationProvider.ts index b62187fae0..798526fb95 100644 --- a/src/shared/dotnetConfigurationProvider.ts +++ b/src/shared/dotnetConfigurationProvider.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as vscode from 'vscode'; -import { IWorkspaceDebugInformationProvider, ProjectDebugInformation } from './IWorkspaceDebugInformationProvider'; -import { AssetGenerator, AssetOperations, addTasksJsonIfNecessary, getBuildOperations } from './assets'; -import { getServiceBroker } from '../lsptoolshost/serviceBroker/brokeredServicesHosting'; -import Descriptors from '../lsptoolshost/solutionSnapshot/descriptors'; +import { IWorkspaceDebugInformationProvider, ProjectDebugInformation } from './IWorkspaceDebugInformationProvider.ts'; +import { AssetGenerator, AssetOperations, addTasksJsonIfNecessary, getBuildOperations } from './assets.ts'; +import { getServiceBroker } from '../lsptoolshost/serviceBroker/brokeredServicesHosting.ts'; +import Descriptors from '../lsptoolshost/solutionSnapshot/descriptors.ts'; import { DotnetDebugConfigurationServiceErrorKind, IDotnetDebugConfigurationService, IDotnetDebugConfigurationServiceResult, -} from '../lsptoolshost/debugger/IDotnetDebugConfigurationService'; -import { DotnetWorkspaceConfigurationProvider } from './workspaceConfigurationProvider'; +} from '../lsptoolshost/debugger/IDotnetDebugConfigurationService.ts'; +import { DotnetWorkspaceConfigurationProvider } from './workspaceConfigurationProvider.ts'; // User errors that can be shown to the user. class LaunchServiceError extends Error {} diff --git a/src/shared/limitedActivationStatus.ts b/src/shared/limitedActivationStatus.ts index d365c25d30..5d7a086230 100644 --- a/src/shared/limitedActivationStatus.ts +++ b/src/shared/limitedActivationStatus.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { languageServerOptions } from './options'; -import { RazorLanguage } from '../razor/src/razorLanguage'; -import { combineDocumentSelectors } from './utils/combineDocumentSelectors'; +import { languageServerOptions } from './options.ts'; +import { RazorLanguage } from '../razor/src/razorLanguage.ts'; +import { combineDocumentSelectors } from './utils/combineDocumentSelectors.ts'; export class LimitedActivationStatus { static createStatusItem(context: vscode.ExtensionContext) { diff --git a/src/shared/loggingEvents.ts b/src/shared/loggingEvents.ts index 77addb4da8..50de151811 100644 --- a/src/shared/loggingEvents.ts +++ b/src/shared/loggingEvents.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EventType } from './eventType'; -import { PlatformInformation } from './platform'; +import { EventType } from './eventType.ts'; +import { PlatformInformation } from './platform.ts'; export interface BaseEvent { type: EventType; diff --git a/src/shared/migrateOptions.ts b/src/shared/migrateOptions.ts index 7ddc0cb9a4..380be43d20 100644 --- a/src/shared/migrateOptions.ts +++ b/src/shared/migrateOptions.ts @@ -6,9 +6,9 @@ import * as fs from 'fs'; import * as path from 'path'; import { types } from 'util'; -import { ConfigurationTarget, vscode, WorkspaceConfiguration } from '../vscodeAdapter'; -import { CSharpExtensionId } from '../constants/csharpExtensionId'; -import { commonOptions } from './options'; +import { ConfigurationTarget, vscode, WorkspaceConfiguration } from '../vscodeAdapter.ts'; +import { CSharpExtensionId } from '../constants/csharpExtensionId.ts'; +import { commonOptions } from './options.ts'; export interface IDotnetAcquisitionExistingPaths { extensionId: string; diff --git a/src/shared/observables/createOptionStream.ts b/src/shared/observables/createOptionStream.ts index 9d977a5653..78d3cdd4b3 100644 --- a/src/shared/observables/createOptionStream.ts +++ b/src/shared/observables/createOptionStream.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { vscode } from '../../vscodeAdapter'; +import { vscode } from '../../vscodeAdapter.ts'; import { Observable, Observer } from 'rxjs'; import { publishBehavior } from 'rxjs/operators'; diff --git a/src/shared/observers/baseChannelObserver.ts b/src/shared/observers/baseChannelObserver.ts index 1942129df4..c856a58d87 100644 --- a/src/shared/observers/baseChannelObserver.ts +++ b/src/shared/observers/baseChannelObserver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscode from '../../vscodeAdapter'; -import { BaseEvent } from '../../shared/loggingEvents'; +import * as vscode from '../../vscodeAdapter.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export abstract class BaseChannelObserver { constructor(private channel: vscode.OutputChannel) {} diff --git a/src/shared/observers/baseLoggerObserver.ts b/src/shared/observers/baseLoggerObserver.ts index b6478572cb..63b38f9a17 100644 --- a/src/shared/observers/baseLoggerObserver.ts +++ b/src/shared/observers/baseLoggerObserver.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscode from '../../vscodeAdapter'; -import { Logger } from '../../logger'; -import { BaseEvent } from '../../shared/loggingEvents'; +import * as vscode from '../../vscodeAdapter.ts'; +import { Logger } from '../../logger.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export abstract class BaseLoggerObserver { public logger: Logger; diff --git a/src/shared/observers/csharpChannelObserver.ts b/src/shared/observers/csharpChannelObserver.ts index ccc96b39f4..0000d59e74 100644 --- a/src/shared/observers/csharpChannelObserver.ts +++ b/src/shared/observers/csharpChannelObserver.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseChannelObserver } from './baseChannelObserver'; -import { EventType } from '../eventType'; -import { BaseEvent } from '../../shared/loggingEvents'; +import { BaseChannelObserver } from './baseChannelObserver.ts'; +import { EventType } from '../eventType.ts'; +import { BaseEvent } from '../../shared/loggingEvents.ts'; export class CsharpChannelObserver extends BaseChannelObserver { public post = (event: BaseEvent) => { diff --git a/src/shared/observers/csharpLoggerObserver.ts b/src/shared/observers/csharpLoggerObserver.ts index e702586214..3915e1fa24 100644 --- a/src/shared/observers/csharpLoggerObserver.ts +++ b/src/shared/observers/csharpLoggerObserver.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { BaseLoggerObserver } from './baseLoggerObserver'; -import * as Event from '../../shared/loggingEvents'; -import { PackageError } from '../../packageManager/packageError'; -import { EventType } from '../eventType'; +import { BaseLoggerObserver } from './baseLoggerObserver.ts'; +import * as Event from '../../shared/loggingEvents.ts'; +import { PackageError } from '../../packageManager/packageError.ts'; +import { EventType } from '../eventType.ts'; export class CsharpLoggerObserver extends BaseLoggerObserver { private dots = 0; diff --git a/src/shared/observers/optionChangeObserver.ts b/src/shared/observers/optionChangeObserver.ts index b35fb396ec..2da51bc0b7 100644 --- a/src/shared/observers/optionChangeObserver.ts +++ b/src/shared/observers/optionChangeObserver.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Observable } from 'rxjs'; -import Disposable from '../../disposable'; +import Disposable from '../../disposable.ts'; import { isDeepStrictEqual } from 'util'; import { CommonOptions, @@ -13,7 +13,7 @@ import { commonOptions, languageServerOptions, omnisharpOptions, -} from '../options'; +} from '../options.ts'; type RelevantOptionValues = { commonOptions: Map; diff --git a/src/shared/observers/utils/showMessage.ts b/src/shared/observers/utils/showMessage.ts index 6771a5dc98..42bb452d0f 100644 --- a/src/shared/observers/utils/showMessage.ts +++ b/src/shared/observers/utils/showMessage.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { MessageOptions, vscode } from '../../../vscodeAdapter'; +import { MessageOptions, vscode } from '../../../vscodeAdapter.ts'; /** * Show an error message toast. diff --git a/src/shared/platform.ts b/src/shared/platform.ts index fc75792c03..1eee6273f8 100644 --- a/src/shared/platform.ts +++ b/src/shared/platform.ts @@ -6,9 +6,11 @@ import * as crypto from 'crypto'; import * as fs from 'fs'; import * as os from 'os'; -import * as util from '../common'; +import { fileURLToPath } from 'url'; +import * as util from '../common.ts'; const unknown = 'unknown'; +const currentDirectory = fileURLToPath(new URL('.', import.meta.url)); /** * There is no standard way on Linux to find the distribution name and version. @@ -180,7 +182,7 @@ export class PlatformInformation { } private static async GetUnixArchitecture(): Promise { - const architecture = (await util.execChildProcess('uname -m', __dirname, process.env)).trim(); + const architecture = (await util.execChildProcess('uname -m', currentDirectory, process.env)).trim(); if (architecture === 'aarch64') { return 'arm64'; } @@ -190,7 +192,7 @@ export class PlatformInformation { // Emulates https://github.com/dotnet/install-scripts/blob/3c6cc06/src/dotnet-install.sh#L187-L189. private static async GetIsMusl(): Promise { try { - const output = await util.execChildProcess('ldd --version', __dirname, process.env); + const output = await util.execChildProcess('ldd --version', currentDirectory, process.env); return output.includes('musl'); } catch (err) { return err instanceof Error ? err.message.includes('musl') : false; diff --git a/src/shared/processPicker.ts b/src/shared/processPicker.ts index 87edaa53a1..3f58545551 100644 --- a/src/shared/processPicker.ts +++ b/src/shared/processPicker.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as child_process from 'child_process'; -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { PlatformInformation } from './platform'; -import { findPowerShell, getExtensionPath } from '../common'; +import { PlatformInformation } from './platform.ts'; +import { findPowerShell, getExtensionPath } from '../common.ts'; export interface AttachItem extends vscode.QuickPickItem { id: string; diff --git a/src/shared/projectConfiguration.ts b/src/shared/projectConfiguration.ts index e774cc24bb..b1b02d5623 100644 --- a/src/shared/projectConfiguration.ts +++ b/src/shared/projectConfiguration.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import * as crypto from 'crypto'; -import { machineIdSync } from 'node-machine-id'; -import { PlatformInformation } from './platform'; -import { ITelemetryReporter, getTelemetryProps } from './telemetryReporter'; -import { DotnetInfo } from './utils/dotnetInfo'; +import nodeMachineId from 'node-machine-id'; +import { PlatformInformation } from './platform.ts'; +import { ITelemetryReporter, getTelemetryProps } from './telemetryReporter.ts'; +import { DotnetInfo } from './utils/dotnetInfo.ts'; export interface ProjectConfigurationMessage { ProjectId: string; @@ -72,7 +72,7 @@ export function reportProjectConfigurationEvent( function createSolutionId(solutionPath: string) { const solutionHash = crypto.createHash('sha256').update(solutionPath).digest('hex'); - const machineId = machineIdSync(); + const machineId = nodeMachineId.machineIdSync(); const machineHash = crypto.createHash('sha256').update(machineId).digest('hex'); return crypto diff --git a/src/shared/reportIssue.ts b/src/shared/reportIssue.ts index 91dabd737c..72a63b4b4a 100644 --- a/src/shared/reportIssue.ts +++ b/src/shared/reportIssue.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver'; +import { IHostExecutableResolver } from '../shared/constants/IHostExecutableResolver.ts'; import { basename, dirname } from 'path'; -import { DotnetInfo } from './utils/dotnetInfo'; -import { CSharpExtensionId } from '../constants/csharpExtensionId'; -import { commonOptions, LanguageServerOptions, languageServerOptions } from './options'; +import { DotnetInfo } from './utils/dotnetInfo.ts'; +import { CSharpExtensionId } from '../constants/csharpExtensionId.ts'; +import { commonOptions, LanguageServerOptions, languageServerOptions } from './options.ts'; export default async function reportIssue( context: vscode.ExtensionContext, diff --git a/src/shared/telemetryReporter.ts b/src/shared/telemetryReporter.ts index a834a388ed..87890d2457 100644 --- a/src/shared/telemetryReporter.ts +++ b/src/shared/telemetryReporter.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from './platform'; +import { PlatformInformation } from './platform.ts'; export interface ITelemetryReporter { sendTelemetryEvent( @@ -14,11 +14,14 @@ export interface ITelemetryReporter { sendTelemetryErrorEvent( eventName: string, properties?: { [key: string]: string }, - measures?: { [key: string]: number }, - errorProps?: string[] + measures?: { [key: string]: number } ): void; } +export interface ITelemetryReporterWithLevel extends ITelemetryReporter { + telemetryLevel: 'all' | 'error' | 'crash' | 'off'; +} + export function getTelemetryProps(platformInfo: PlatformInformation) { const telemetryProps: { [key: string]: string } = { 'platform.architecture': platformInfo.architecture, diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 7c70a1f6e7..bb762674ec 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as path from 'path'; import { parse as parseJsonc } from 'jsonc-parser'; diff --git a/src/shared/utils/getDotnetInfo.ts b/src/shared/utils/getDotnetInfo.ts index 0aa81889c7..38deeffec0 100644 --- a/src/shared/utils/getDotnetInfo.ts +++ b/src/shared/utils/getDotnetInfo.ts @@ -5,9 +5,9 @@ import * as semver from 'semver'; import { join } from 'path'; -import { execChildProcess } from '../../common'; -import { CoreClrDebugUtil } from '../../coreclrDebug/util'; -import { DotnetInfo, RuntimeInfo } from './dotnetInfo'; +import { execChildProcess } from '../../common.ts'; +import { CoreClrDebugUtil } from '../../coreclrDebug/util.ts'; +import { DotnetInfo, RuntimeInfo } from './dotnetInfo.ts'; import { EOL } from 'os'; // This function calls `dotnet --info` and returns the result as a DotnetInfo object. diff --git a/src/shared/workspaceConfigurationProvider.ts b/src/shared/workspaceConfigurationProvider.ts index 904ec1513f..87227d03c7 100644 --- a/src/shared/workspaceConfigurationProvider.ts +++ b/src/shared/workspaceConfigurationProvider.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as vscode from 'vscode'; import { @@ -13,12 +13,12 @@ import { createAttachConfiguration, createFallbackLaunchConfiguration, getBuildOperations, -} from './assets'; +} from './assets.ts'; import { parse } from 'jsonc-parser'; -import { IWorkspaceDebugInformationProvider } from './IWorkspaceDebugInformationProvider'; -import { PlatformInformation } from './platform'; -import { BaseVsDbgConfigurationProvider } from './configurationProvider'; -import { showErrorMessage } from './observers/utils/showMessage'; +import { IWorkspaceDebugInformationProvider } from './IWorkspaceDebugInformationProvider.ts'; +import { PlatformInformation } from './platform.ts'; +import { BaseVsDbgConfigurationProvider } from './configurationProvider.ts'; +import { showErrorMessage } from './observers/utils/showMessage.ts'; /** * This class will be used for providing debug configurations given workspace information. diff --git a/src/statusBarItemAdapter.ts b/src/statusBarItemAdapter.ts index 5c62196679..c42fe69181 100644 --- a/src/statusBarItemAdapter.ts +++ b/src/statusBarItemAdapter.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscodeAdapter from './vscodeAdapter'; +import * as vscodeAdapter from './vscodeAdapter.ts'; import * as vscode from 'vscode'; export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem { diff --git a/src/textEditorAdapter.ts b/src/textEditorAdapter.ts index de9e73b13b..31ac7112c8 100644 --- a/src/textEditorAdapter.ts +++ b/src/textEditorAdapter.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscodeAdapter from './vscodeAdapter'; +import * as vscodeAdapter from './vscodeAdapter.ts'; import * as vscode from 'vscode'; export class TextEditorAdapter implements vscodeAdapter.TextEditor { diff --git a/src/tools/runtimeDependencyPackageUtils.ts b/src/tools/runtimeDependencyPackageUtils.ts index d5342b4e27..62322f0a89 100644 --- a/src/tools/runtimeDependencyPackageUtils.ts +++ b/src/tools/runtimeDependencyPackageUtils.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { PlatformInformation } from '../shared/platform'; -import { AbsolutePathPackage } from '../packageManager/absolutePathPackage'; -import { filterPlatformPackages } from '../packageManager/packageFilterer'; -import { Package } from '../packageManager/package'; +import { PlatformInformation } from '../shared/platform.ts'; +import { AbsolutePathPackage } from '../packageManager/absolutePathPackage.ts'; +import { filterPlatformPackages } from '../packageManager/packageFilterer.ts'; +import { Package } from '../packageManager/package.ts'; export function getRuntimeDependencyPackageWithId( packageId: string, diff --git a/src/tools/updatePackageDependencies.ts b/src/tools/updatePackageDependencies.ts index dd94414dfb..7aa1d8bf37 100644 --- a/src/tools/updatePackageDependencies.ts +++ b/src/tools/updatePackageDependencies.ts @@ -5,13 +5,13 @@ import * as fs from 'fs'; import * as os from 'os'; -import { Package } from '../packageManager/package'; -import { DownloadFile } from '../packageManager/fileDownloader'; -import { EventStream } from '../eventStream'; -import * as Event from '../shared/loggingEvents'; -import NetworkSettings, { NetworkSettingsProvider } from '../networkSettings'; -import { getBufferIntegrityHash } from '../packageManager/isValidDownload'; -import { EventType } from '../shared/eventType'; +import { Package } from '../packageManager/package.ts'; +import { DownloadFile } from '../packageManager/fileDownloader.ts'; +import { EventStream } from '../eventStream.ts'; +import * as Event from '../shared/loggingEvents.ts'; +import NetworkSettings, { NetworkSettingsProvider } from '../networkSettings.ts'; +import { getBufferIntegrityHash } from '../packageManager/isValidDownload.ts'; +import { EventType } from '../shared/eventType.ts'; interface PackageJSONFile { runtimeDependencies: Package[]; diff --git a/src/utils/dotnetDevCertsHttps.ts b/src/utils/dotnetDevCertsHttps.ts index 9f7a20604f..1f1a851d43 100644 --- a/src/utils/dotnetDevCertsHttps.ts +++ b/src/utils/dotnetDevCertsHttps.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as cp from 'child_process'; -import { getExtensionPath } from '../common'; -import { commonOptions, omnisharpOptions } from '../shared/options'; +import { getExtensionPath } from '../common.ts'; +import { commonOptions, omnisharpOptions } from '../shared/options.ts'; // Will return true if `dotnet dev-certs https --check` succesfully finds a trusted development certificate. export async function hasDotnetDevCertsHttps(): Promise { diff --git a/src/utils/getCSharpDevKit.ts b/src/utils/getCSharpDevKit.ts index fcbcbd9e9c..bca7f69d3f 100644 --- a/src/utils/getCSharpDevKit.ts +++ b/src/utils/getCSharpDevKit.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { CSharpDevKitExports } from '../csharpDevKitExports'; -import { languageServerOptions } from '../shared/options'; +import { CSharpDevKitExports } from '../csharpDevKitExports.ts'; +import { languageServerOptions } from '../shared/options.ts'; export const csharpDevkitExtensionId = 'ms-dotnettools.csdevkit'; export const csharpDevkitIntelliCodeExtensionId = 'ms-dotnettools.vscodeintellicode-csharp'; diff --git a/src/utils/getMonoVersion.ts b/src/utils/getMonoVersion.ts index 55814461e1..ab06680736 100644 --- a/src/utils/getMonoVersion.ts +++ b/src/utils/getMonoVersion.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { spawn } from 'child_process'; -import { IGetMonoVersion } from '../constants/IGetMonoVersion'; +import { IGetMonoVersion } from '../constants/IGetMonoVersion.ts'; export const getMonoVersion: IGetMonoVersion = async (environment: NodeJS.ProcessEnv) => { const versionRegexp = /(\d+\.\d+\.\d+)/; diff --git a/src/utils/getMsBuildInfo.ts b/src/utils/getMsBuildInfo.ts index fe608c73f1..3618534a83 100644 --- a/src/utils/getMsBuildInfo.ts +++ b/src/utils/getMsBuildInfo.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { join } from 'path'; -import { execChildProcess } from '../common'; -import { CoreClrDebugUtil } from '../coreclrDebug/util'; +import { execChildProcess } from '../common.ts'; +import { CoreClrDebugUtil } from '../coreclrDebug/util.ts'; let _msbuildVersion: string | undefined; diff --git a/tasks/compilation/bundleAudit.mjs b/tasks/compilation/bundleAudit.mjs new file mode 100644 index 0000000000..da23be17ba --- /dev/null +++ b/tasks/compilation/bundleAudit.mjs @@ -0,0 +1,195 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import fs from 'node:fs/promises'; + +const expectedRuntimeRequires = { + '@microsoft/servicehub-framework': ['assert', 'crypto', 'events', 'net', 'os', 'path', 'stream', 'util'], + '@vscode/js-debug-browsers': ['child_process', 'fs', 'os', 'path'], + '@vscode/l10n': ['fs', 'fs/promises'], + 'agent-base': ['http', 'https', 'net'], + archiver: ['buffer', 'events', 'fs', 'path', 'stream', 'util', 'zlib'], + 'archiver-utils': ['path', 'stream', 'util'], + bl: ['buffer', 'events', 'stream', 'util'], + 'buffer-crc32': ['buffer'], + 'compress-commons': ['buffer', 'events', 'stream', 'util'], + 'crc32-stream': ['buffer', 'events', 'stream', 'util', 'zlib'], + 'cross-spawn': ['child_process', 'fs', 'path'], + debug: ['tty', 'util'], + execa: ['child_process', 'os', 'path'], + 'fs-constants': ['constants', 'fs'], + 'fs-extra': ['path'], + 'fs.realpath': ['fs', 'path'], + 'get-stream': ['buffer', 'stream'], + glob: ['assert', 'events', 'fs', 'path', 'util'], + 'graceful-fs': ['assert', 'constants', 'fs', 'stream', 'util'], + 'http-proxy-agent': ['events', 'net', 'tls'], + 'https-proxy-agent': ['assert', 'net', 'tls'], + inherits: ['util'], + isexe: ['fs'], + jsonfile: ['fs'], + lazystream: ['util'], + 'merge-stream': ['stream'], + // Razor is a version-pinned component tarball. Update it through component servicing, not npm. + 'microsoft.aspnetcore.razor.vscode': [ + 'child_process', + 'crypto', + 'events', + 'fs', + 'net', + 'os', + 'path', + 'url', + 'util', + 'vscode', + ], + minimatch: ['path'], + 'msgpack-lite': ['stream', 'util'], + 'nerdbank-streams': ['crypto', 'events', 'stream'], + 'node-machine-id': ['child_process', 'crypto'], + 'npm-run-path': ['path'], + 'ps-list': ['child_process', 'path', 'util'], + pump: ['fs'], + 'readable-stream': ['events', 'stream', 'util'], + 'readdir-glob': ['events', 'fs', 'path'], + 'safe-buffer': ['buffer'], + 'signal-exit': ['assert', 'events'], + 'supports-color': ['os', 'tty'], + 'tar-stream': ['buffer', 'events', 'stream', 'string_decoder', 'util'], + 'util-deprecate': ['util'], + 'vscode-jsonrpc': ['crypto', 'fs', 'net', 'os', 'path', 'util'], + 'vscode-languageclient': ['child_process', 'fs', 'path', 'readline', 'vscode'], + which: ['path'], + yauzl: ['events', 'fs', 'stream', 'util', 'zlib'], + 'zip-stream': ['util'], +}; + +function getPackageOwner(inputPath) { + const normalizedPath = inputPath.replaceAll('\\', '/'); + const marker = 'node_modules/'; + const markerIndex = normalizedPath.indexOf(marker); + if (markerIndex < 0) { + return undefined; + } + + const [firstSegment, secondSegment] = normalizedPath.slice(markerIndex + marker.length).split('/'); + return firstSegment.startsWith('@') ? `${firstSegment}/${secondSegment}` : firstSegment; +} + +function getRuntimeRequires(metafile) { + const packageRequires = new Map(); + const firstPartyRequires = []; + + for (const [inputPath, input] of Object.entries(metafile.inputs)) { + for (const imported of input.imports) { + if (!imported.external || !['require-call', 'require-resolve'].includes(imported.kind)) { + continue; + } + + const packageOwner = getPackageOwner(inputPath); + if (!packageOwner) { + firstPartyRequires.push(`${inputPath} -> ${imported.path}`); + continue; + } + + let record = packageRequires.get(packageOwner); + if (!record) { + record = { imports: 0, inputs: new Set(), targets: new Set() }; + packageRequires.set(packageOwner, record); + } + + record.imports++; + record.inputs.add(inputPath); + record.targets.add(imported.path); + } + } + + return { firstPartyRequires, packageRequires }; +} + +function getDifferences(left, right) { + return [...left].filter((value) => !right.has(value)).sort(); +} + +function validateRuntimeRequires(firstPartyRequires, packageRequires) { + const issues = []; + if (firstPartyRequires.length > 0) { + issues.push(`First-party source emitted CommonJS runtime requires: ${firstPartyRequires.join(', ')}`); + } + + const expectedPackages = new Set(Object.keys(expectedRuntimeRequires)); + const actualPackages = new Set(packageRequires.keys()); + const unexpectedPackages = getDifferences(actualPackages, expectedPackages); + const stalePackages = getDifferences(expectedPackages, actualPackages); + + if (unexpectedPackages.length > 0) { + issues.push(`Review and allowlist new bridge owners: ${unexpectedPackages.join(', ')}`); + } + if (stalePackages.length > 0) { + issues.push(`Remove bridge owners that no longer require it: ${stalePackages.join(', ')}`); + } + + for (const packageName of [...expectedPackages].filter((name) => actualPackages.has(name)).sort()) { + const expectedTargets = new Set(expectedRuntimeRequires[packageName]); + const actualTargets = packageRequires.get(packageName).targets; + const addedTargets = getDifferences(actualTargets, expectedTargets); + const removedTargets = getDifferences(expectedTargets, actualTargets); + + if (addedTargets.length > 0) { + issues.push(`${packageName} added runtime requires: ${addedTargets.join(', ')}`); + } + if (removedTargets.length > 0) { + issues.push(`${packageName} no longer requires: ${removedTargets.join(', ')}`); + } + } + + if (issues.length > 0) { + throw new Error(`Bundle runtime require audit failed:\n- ${issues.join('\n- ')}`); + } +} + +function validateEsmOutput(metafile) { + const output = Object.entries(metafile.outputs).find(([outputPath]) => + outputPath.replaceAll('\\', '/').endsWith('dist/extension.mjs') + )?.[1]; + if (!output) { + throw new Error('Bundle runtime require audit could not find dist/extension.mjs in the esbuild metafile.'); + } + + if (output.exports.length !== 1 || output.exports[0] !== 'activate') { + throw new Error(`Expected the extension bundle to export only activate; found: ${output.exports.join(', ')}`); + } + + if (!output.imports.some((imported) => imported.path === 'vscode' && imported.kind === 'import-statement')) { + throw new Error('Expected the extension bundle to use a native ESM import for vscode.'); + } +} + +export async function auditBundle(metafile, production) { + if (!metafile) { + throw new Error('Bundle runtime require audit requires an esbuild metafile.'); + } + + const { firstPartyRequires, packageRequires } = getRuntimeRequires(metafile); + validateRuntimeRequires(firstPartyRequires, packageRequires); + validateEsmOutput(metafile); + + const packageJson = JSON.parse(await fs.readFile('package.json', 'utf8')); + const directDependencies = new Set(Object.keys(packageJson.dependencies)); + const packageNames = [...packageRequires.keys()].sort(); + const directOwners = packageNames.filter((name) => directDependencies.has(name)); + const transitiveOwners = packageNames.filter((name) => !directDependencies.has(name)); + const vscodeOwners = packageNames.filter((name) => packageRequires.get(name).targets.has('vscode')); + const moduleCount = new Set([...packageRequires.values()].flatMap((record) => [...record.inputs])).size; + const importCount = [...packageRequires.values()].reduce((count, record) => count + record.imports, 0); + const mode = production ? 'production' : 'development'; + + console.log( + `[bundle-audit] ${mode}: ${packageNames.length} owners, ${moduleCount} modules, ${importCount} runtime requires` + ); + console.log(`[bundle-audit] direct/component: ${directOwners.join(', ')}`); + console.log(`[bundle-audit] transitive: ${transitiveOwners.join(', ')}`); + console.log(`[bundle-audit] require("vscode"): ${vscodeOwners.join(', ')}`); +} diff --git a/tasks/components/publishRoslynCopilot.ts b/tasks/components/publishRoslynCopilot.ts index 37f9169698..9fbdd645b3 100644 --- a/tasks/components/publishRoslynCopilot.ts +++ b/tasks/components/publishRoslynCopilot.ts @@ -14,9 +14,9 @@ import { createPullRequest, doesBranchExist, findPRByTitle, -} from '../gitTasks'; -import { updatePackageDependencies } from '../../src/tools/updatePackageDependencies'; -import { runTask } from '../runTask'; +} from '../gitTasks.ts'; +import { updatePackageDependencies } from '../../src/tools/updatePackageDependencies.ts'; +import { runTask } from '../runTask.ts'; type Options = { userName?: string; diff --git a/tasks/debugger/fixLocUrls.ts b/tasks/debugger/fixLocUrls.ts index 05b93dc23a..dcfd76828c 100644 --- a/tasks/debugger/fixLocUrls.ts +++ b/tasks/debugger/fixLocUrls.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as os from 'os'; -import { runTask } from '../runTask'; +import { runTask } from '../runTask.ts'; runTask(fixLocUrls); diff --git a/tasks/debugger/generateOptionsSchema.ts b/tasks/debugger/generateOptionsSchema.ts index 82452807c5..d19883eeb7 100644 --- a/tasks/debugger/generateOptionsSchema.ts +++ b/tasks/debugger/generateOptionsSchema.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as optionsSchemaGenerator from '../../src/tools/generateOptionsSchema'; -import { runTask } from '../runTask'; +import * as optionsSchemaGenerator from '../../src/tools/generateOptionsSchema.ts'; +import { runTask } from '../runTask.ts'; runTask(optionsSchemaGenerator.GenerateOptionsSchema); diff --git a/tasks/debugger/updatePackageDependencies.ts b/tasks/debugger/updatePackageDependencies.ts index 4b68bf66cb..e1944165d4 100644 --- a/tasks/debugger/updatePackageDependencies.ts +++ b/tasks/debugger/updatePackageDependencies.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as packageDependencyUpdater from '../../src/tools/updatePackageDependencies'; -import { runTask } from '../runTask'; +import * as packageDependencyUpdater from '../../src/tools/updatePackageDependencies.ts'; +import { runTask } from '../runTask.ts'; runTask(packageDependencyUpdater.updatePackageDependencies); diff --git a/tasks/localization/publishLocalizationContent.ts b/tasks/localization/publishLocalizationContent.ts index 7939328368..2b8a9bb261 100644 --- a/tasks/localization/publishLocalizationContent.ts +++ b/tasks/localization/publishLocalizationContent.ts @@ -10,7 +10,7 @@ import * as path from 'path'; import * as util from 'node:util'; import { EOL } from 'node:os'; import { Octokit } from '@octokit/rest'; -import { runTask } from '../runTask'; +import { runTask } from '../runTask.ts'; type Options = { userName?: string; diff --git a/tasks/packaging/installDependencies.ts b/tasks/packaging/installDependencies.ts index 0f1cf530bb..15255ddf1e 100644 --- a/tasks/packaging/installDependencies.ts +++ b/tasks/packaging/installDependencies.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { installDependencies } from './offlinePackagingTasks'; -import { runTask } from '../runTask'; +import { installDependencies } from './offlinePackagingTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(installDependencies); diff --git a/tasks/packaging/installDependenciesClean.ts b/tasks/packaging/installDependenciesClean.ts index cbb8b10d0f..6f6d605805 100644 --- a/tasks/packaging/installDependenciesClean.ts +++ b/tasks/packaging/installDependenciesClean.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { installDependencies } from './offlinePackagingTasks'; -import { runTask } from '../runTask'; +import { installDependencies } from './offlinePackagingTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(async () => installDependencies(/* clean */ true)); diff --git a/tasks/packaging/offlinePackagingTasks.ts b/tasks/packaging/offlinePackagingTasks.ts index a273feb7db..6c1e2906d6 100644 --- a/tasks/packaging/offlinePackagingTasks.ts +++ b/tasks/packaging/offlinePackagingTasks.ts @@ -5,16 +5,16 @@ import * as cp from 'child_process'; import * as fs from 'fs'; -import * as fsextra from 'fs-extra'; +import fsextra from 'fs-extra'; import * as nbgv from 'nerdbank-gitversioning'; -import { Logger } from '../../src/logger'; -import { PlatformInformation } from '../../src/shared/platform'; -import { CsharpLoggerObserver } from '../../src/shared/observers/csharpLoggerObserver'; -import { EventStream } from '../../src/eventStream'; -import NetworkSettings from '../../src/networkSettings'; -import { downloadAndInstallPackages } from '../../src/packageManager/downloadAndInstallPackages'; -import { getRuntimeDependenciesPackages } from '../../src/tools/runtimeDependencyPackageUtils'; -import { getAbsolutePathPackagesToInstall } from '../../src/packageManager/getAbsolutePathPackagesToInstall'; +import { Logger } from '../../src/logger.ts'; +import { PlatformInformation } from '../../src/shared/platform.ts'; +import { CsharpLoggerObserver } from '../../src/shared/observers/csharpLoggerObserver.ts'; +import { EventStream } from '../../src/eventStream.ts'; +import NetworkSettings from '../../src/networkSettings.ts'; +import { downloadAndInstallPackages } from '../../src/packageManager/downloadAndInstallPackages.ts'; +import { getRuntimeDependenciesPackages } from '../../src/tools/runtimeDependencyPackageUtils.ts'; +import { getAbsolutePathPackagesToInstall } from '../../src/packageManager/getAbsolutePathPackagesToInstall.ts'; import { codeExtensionPath, packedVsixOutputRoot, @@ -24,10 +24,10 @@ import { devKitDependenciesDirectory, xamlToolsDirectory, testDiscoveryDirectory, -} from '../projectPaths'; -import { getPackageJSON } from '../packageJson'; -import { createPackageAsync, generateVsixManifest } from './vsceTasks'; -import { isValidDownload } from '../../src/packageManager/isValidDownload'; +} from '../projectPaths.ts'; +import { getPackageJSON } from '../packageJson.ts'; +import { createPackageAsync, generateVsixManifest } from './vsceTasks.ts'; +import { isValidDownload } from '../../src/packageManager/isValidDownload.ts'; import path from 'path'; import { CancellationToken } from 'vscode'; diff --git a/tasks/packaging/updateRoslynVersion.ts b/tasks/packaging/updateRoslynVersion.ts index 78177d2fc2..8c615c19db 100644 --- a/tasks/packaging/updateRoslynVersion.ts +++ b/tasks/packaging/updateRoslynVersion.ts @@ -8,9 +8,9 @@ import { allNugetPackages, installDependencies, updateNugetPackageVersion, -} from './offlinePackagingTasks'; -import { runTask } from '../runTask'; -import { getPackageJSON } from '../packageJson'; +} from './offlinePackagingTasks.ts'; +import { runTask } from '../runTask.ts'; +import { getPackageJSON } from '../packageJson.ts'; runTask(updateRoslynVersion); diff --git a/tasks/packaging/vsceTasks.ts b/tasks/packaging/vsceTasks.ts index 040d24958f..b4cfca06fa 100644 --- a/tasks/packaging/vsceTasks.ts +++ b/tasks/packaging/vsceTasks.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import * as path from 'path'; -import * as util from '../../src/common'; +import * as util from '../../src/common.ts'; import * as fs from 'fs'; -import spawnNode from '../spawnNode'; -import { vscePath } from '../projectPaths'; +import spawnNode from '../spawnNode.ts'; +import { vscePath } from '../projectPaths.ts'; /// Packaging (VSIX) Tasks export async function createPackageAsync( diff --git a/tasks/packaging/vsixReleasePackage.ts b/tasks/packaging/vsixReleasePackage.ts index 17e238f6de..08a37a1491 100644 --- a/tasks/packaging/vsixReleasePackage.ts +++ b/tasks/packaging/vsixReleasePackage.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import minimist from 'minimist'; -import { vsixReleasePackageTask } from './offlinePackagingTasks'; -import { runTask } from '../runTask'; +import { vsixReleasePackageTask } from './offlinePackagingTasks.ts'; +import { runTask } from '../runTask.ts'; const argv = minimist(process.argv.slice(2)); runTask(async () => await vsixReleasePackageTask(!!argv.prerelease)); diff --git a/tasks/profiling/profiling.ts b/tasks/profiling/profiling.ts index f6ccaea6d1..85d158026d 100644 --- a/tasks/profiling/profiling.ts +++ b/tasks/profiling/profiling.ts @@ -5,10 +5,10 @@ import fs from 'fs'; import * as path from 'path'; -import { basicSlnTestProject, runIntegrationTest } from '../tests/testHelpers'; -import { outPath } from '../projectPaths'; +import { basicSlnTestProject, runIntegrationTest } from '../tests/testHelpers.ts'; +import { outPath } from '../projectPaths.ts'; import { execSync } from 'child_process'; -import { runTask } from '../runTask'; +import { runTask } from '../runTask.ts'; const profilingOutputFolder = path.join(outPath, 'profiling'); diff --git a/tasks/projectPaths.ts b/tasks/projectPaths.ts index 0972ed0bf4..9b34483b50 100644 --- a/tasks/projectPaths.ts +++ b/tasks/projectPaths.ts @@ -4,10 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as path from 'path'; -import { commandLineOptions } from './commandLineArguments'; -import { componentInfo } from '../src/lsptoolshost/extensions/builtInComponents'; +import { fileURLToPath } from 'url'; +import { commandLineOptions } from './commandLineArguments.ts'; +import { componentInfo } from '../src/lsptoolshost/extensions/builtInComponents.ts'; -export const rootPath = path.resolve(__dirname, '..'); +export const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const nodeModulesPath = path.join(rootPath, 'node_modules'); export const vscePath = path.join(nodeModulesPath, '@vscode', 'vsce', 'vsce'); diff --git a/tasks/signing/installSignPlugin.ts b/tasks/signing/installSignPlugin.ts index 3a3ad49344..13770e14ef 100644 --- a/tasks/signing/installSignPlugin.ts +++ b/tasks/signing/installSignPlugin.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import path from 'path'; -import { rootPath } from '../projectPaths'; -import { execDotnet } from './signingTasks'; -import { runTask } from '../runTask'; +import { rootPath } from '../projectPaths.ts'; +import { execDotnet } from './signingTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(installSignPlugin); diff --git a/tasks/signing/signJs.ts b/tasks/signing/signJs.ts index 91bc89969a..a2d1b0c32c 100644 --- a/tasks/signing/signJs.ts +++ b/tasks/signing/signJs.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import path from 'path'; -import { rootPath } from '../projectPaths'; -import { execDotnet, getLogPath } from './signingTasks'; -import { runTask } from '../runTask'; +import { rootPath } from '../projectPaths.ts'; +import { execDotnet, getLogPath } from './signingTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(signJs); diff --git a/tasks/signing/signVsix.ts b/tasks/signing/signVsix.ts index e38c05dd10..84a6f116db 100644 --- a/tasks/signing/signVsix.ts +++ b/tasks/signing/signVsix.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import path from 'path'; -import { rootPath } from '../projectPaths'; -import { execDotnet, getLogPath } from './signingTasks'; -import { runTask } from '../runTask'; +import { rootPath } from '../projectPaths.ts'; +import { execDotnet, getLogPath } from './signingTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(signVsix); diff --git a/tasks/signing/signingTasks.ts b/tasks/signing/signingTasks.ts index 19db4aaff3..26112189ba 100644 --- a/tasks/signing/signingTasks.ts +++ b/tasks/signing/signingTasks.ts @@ -5,7 +5,7 @@ import * as cp from 'child_process'; import * as fs from 'fs'; -import { rootPath } from '../projectPaths'; +import { rootPath } from '../projectPaths.ts'; import path from 'path'; export function getLogPath(): string { diff --git a/tasks/signing/verifyVsix.ts b/tasks/signing/verifyVsix.ts index d5eab1f3cf..96d99349b8 100644 --- a/tasks/signing/verifyVsix.ts +++ b/tasks/signing/verifyVsix.ts @@ -5,8 +5,8 @@ import * as fs from 'fs'; import path from 'path'; -import { verifySignature } from '../packaging/vsceTasks'; -import { runTask } from '../runTask'; +import { verifySignature } from '../packaging/vsceTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(verifyVsix); diff --git a/tasks/snap/incrementVersion.ts b/tasks/snap/incrementVersion.ts index 0489adf690..8ab0199d1e 100644 --- a/tasks/snap/incrementVersion.ts +++ b/tasks/snap/incrementVersion.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import minimist from 'minimist'; -import { addChangelogSection, getNextReleaseVersion, readVersionJson, writeVersionJson } from './snapTasks'; -import { runTask } from '../runTask'; +import { addChangelogSection, getNextReleaseVersion, readVersionJson, writeVersionJson } from './snapTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(incrementVersion); diff --git a/tasks/snap/snapTasks.ts b/tasks/snap/snapTasks.ts index d7c3e3a7f0..fa6d46bc07 100644 --- a/tasks/snap/snapTasks.ts +++ b/tasks/snap/snapTasks.ts @@ -6,7 +6,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as os from 'os'; -import { rootPath } from '../projectPaths'; +import { rootPath } from '../projectPaths.ts'; /** * Calculate the next release (stable) version from the current version. diff --git a/tasks/snap/updateChangelog.ts b/tasks/snap/updateChangelog.ts index dd8f23f25c..701f0869d2 100644 --- a/tasks/snap/updateChangelog.ts +++ b/tasks/snap/updateChangelog.ts @@ -8,9 +8,9 @@ import * as path from 'path'; import * as os from 'os'; import { exec } from 'child_process'; import { promisify } from 'util'; -import { rootPath } from '../projectPaths'; -import { findTagsByVersion } from '../gitTasks'; -import { runTask } from '../runTask'; +import { rootPath } from '../projectPaths.ts'; +import { findTagsByVersion } from '../gitTasks.ts'; +import { runTask } from '../runTask.ts'; const execAsync = promisify(exec); const prRegex = /^\*.+\(PR: \[#(\d+)\]\(/; diff --git a/tasks/snap/updateVersionForStableRelease.ts b/tasks/snap/updateVersionForStableRelease.ts index 461d9df58f..bd69759854 100644 --- a/tasks/snap/updateVersionForStableRelease.ts +++ b/tasks/snap/updateVersionForStableRelease.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { readVersionJson, getNextReleaseVersion, writeVersionJson, addChangelogSection } from './snapTasks'; -import { runTask } from '../runTask'; +import { readVersionJson, getNextReleaseVersion, writeVersionJson, addChangelogSection } from './snapTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(updateVersionForStableRelease); diff --git a/tasks/spawnNode.ts b/tasks/spawnNode.ts index 5ea1987308..bf544e6908 100644 --- a/tasks/spawnNode.ts +++ b/tasks/spawnNode.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { spawnSync, SpawnSyncOptions } from 'child_process'; -import { nodePath, rootPath } from './projectPaths'; +import { nodePath, rootPath } from './projectPaths.ts'; export default async function spawnNode(args?: string[], options?: SpawnSyncOptions) { if (!options) { diff --git a/tasks/tags/createTags.ts b/tasks/tags/createTags.ts index 8b010cd5d8..bd8edca9f9 100644 --- a/tasks/tags/createTags.ts +++ b/tasks/tags/createTags.ts @@ -7,11 +7,11 @@ import * as fs from 'fs'; import { spawnSync } from 'child_process'; import minimist from 'minimist'; import { Octokit } from '@octokit/rest'; -import { allNugetPackages, NugetPackageInfo, platformSpecificPackages } from '../packaging/offlinePackagingTasks'; -import { PlatformInformation } from '../../src/shared/platform'; +import { allNugetPackages, NugetPackageInfo, platformSpecificPackages } from '../packaging/offlinePackagingTasks.ts'; +import { PlatformInformation } from '../../src/shared/platform.ts'; import path from 'path'; -import { runTask } from '../runTask'; -import { rootPath } from '../projectPaths'; +import { runTask } from '../runTask.ts'; +import { rootPath } from '../projectPaths.ts'; runTask(createTags); diff --git a/tasks/tests/omnisharptest.ts b/tasks/tests/omnisharptest.ts index f7cfcf0422..62e0d83ed6 100644 --- a/tasks/tests/omnisharptest.ts +++ b/tasks/tests/omnisharptest.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { omnisharpTestIntegration, omnisharpTestUnit } from './omnisharptestTasks'; -import { runTask } from '../runTask'; +import { omnisharpTestIntegration, omnisharpTestUnit } from './omnisharptestTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(omnisharpTest); diff --git a/tasks/tests/omnisharptestIntegration.ts b/tasks/tests/omnisharptestIntegration.ts index 5a537d7528..150a4ee638 100644 --- a/tasks/tests/omnisharptestIntegration.ts +++ b/tasks/tests/omnisharptestIntegration.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { omnisharpTestIntegration } from './omnisharptestTasks'; -import { runTask } from '../runTask'; +import { omnisharpTestIntegration } from './omnisharptestTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(omnisharpTestIntegration); diff --git a/tasks/tests/omnisharptestTasks.ts b/tasks/tests/omnisharptestTasks.ts index a74e229d58..ed5357b1dc 100644 --- a/tasks/tests/omnisharptestTasks.ts +++ b/tasks/tests/omnisharptestTasks.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import path from 'path'; -import { codeExtensionPath, rootPath } from '../projectPaths'; -import { runJestIntegrationTest, runJestTest } from './testHelpers'; -import { jestOmniSharpUnitTestProjectName } from '../../test/omnisharp/omnisharpUnitTests/jest.config'; +import { codeExtensionPath, rootPath } from '../projectPaths.ts'; +import { runJestIntegrationTest, runJestTest } from './testHelpers.ts'; +import { jestProjectNames } from '../../test/jestProjectNames.mjs'; const omnisharpIntegrationTestProjects = ['singleCsproj', 'slnWithCsproj', 'slnFilterWithCsproj', 'BasicRazorApp2_1']; export async function omnisharpTestUnit(): Promise { - await runJestTest(jestOmniSharpUnitTestProjectName); + await runJestTest(jestProjectNames.omnisharpUnit); } export async function omnisharpTestIntegration(skipLsp: boolean = false): Promise { diff --git a/tasks/tests/omnisharptestUnit.ts b/tasks/tests/omnisharptestUnit.ts index 49dc4d9f37..e3e395325f 100644 --- a/tasks/tests/omnisharptestUnit.ts +++ b/tasks/tests/omnisharptestUnit.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { omnisharpTestUnit } from './omnisharptestTasks'; -import { runTask } from '../runTask'; +import { omnisharpTestUnit } from './omnisharptestTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(omnisharpTestUnit); diff --git a/tasks/tests/test.ts b/tasks/tests/test.ts index 3491d03160..bd6efc6c18 100644 --- a/tasks/tests/test.ts +++ b/tasks/tests/test.ts @@ -10,8 +10,8 @@ import { testIntegrationRazorCohost, testIntegrationUntrusted, testUnit, -} from './testTasks'; -import { runTask } from '../runTask'; +} from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(test); diff --git a/tasks/tests/testArtifacts.ts b/tasks/tests/testArtifacts.ts index 0612f2625d..211393f9f1 100644 --- a/tasks/tests/testArtifacts.ts +++ b/tasks/tests/testArtifacts.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testArtifacts } from './testTasks'; -import { runTask } from '../runTask'; +import { testArtifacts } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testArtifacts); diff --git a/tasks/tests/testHelpers.ts b/tasks/tests/testHelpers.ts index 5f2b00a582..4fe4782c01 100644 --- a/tasks/tests/testHelpers.ts +++ b/tasks/tests/testHelpers.ts @@ -5,10 +5,10 @@ import fs from 'fs'; import * as path from 'path'; -import * as jest from 'jest'; +import jest from 'jest'; import { Config } from '@jest/types'; -import { rootPath, outPath } from '../projectPaths'; -import { prepareVSCodeAndExecuteTests } from '../../test/vscodeLauncher'; +import { rootPath, outPath } from '../projectPaths.ts'; +import { prepareVSCodeAndExecuteTests } from '../../test/vscodeLauncher.ts'; export const basicSlnTestProject = 'slnWithCsproj'; export const integrationTestProjects = [basicSlnTestProject]; @@ -107,7 +107,7 @@ export async function runJestIntegrationTest( throw new Error(`Could not find vscode workspace to open at ${workspacePath}`); } - // The runner (that loads in the vscode process to run tests) is in the test folder in the *output* directory. + // The ESM loader requires the explicit runner file rather than its containing directory. const vscodeRunnerPath = path.join(outPath, testFolderName, 'index.js'); if (!fs.existsSync(vscodeRunnerPath)) { throw new Error(`Could not find vscode runner in out/ at ${vscodeRunnerPath}`); @@ -147,7 +147,7 @@ export function getJUnitFileName(logName: string) { export async function runJestTest(project: string) { process.env.JEST_JUNIT_OUTPUT_NAME = getJUnitFileName(project); process.env.JEST_SUITE_NAME = project; - const configPath = path.join(rootPath, 'jest.config.ts'); + const configPath = path.join(rootPath, 'jest.config.mjs'); const { results } = await jest.runCLI( { diff --git a/tasks/tests/testIntegrationCsharp.ts b/tasks/tests/testIntegrationCsharp.ts index 249988b14e..9e2e14430d 100644 --- a/tasks/tests/testIntegrationCsharp.ts +++ b/tasks/tests/testIntegrationCsharp.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testIntegrationCSharp } from './testTasks'; -import { runTask } from '../runTask'; +import { testIntegrationCSharp } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testIntegrationCSharp); diff --git a/tasks/tests/testIntegrationDevkit.ts b/tasks/tests/testIntegrationDevkit.ts index c47c15560f..456a55a0aa 100644 --- a/tasks/tests/testIntegrationDevkit.ts +++ b/tasks/tests/testIntegrationDevkit.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testIntegrationDevkit } from './testTasks'; -import { runTask } from '../runTask'; +import { testIntegrationDevkit } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testIntegrationDevkit); diff --git a/tasks/tests/testIntegrationRazorCohost.ts b/tasks/tests/testIntegrationRazorCohost.ts index fa3585734b..e505c0882f 100644 --- a/tasks/tests/testIntegrationRazorCohost.ts +++ b/tasks/tests/testIntegrationRazorCohost.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testIntegrationRazorCohost } from './testTasks'; -import { runTask } from '../runTask'; +import { testIntegrationRazorCohost } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testIntegrationRazorCohost); diff --git a/tasks/tests/testIntegrationUntrusted.ts b/tasks/tests/testIntegrationUntrusted.ts index d17e7baaa4..168318e4fe 100644 --- a/tasks/tests/testIntegrationUntrusted.ts +++ b/tasks/tests/testIntegrationUntrusted.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testIntegrationUntrusted } from './testTasks'; -import { runTask } from '../runTask'; +import { testIntegrationUntrusted } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testIntegrationUntrusted); diff --git a/tasks/tests/testTasks.ts b/tasks/tests/testTasks.ts index 8bf8dd0f23..93f5f2c424 100644 --- a/tasks/tests/testTasks.ts +++ b/tasks/tests/testTasks.ts @@ -4,16 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import path from 'path'; -import { integrationTestProjects, runDevKitIntegrationTests, runIntegrationTest, runJestTest } from './testHelpers'; -import { jestArtifactTestsProjectName } from '../../test/lsptoolshost/artifactTests/jest.config'; -import { jestUnitTestProjectName } from '../../test/lsptoolshost/unitTests/jest.config'; -import { razorTestProjectName } from '../../test/razor/razorTests/jest.config'; -import { jestTasksTestProjectName } from '../../test/tasks/jest.config'; +import { integrationTestProjects, runDevKitIntegrationTests, runIntegrationTest, runJestTest } from './testHelpers.ts'; +import { jestProjectNames } from '../../test/jestProjectNames.mjs'; const razorIntegrationTestProjects = ['RazorApp']; export async function testArtifacts(): Promise { - await runJestTest(jestArtifactTestsProjectName); + await runJestTest(jestProjectNames.artifact); } export async function testIntegrationCSharp(): Promise { @@ -43,7 +40,7 @@ export async function testIntegrationUntrusted(): Promise { } export async function testUnit(): Promise { - await runJestTest(jestUnitTestProjectName); - await runJestTest(razorTestProjectName); - await runJestTest(jestTasksTestProjectName); + await runJestTest(jestProjectNames.unit); + await runJestTest(jestProjectNames.razorUnit); + await runJestTest(jestProjectNames.tasksUnit); } diff --git a/tasks/tests/testUnit.ts b/tasks/tests/testUnit.ts index a1a25d13e2..d672ae7dbd 100644 --- a/tasks/tests/testUnit.ts +++ b/tasks/tests/testUnit.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testUnit } from './testTasks'; -import { runTask } from '../runTask'; +import { testUnit } from './testTasks.ts'; +import { runTask } from '../runTask.ts'; runTask(testUnit); diff --git a/test/createTmpAsset.ts b/test/createTmpAsset.ts index b37a477248..f520debae9 100644 --- a/test/createTmpAsset.ts +++ b/test/createTmpAsset.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as tmp from 'tmp'; -import { remove } from 'fs-extra'; -import { NestedError } from '../src/nestedError'; +import fsExtra from 'fs-extra'; +import { NestedError } from '../src/nestedError.ts'; export async function CreateTmpFile(): Promise { const tmpFile = await new Promise((resolve, reject) => { @@ -43,7 +43,7 @@ export async function CreateTmpDir(unsafeCleanup: boolean): Promise { name: tmpDir.name, dispose: () => { if (unsafeCleanup) { - remove(tmpDir.name).catch((rejectReason) => { + fsExtra.remove(tmpDir.name).catch((rejectReason) => { throw new Error(`Failed to cleanup ${tmpDir.name} at ${tmpDir.fd}: ${rejectReason}`); }); //to delete directories that have folders inside them } else { diff --git a/test/fakes.ts b/test/fakes.ts index fb58b0a4fd..35e656012c 100644 --- a/test/fakes.ts +++ b/test/fakes.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as vscode from '../src/vscodeAdapter'; -import * as protocol from '../src/omnisharp/protocol'; -import { ITelemetryReporter } from '../src/shared/telemetryReporter'; +import * as vscode from '../src/vscodeAdapter.ts'; +import * as protocol from '../src/omnisharp/protocol.ts'; +import { ITelemetryReporter } from '../src/shared/telemetryReporter.ts'; import { OmnisharpServerMsBuildProjectDiagnostics, OmnisharpServerOnError, OmnisharpServerUnresolvedDependencies, WorkspaceInformationUpdated, -} from '../src/omnisharp/omnisharpLoggingEvents'; +} from '../src/omnisharp/omnisharpLoggingEvents.ts'; export const getNullChannel = (): vscode.OutputChannel => { const returnChannel: vscode.OutputChannel = { @@ -50,8 +50,7 @@ export const getNullTelemetryReporter = (): ITelemetryReporter => { sendTelemetryErrorEvent: ( _eventName: string, _properties?: { [key: string]: string }, - _measures?: { [key: string]: number }, - _errorProps?: string[] + _measures?: { [key: string]: number } ) => { /** empty */ }, diff --git a/test/jestProjectNames.d.mts b/test/jestProjectNames.d.mts new file mode 100644 index 0000000000..64adc29abc --- /dev/null +++ b/test/jestProjectNames.d.mts @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export const jestProjectNames: Readonly<{ + artifact: 'Artifact Tests'; + integration: 'Integration Tests'; + omnisharpIntegration: 'OmniSharp Integration Tests'; + omnisharpUnit: 'OmniSharp Unit Tests'; + razorIntegration: 'Razor Integration Tests'; + razorUnit: 'Razor Unit Tests'; + tasksUnit: 'Tasks Unit Tests'; + unit: 'Unit Tests'; + untrustedIntegration: 'Untrusted Integration Tests'; +}>; diff --git a/test/jestProjectNames.mjs b/test/jestProjectNames.mjs new file mode 100644 index 0000000000..8b9f32ba0b --- /dev/null +++ b/test/jestProjectNames.mjs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export const jestProjectNames = Object.freeze({ + artifact: 'Artifact Tests', + integration: 'Integration Tests', + omnisharpIntegration: 'OmniSharp Integration Tests', + omnisharpUnit: 'OmniSharp Unit Tests', + razorIntegration: 'Razor Integration Tests', + razorUnit: 'Razor Unit Tests', + tasksUnit: 'Tasks Unit Tests', + unit: 'Unit Tests', + untrustedIntegration: 'Untrusted Integration Tests', +}); diff --git a/test/lsptoolshost/artifactTests/extensionBundle.test.ts b/test/lsptoolshost/artifactTests/extensionBundle.test.ts new file mode 100644 index 0000000000..a9fc5fe66a --- /dev/null +++ b/test/lsptoolshost/artifactTests/extensionBundle.test.ts @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { describe, expect, test } from '@jest/globals'; +import esbuild from 'esbuild'; +import fs from 'fs-extra'; +import path from 'node:path'; + +const packageJson = fs.readJsonSync(path.resolve('package.json')); +const extensionEntry = path.resolve(packageJson.main); + +describe('Extension bundle', () => { + test('package main points to an existing .mjs file', async () => { + expect(path.extname(packageJson.main)).toBe('.mjs'); + await expect(fs.pathExists(extensionEntry)).resolves.toBe(true); + }); + + test('entry is native ESM with the activation contract', async () => { + const result = await esbuild.build({ + entryPoints: [extensionEntry], + bundle: false, + format: 'esm', + metafile: true, + outdir: 'artifact-audit', + write: false, + }); + const output = Object.values(result.metafile.outputs)[0]; + + expect(output.exports).toEqual(['activate']); + expect(output.imports).toContainEqual({ + external: true, + kind: 'import-statement', + path: 'vscode', + }); + }); + + test('JavaScript signing includes .mjs output', async () => { + const signingProject = await fs.readFile(path.resolve('msbuild/signing/signJs/signJs.proj'), 'utf8'); + expect(signingProject).toContain(''); + }); +}); diff --git a/test/lsptoolshost/artifactTests/jest.config.ts b/test/lsptoolshost/artifactTests/jest.config.mjs similarity index 75% rename from test/lsptoolshost/artifactTests/jest.config.ts rename to test/lsptoolshost/artifactTests/jest.config.mjs index 5135e61343..3612a32958 100644 --- a/test/lsptoolshost/artifactTests/jest.config.ts +++ b/test/lsptoolshost/artifactTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestArtifactTestsProjectName = 'Artifact Tests'; +import { baseProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a jest project configuration for artifact tests. */ -const unitTestConfig: Config = { +/** @type {import('jest').Config} */ +const unitTestConfig = { ...baseProjectConfig, - displayName: jestArtifactTestsProjectName, + displayName: jestProjectNames.artifact, // We need to explicity ignore the out directory for modules - otherwise we'll get duplicate vscode module, // the TS version from the __mocks__ directory and the compiled js version from the out directory. modulePathIgnorePatterns: ['out'], diff --git a/test/lsptoolshost/artifactTests/vsix.test.ts b/test/lsptoolshost/artifactTests/vsix.test.ts index 6491ee692c..038d9ae0bd 100644 --- a/test/lsptoolshost/artifactTests/vsix.test.ts +++ b/test/lsptoolshost/artifactTests/vsix.test.ts @@ -4,11 +4,38 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import * as fs from 'fs-extra'; -import * as glob from 'glob'; +import fs from 'fs-extra'; +import glob from 'glob'; import * as path from 'path'; +import * as yauzl from 'yauzl'; const vsixFiles = glob.sync(path.join(process.cwd(), '**', '*.vsix')); +const packageJson = fs.readJsonSync(path.resolve('package.json')); +const extensionEntry = path.posix.join('extension', packageJson.main.replace(/^\.\//, '')); + +async function getVsixEntries(vsixPath: string): Promise { + return new Promise((resolve, reject) => { + yauzl.open(vsixPath, { lazyEntries: true }, (error, zipFile) => { + if (error) { + reject(error); + return; + } + if (!zipFile) { + reject(new Error(`Unable to open ${vsixPath}`)); + return; + } + + const entries: string[] = []; + zipFile.on('entry', (entry) => { + entries.push(entry.fileName); + zipFile.readEntry(); + }); + zipFile.on('end', () => resolve(entries)); + zipFile.on('error', reject); + zipFile.readEntry(); + }); + }); +} describe('Vscode VSIX', () => { test('At least one vsix file should be produced', () => { @@ -31,6 +58,10 @@ describe('Vscode VSIX', () => { const stats = await fs.stat(element); expect(stats.size).toBeGreaterThan(0); }); + + test('Then it should contain the declared extension entry', async () => { + await expect(getVsixEntries(element)).resolves.toContain(extensionEntry); + }); }); }); }); diff --git a/test/lsptoolshost/integrationTests/buildDiagnostics.integration.test.ts b/test/lsptoolshost/integrationTests/buildDiagnostics.integration.test.ts index 7d49a91670..fbb8b16c43 100644 --- a/test/lsptoolshost/integrationTests/buildDiagnostics.integration.test.ts +++ b/test/lsptoolshost/integrationTests/buildDiagnostics.integration.test.ts @@ -5,12 +5,12 @@ import * as vscode from 'vscode'; import { describe, test, expect, beforeAll, afterAll, beforeEach, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { AnalysisSetting, BuildDiagnosticsService, -} from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService'; -import * as integrationHelpers from './integrationHelpers'; +} from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService.ts'; +import * as integrationHelpers from './integrationHelpers.ts'; import path from 'path'; describe(`Build and live diagnostics dedupe`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/classification.integration.test.ts b/test/lsptoolshost/integrationTests/classification.integration.test.ts index eeb454debd..44c0c7cfa3 100644 --- a/test/lsptoolshost/integrationTests/classification.integration.test.ts +++ b/test/lsptoolshost/integrationTests/classification.integration.test.ts @@ -5,8 +5,8 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; describe(`Classification Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/codeactions.integration.test.ts b/test/lsptoolshost/integrationTests/codeactions.integration.test.ts index e4b0c90bb5..b43b631f8e 100644 --- a/test/lsptoolshost/integrationTests/codeactions.integration.test.ts +++ b/test/lsptoolshost/integrationTests/codeactions.integration.test.ts @@ -6,13 +6,13 @@ import * as vscode from 'vscode'; import * as path from 'path'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, expectText, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; describe(`Code Actions Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/codelens.integration.test.ts b/test/lsptoolshost/integrationTests/codelens.integration.test.ts index 7af16faa2c..4c410f65d8 100644 --- a/test/lsptoolshost/integrationTests/codelens.integration.test.ts +++ b/test/lsptoolshost/integrationTests/codelens.integration.test.ts @@ -7,13 +7,13 @@ import * as lsp from 'vscode-languageclient'; import * as vscode from 'vscode'; import * as path from 'path'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, getCodeLensesAsync, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; describe(`CodeLens Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/commandEnablement.integration.test.ts b/test/lsptoolshost/integrationTests/commandEnablement.integration.test.ts index c84d995fb1..10ca5de019 100644 --- a/test/lsptoolshost/integrationTests/commandEnablement.integration.test.ts +++ b/test/lsptoolshost/integrationTests/commandEnablement.integration.test.ts @@ -5,14 +5,14 @@ import { expect, beforeAll, afterAll, describe } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension, testIfCSharp, testIfDevKit } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import { activateCSharpExtension, testIfCSharp, testIfDevKit } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { RoslynDevKitCommands, RoslynStandaloneCommands, UnexpectedRoslynDevKitCommands, UnexpectedRoslynStandaloneCommands, -} from './expectedCommands'; +} from './expectedCommands.ts'; describe(`Command Enablement Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/completion.integration.test.ts b/test/lsptoolshost/integrationTests/completion.integration.test.ts index 4924a9a99a..3b28517bc7 100644 --- a/test/lsptoolshost/integrationTests/completion.integration.test.ts +++ b/test/lsptoolshost/integrationTests/completion.integration.test.ts @@ -6,13 +6,13 @@ import * as vscode from 'vscode'; import * as path from 'path'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, getCompletionsAsync, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; describe(`Completion Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/diagnosticsHelpers.ts b/test/lsptoolshost/integrationTests/diagnosticsHelpers.ts index fbf6f2fae7..3cb6b3383f 100644 --- a/test/lsptoolshost/integrationTests/diagnosticsHelpers.ts +++ b/test/lsptoolshost/integrationTests/diagnosticsHelpers.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; import { expect } from '@jest/globals'; -import { restartLanguageServer, waitForExpectedResult } from './integrationHelpers'; +import { restartLanguageServer, waitForExpectedResult } from './integrationHelpers.ts'; function sortDiagnostics(diagnostics: vscode.Diagnostic[]): vscode.Diagnostic[] { return diagnostics.sort((a, b) => { diff --git a/test/lsptoolshost/integrationTests/documentDiagnostics.integration.test.ts b/test/lsptoolshost/integrationTests/documentDiagnostics.integration.test.ts index 149d6e6b5b..558cd26c6f 100644 --- a/test/lsptoolshost/integrationTests/documentDiagnostics.integration.test.ts +++ b/test/lsptoolshost/integrationTests/documentDiagnostics.integration.test.ts @@ -5,16 +5,16 @@ import * as vscode from 'vscode'; import { describe, test, beforeAll, afterAll, expect, beforeEach, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { AnalysisSetting } from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { AnalysisSetting } from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService.ts'; import path from 'path'; -import { getCode, setDiagnosticSettings, waitForExpectedDiagnostics } from './diagnosticsHelpers'; +import { getCode, setDiagnosticSettings, waitForExpectedDiagnostics } from './diagnosticsHelpers.ts'; import { activateCSharpExtension, closeAllEditorsAsync, describeIfCSharp, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; // Restarting the server is required for these tests, but not supported with C# Dev Kit. describeIfCSharp(`Document Diagnostics Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/documentSymbolProvider.integration.test.ts b/test/lsptoolshost/integrationTests/documentSymbolProvider.integration.test.ts index bfe1022cd5..6f659af0bf 100644 --- a/test/lsptoolshost/integrationTests/documentSymbolProvider.integration.test.ts +++ b/test/lsptoolshost/integrationTests/documentSymbolProvider.integration.test.ts @@ -6,8 +6,8 @@ import { expect, test, beforeAll, afterAll, describe, afterEach, beforeEach } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers.ts'; describe(`Document Symbol Tests`, () => { let fileUri: vscode.Uri; diff --git a/test/lsptoolshost/integrationTests/fileBasedPrograms.integration.test.ts b/test/lsptoolshost/integrationTests/fileBasedPrograms.integration.test.ts index 362118b3c6..467009639f 100644 --- a/test/lsptoolshost/integrationTests/fileBasedPrograms.integration.test.ts +++ b/test/lsptoolshost/integrationTests/fileBasedPrograms.integration.test.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, @@ -15,9 +15,9 @@ import { waitForAllAsyncOperationsAsync, waitForExpectedResult, describeIfFileBasedPrograms, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; -import { CSharpExtensionExports } from '../../../src/csharpExtensionExports'; +import { CSharpExtensionExports } from '../../../src/csharpExtensionExports.ts'; describeIfFileBasedPrograms(`File-based Programs Tests`, () => { let exports: CSharpExtensionExports; diff --git a/test/lsptoolshost/integrationTests/formatting.integration.test.ts b/test/lsptoolshost/integrationTests/formatting.integration.test.ts index 8549717ec6..9b06957d8c 100644 --- a/test/lsptoolshost/integrationTests/formatting.integration.test.ts +++ b/test/lsptoolshost/integrationTests/formatting.integration.test.ts @@ -5,15 +5,15 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, expectText, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeEach, afterAll, test, afterEach } from '@jest/globals'; -import { formatDocumentAsync, formatOnTypeAsync, formatRangeAsync } from './formattingTestHelpers'; +import { formatDocumentAsync, formatOnTypeAsync, formatRangeAsync } from './formattingTestHelpers.ts'; describe(`Formatting Tests`, () => { beforeEach(async () => { diff --git a/test/lsptoolshost/integrationTests/formattingEditorConfig.integration.test.ts b/test/lsptoolshost/integrationTests/formattingEditorConfig.integration.test.ts index 67452574e1..20e27e770d 100644 --- a/test/lsptoolshost/integrationTests/formattingEditorConfig.integration.test.ts +++ b/test/lsptoolshost/integrationTests/formattingEditorConfig.integration.test.ts @@ -5,15 +5,15 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, expectText, openFileInWorkspaceAsync, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, afterEach } from '@jest/globals'; -import { formatDocumentAsync, formatOnTypeAsync, formatRangeAsync } from './formattingTestHelpers'; +import { formatDocumentAsync, formatOnTypeAsync, formatRangeAsync } from './formattingTestHelpers.ts'; describe(`Formatting With EditorConfig Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts index 6de7304141..a0e8b0fd77 100644 --- a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts +++ b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, @@ -14,7 +14,7 @@ import { openFileInWorkspaceAsync, testIfCSharp, testIfDevKit, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; /** diff --git a/test/lsptoolshost/integrationTests/gotoImplementation.integration.test.ts b/test/lsptoolshost/integrationTests/gotoImplementation.integration.test.ts index f62d694932..f4b40b43de 100644 --- a/test/lsptoolshost/integrationTests/gotoImplementation.integration.test.ts +++ b/test/lsptoolshost/integrationTests/gotoImplementation.integration.test.ts @@ -5,13 +5,13 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync, sortLocations, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; describe(`Go To Implementation Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/hover.integration.test.ts b/test/lsptoolshost/integrationTests/hover.integration.test.ts index ff9a3a3182..73266b1699 100644 --- a/test/lsptoolshost/integrationTests/hover.integration.test.ts +++ b/test/lsptoolshost/integrationTests/hover.integration.test.ts @@ -6,8 +6,8 @@ import * as vscode from 'vscode'; import * as path from 'path'; import { EOL } from 'os'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; describe(`Hover Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/index.ts b/test/lsptoolshost/integrationTests/index.ts index ac2e6a90a2..9e8cfed6e4 100644 --- a/test/lsptoolshost/integrationTests/index.ts +++ b/test/lsptoolshost/integrationTests/index.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { runIntegrationTests } from '../../runIntegrationTests'; -import { jestIntegrationTestProjectName } from './jest.config'; +import { runIntegrationTests } from '../../runIntegrationTests.ts'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; export async function run() { process.env.RUNNING_INTEGRATION_TESTS = 'true'; - await runIntegrationTests(jestIntegrationTestProjectName); + await runIntegrationTests(jestProjectNames.integration); } diff --git a/test/lsptoolshost/integrationTests/integrationHelpers.ts b/test/lsptoolshost/integrationTests/integrationHelpers.ts index 4f87296490..f360dc06a2 100644 --- a/test/lsptoolshost/integrationTests/integrationHelpers.ts +++ b/test/lsptoolshost/integrationTests/integrationHelpers.ts @@ -6,13 +6,13 @@ import * as vscode from 'vscode'; import * as path from 'path'; import * as semver from 'semver'; -import { CSharpExtensionExports } from '../../../src/csharpExtensionExports'; +import { CSharpExtensionExports } from '../../../src/csharpExtensionExports.ts'; import { existsSync } from 'fs'; -import { ServerState } from '../../../src/lsptoolshost/server/languageServerEvents'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import { ServerState } from '../../../src/lsptoolshost/server/languageServerEvents.ts'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { EOL, platform } from 'os'; import { describe, expect, test } from '@jest/globals'; -import { WaitForAsyncOperationsRequest } from './testHooks'; +import { WaitForAsyncOperationsRequest } from './testHooks.ts'; export async function activateCSharpExtension(): Promise { const csharpExtension = vscode.extensions.getExtension('ms-dotnettools.csharp'); diff --git a/test/untrustedWorkspace/integrationTests/jest.config.ts b/test/lsptoolshost/integrationTests/jest.config.mjs similarity index 67% rename from test/untrustedWorkspace/integrationTests/jest.config.ts rename to test/lsptoolshost/integrationTests/jest.config.mjs index 80b28bf20d..73e4ef1f6d 100644 --- a/test/untrustedWorkspace/integrationTests/jest.config.ts +++ b/test/lsptoolshost/integrationTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestIntegrationTestProjectName = 'Untrusted Integration Tests'; +import { baseIntegrationProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a project configuration for jest integration tests. */ -const integrationTestConfig: Config = { - ...baseProjectConfig, - displayName: jestIntegrationTestProjectName, +/** @type {import('jest').Config} */ +const integrationTestConfig = { + ...baseIntegrationProjectConfig, + displayName: jestProjectNames.integration, roots: [''], testEnvironment: '/../../vsCodeEnvironment.ts', setupFilesAfterEnv: ['/../../vsCodeFramework.ts'], diff --git a/test/lsptoolshost/integrationTests/lspInlayHints.integration.test.ts b/test/lsptoolshost/integrationTests/lspInlayHints.integration.test.ts index 678023f11f..2a4ee48af6 100644 --- a/test/lsptoolshost/integrationTests/lspInlayHints.integration.test.ts +++ b/test/lsptoolshost/integrationTests/lspInlayHints.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { describe, beforeAll, afterAll, test, expect, beforeEach, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from './integrationHelpers.ts'; import { InlayHint, InlayHintKind, Position } from 'vscode-languageclient'; describe(`Inlay Hints Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/onAutoInsert.integration.test.ts b/test/lsptoolshost/integrationTests/onAutoInsert.integration.test.ts index 59717573af..d6acc8f749 100644 --- a/test/lsptoolshost/integrationTests/onAutoInsert.integration.test.ts +++ b/test/lsptoolshost/integrationTests/onAutoInsert.integration.test.ts @@ -5,14 +5,14 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync, revertActiveFile, waitForExpectedResult, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; import { EOL } from 'os'; diff --git a/test/lsptoolshost/integrationTests/references.integration.test.ts b/test/lsptoolshost/integrationTests/references.integration.test.ts index f17706c7eb..e1ecdcd6ab 100644 --- a/test/lsptoolshost/integrationTests/references.integration.test.ts +++ b/test/lsptoolshost/integrationTests/references.integration.test.ts @@ -5,13 +5,13 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync, sortLocations, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; describe(`Find References Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/signatureHelp.integration.test.ts b/test/lsptoolshost/integrationTests/signatureHelp.integration.test.ts index 92d0f41117..f68a21312d 100644 --- a/test/lsptoolshost/integrationTests/signatureHelp.integration.test.ts +++ b/test/lsptoolshost/integrationTests/signatureHelp.integration.test.ts @@ -5,8 +5,8 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { activateCSharpExtension, closeAllEditorsAsync, openFileInWorkspaceAsync } from './integrationHelpers.ts'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; describe(`Signature Help Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/sourceGenerator.integration.test.ts b/test/lsptoolshost/integrationTests/sourceGenerator.integration.test.ts index 3acd32e37e..eacfe3584d 100644 --- a/test/lsptoolshost/integrationTests/sourceGenerator.integration.test.ts +++ b/test/lsptoolshost/integrationTests/sourceGenerator.integration.test.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, @@ -13,7 +13,7 @@ import { openFileInWorkspaceAsync, sleep, sortLocations, -} from './integrationHelpers'; +} from './integrationHelpers.ts'; import { beforeAll, beforeEach, afterAll, test, expect, afterEach, describe } from '@jest/globals'; describe(`Source Generator Tests`, () => { diff --git a/test/lsptoolshost/integrationTests/testAssets/razorApp.ts b/test/lsptoolshost/integrationTests/testAssets/razorApp.ts index 7692d29fe8..a65888645b 100644 --- a/test/lsptoolshost/integrationTests/testAssets/razorApp.ts +++ b/test/lsptoolshost/integrationTests/testAssets/razorApp.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace } from './testAssets.ts'; const workspace: ITestAssetWorkspace = { description: 'Razor App', diff --git a/test/lsptoolshost/integrationTests/testAssets/singleCsproj.ts b/test/lsptoolshost/integrationTests/testAssets/singleCsproj.ts index f53fabdbaf..550ce8232b 100644 --- a/test/lsptoolshost/integrationTests/testAssets/singleCsproj.ts +++ b/test/lsptoolshost/integrationTests/testAssets/singleCsproj.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace } from './testAssets.ts'; const workspace: ITestAssetWorkspace = { description: 'single csproj at root of workspace', diff --git a/test/lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj.ts b/test/lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj.ts index 6e9d9ba449..b3fcdac743 100644 --- a/test/lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj.ts +++ b/test/lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace } from './testAssets.ts'; const workspace: ITestAssetWorkspace = { description: "sln filter with a csproj's", diff --git a/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj.ts b/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj.ts index 4973fface7..9e67da8f2c 100644 --- a/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj.ts +++ b/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace } from './testAssets.ts'; const workspace: ITestAssetWorkspace = { description: "sln with several csproj's", diff --git a/test/lsptoolshost/integrationTests/testAssets/slnWithGenerator.ts b/test/lsptoolshost/integrationTests/testAssets/slnWithGenerator.ts index 79a221f780..9fe370615f 100644 --- a/test/lsptoolshost/integrationTests/testAssets/slnWithGenerator.ts +++ b/test/lsptoolshost/integrationTests/testAssets/slnWithGenerator.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace } from './testAssets.ts'; const workspace: ITestAssetWorkspace = { description: 'sln with a source generator', diff --git a/test/lsptoolshost/integrationTests/testAssets/testAssetWorkspace.ts b/test/lsptoolshost/integrationTests/testAssets/testAssetWorkspace.ts index 842ab375ce..241a1467a3 100644 --- a/test/lsptoolshost/integrationTests/testAssets/testAssetWorkspace.ts +++ b/test/lsptoolshost/integrationTests/testAssets/testAssetWorkspace.ts @@ -6,13 +6,13 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import { ITestAssetWorkspace, TestAssetWorkspace } from './testAssets'; +import { ITestAssetWorkspace, TestAssetWorkspace } from './testAssets.ts'; -import singleCsproj from './singleCsproj'; -import slnWithCsproj from './slnWithCsproj'; -import slnFilterWithCsproj from './slnFilterWithCsproj'; -import RazorApp from './razorApp'; -import slnWithGenerator from './slnWithGenerator'; +import singleCsproj from './singleCsproj.ts'; +import slnWithCsproj from './slnWithCsproj.ts'; +import slnFilterWithCsproj from './slnFilterWithCsproj.ts'; +import RazorApp from './razorApp.ts'; +import slnWithGenerator from './slnWithGenerator.ts'; const testAssetWorkspaces: { [x: string]: ITestAssetWorkspace } = { singleCsproj, diff --git a/test/lsptoolshost/integrationTests/testAssets/testAssets.ts b/test/lsptoolshost/integrationTests/testAssets/testAssets.ts index 9c01476336..c019cfd4c5 100644 --- a/test/lsptoolshost/integrationTests/testAssets/testAssets.ts +++ b/test/lsptoolshost/integrationTests/testAssets/testAssets.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as path from 'path'; import * as vscode from 'vscode'; -import spawnGit from './spawnGit'; -import { execChildProcess } from '../../../../src/common'; +import spawnGit from './spawnGit.ts'; +import { execChildProcess } from '../../../../src/common.ts'; export class TestAssetProject { constructor(project: ITestAssetProject) { diff --git a/test/lsptoolshost/integrationTests/unitTests.integration.test.ts b/test/lsptoolshost/integrationTests/unitTests.integration.test.ts index 8753a65607..a2d80ede0f 100644 --- a/test/lsptoolshost/integrationTests/unitTests.integration.test.ts +++ b/test/lsptoolshost/integrationTests/unitTests.integration.test.ts @@ -6,15 +6,15 @@ import * as vscode from 'vscode'; import * as path from 'path'; import { beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; import { activateCSharpExtension, closeAllEditorsAsync, describeIfCSharp, getCodeLensesAsync, openFileInWorkspaceAsync, -} from './integrationHelpers'; -import { TestProgress } from '../../../src/lsptoolshost/server/roslynProtocol'; +} from './integrationHelpers.ts'; +import { TestProgress } from '../../../src/lsptoolshost/server/roslynProtocol.ts'; describeIfCSharp(`Unit Testing Tests`, () => { beforeAll(async () => { diff --git a/test/lsptoolshost/integrationTests/workspaceDiagnostics.integration.test.ts b/test/lsptoolshost/integrationTests/workspaceDiagnostics.integration.test.ts index 50388aa0b7..93d6d8a6ca 100644 --- a/test/lsptoolshost/integrationTests/workspaceDiagnostics.integration.test.ts +++ b/test/lsptoolshost/integrationTests/workspaceDiagnostics.integration.test.ts @@ -5,10 +5,10 @@ import * as vscode from 'vscode'; import { describe, test, expect, beforeAll, afterAll } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import { AnalysisSetting } from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService'; -import { getCode, setDiagnosticSettings, waitForExpectedDiagnostics } from './diagnosticsHelpers'; -import { activateCSharpExtension, describeIfCSharp } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import { AnalysisSetting } from '../../../src/lsptoolshost/diagnostics/buildDiagnosticsService.ts'; +import { getCode, setDiagnosticSettings, waitForExpectedDiagnostics } from './diagnosticsHelpers.ts'; +import { activateCSharpExtension, describeIfCSharp } from './integrationHelpers.ts'; // Restarting the server is required for these tests, but not supported with C# Dev Kit. describeIfCSharp(`Workspace Diagnostic Tests`, () => { diff --git a/test/lsptoolshost/unitTests/captureActivityLogs.test.ts b/test/lsptoolshost/unitTests/captureActivityLogs.test.ts index 1cf040f954..ae24f3e3b9 100644 --- a/test/lsptoolshost/unitTests/captureActivityLogs.test.ts +++ b/test/lsptoolshost/unitTests/captureActivityLogs.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { LogObserver } from '../../../src/lsptoolshost/logging/observableLogOutputChannel'; +import { LogObserver } from '../../../src/lsptoolshost/logging/observableLogOutputChannel.ts'; describe('captureActivityLogs', () => { describe('LogObserver', () => { diff --git a/test/lsptoolshost/unitTests/configurationMiddleware.test.ts b/test/lsptoolshost/unitTests/configurationMiddleware.test.ts index 759d8bc46f..31795e2e6b 100644 --- a/test/lsptoolshost/unitTests/configurationMiddleware.test.ts +++ b/test/lsptoolshost/unitTests/configurationMiddleware.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { readFileSync } from 'fs'; -import { convertServerOptionNameToClientConfigurationName } from '../../../src/lsptoolshost/options/optionNameConverter'; +import { convertServerOptionNameToClientConfigurationName } from '../../../src/lsptoolshost/options/optionNameConverter.ts'; import { describe, test, expect } from '@jest/globals'; const editorBehaviorSection = 1; diff --git a/test/lsptoolshost/unitTests/csharpChannelObserver.test.ts b/test/lsptoolshost/unitTests/csharpChannelObserver.test.ts index 722765e2c3..7064c2d319 100644 --- a/test/lsptoolshost/unitTests/csharpChannelObserver.test.ts +++ b/test/lsptoolshost/unitTests/csharpChannelObserver.test.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { getNullChannel } from '../../fakes'; -import { CsharpChannelObserver } from '../../../src/shared/observers/csharpChannelObserver'; +import { getNullChannel } from '../../fakes.ts'; +import { CsharpChannelObserver } from '../../../src/shared/observers/csharpChannelObserver.ts'; import { InstallationFailure, BaseEvent, @@ -13,7 +13,7 @@ import { IntegrityCheckFailure, DebuggerNotInstalledFailure, DebuggerPrerequisiteFailure, -} from '../../../src/shared/loggingEvents'; +} from '../../../src/shared/loggingEvents.ts'; describe('CsharpChannelObserver', () => { [ diff --git a/test/lsptoolshost/unitTests/csharpLoggerObserver.test.ts b/test/lsptoolshost/unitTests/csharpLoggerObserver.test.ts index f757ab824f..398f480ec8 100644 --- a/test/lsptoolshost/unitTests/csharpLoggerObserver.test.ts +++ b/test/lsptoolshost/unitTests/csharpLoggerObserver.test.ts @@ -4,12 +4,12 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel } from '../../fakes'; -import { CsharpLoggerObserver } from '../../../src/shared/observers/csharpLoggerObserver'; -import { PlatformInformation } from '../../../src/shared/platform'; -import { PackageError } from '../../../src/packageManager/packageError'; -import { Package } from '../../../src/packageManager/package'; -import * as Event from '../../../src/shared/loggingEvents'; +import { getNullChannel } from '../../fakes.ts'; +import { CsharpLoggerObserver } from '../../../src/shared/observers/csharpLoggerObserver.ts'; +import { PlatformInformation } from '../../../src/shared/platform.ts'; +import { PackageError } from '../../../src/packageManager/packageError.ts'; +import { Package } from '../../../src/packageManager/package.ts'; +import * as Event from '../../../src/shared/loggingEvents.ts'; describe('CsharpLoggerObserver', () => { let logOutput = ''; diff --git a/test/lsptoolshost/unitTests/jest.config.ts b/test/lsptoolshost/unitTests/jest.config.mjs similarity index 78% rename from test/lsptoolshost/unitTests/jest.config.ts rename to test/lsptoolshost/unitTests/jest.config.mjs index 01db2c61b5..253a897d67 100644 --- a/test/lsptoolshost/unitTests/jest.config.ts +++ b/test/lsptoolshost/unitTests/jest.config.mjs @@ -2,17 +2,17 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestUnitTestProjectName = 'Unit Tests'; +import { baseProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a jest project configuration for unit tests. */ -const unitTestConfig: Config = { +/** @type {import('jest').Config} */ +const unitTestConfig = { ...baseProjectConfig, - displayName: jestUnitTestProjectName, + displayName: jestProjectNames.unit, + setupFilesAfterEnv: ['/../../vsCodeUnitFramework.ts'], // We need to explicity ignore the out directory for modules - otherwise we'll get duplicate vscode module, // the TS version from the __mocks__ directory and the compiled js version from the out directory. modulePathIgnorePatterns: ['out'], diff --git a/test/lsptoolshost/unitTests/json.test.ts b/test/lsptoolshost/unitTests/json.test.ts index d0a4acf4f4..f12cbd3858 100644 --- a/test/lsptoolshost/unitTests/json.test.ts +++ b/test/lsptoolshost/unitTests/json.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { tolerantParse } from '../../../src/json'; +import { tolerantParse } from '../../../src/json.ts'; import { describe, test, expect } from '@jest/globals'; describe('JSON', () => { diff --git a/test/lsptoolshost/unitTests/languageServerConfigChangeObserver.test.ts b/test/lsptoolshost/unitTests/languageServerConfigChangeObserver.test.ts index 0e439e4ddb..3ef23cda38 100644 --- a/test/lsptoolshost/unitTests/languageServerConfigChangeObserver.test.ts +++ b/test/lsptoolshost/unitTests/languageServerConfigChangeObserver.test.ts @@ -5,11 +5,11 @@ import { timeout } from 'rxjs/operators'; import { from as observableFrom, Subject, BehaviorSubject } from 'rxjs'; -import { registerLanguageServerOptionChanges } from '../../../src/lsptoolshost/options/optionChanges'; +import { registerLanguageServerOptionChanges } from '../../../src/lsptoolshost/options/optionChanges.ts'; import { describe, beforeEach, test, expect } from '@jest/globals'; import * as vscode from 'vscode'; -import { getVSCodeWithConfig, updateConfig } from '../../fakes'; +import { getVSCodeWithConfig, updateConfig } from '../../fakes.ts'; describe('Option changes observer', () => { let doClickOk: () => void; diff --git a/test/lsptoolshost/unitTests/migrateOptions.test.ts b/test/lsptoolshost/unitTests/migrateOptions.test.ts index f1f4ecaf28..48ec2870ac 100644 --- a/test/lsptoolshost/unitTests/migrateOptions.test.ts +++ b/test/lsptoolshost/unitTests/migrateOptions.test.ts @@ -3,23 +3,22 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; -import { - dotnetAcquisitionExtensionOption, - dotnetPathOption, - IDotnetAcquisitionExistingPaths, - MigrateOptions, - migrateOptions, -} from '../../../src/shared/migrateOptions'; +import { IDotnetAcquisitionExistingPaths } from '../../../src/shared/migrateOptions.ts'; import { describe, test, expect, beforeEach, jest } from '@jest/globals'; -import { getVSCodeWithConfig } from '../../fakes'; -import { CSharpExtensionId } from '../../../src/constants/csharpExtensionId'; -import { ConfigurationTarget } from '../../../src/vscodeAdapter'; - -// Necessary when spying on module members. -jest.mock('fs', () => ({ __esModule: true, ...(jest.requireActual('fs')) })); +import { getVSCodeWithConfig } from '../../fakes.ts'; +import { CSharpExtensionId } from '../../../src/constants/csharpExtensionId.ts'; +import { ConfigurationTarget } from '../../../src/vscodeAdapter.ts'; + +const mockExistsSync = jest.fn(); +jest.unstable_mockModule('fs', async () => ({ + ...(await import('node:fs')), + existsSync: mockExistsSync, +})); +const fs = await import('fs'); +const { dotnetAcquisitionExtensionOption, dotnetPathOption, MigrateOptions, migrateOptions } = + await import('../../../src/shared/migrateOptions.ts'); describe('Migrate configurations', () => { const packageJson = JSON.parse(fs.readFileSync('package.json').toString()); @@ -36,7 +35,7 @@ describe('Migrate configurations', () => { const validDotnetPath = path.join(validDotnetFolder, `dotnet${process.platform === 'win32' ? '.exe' : ''}`); beforeEach(() => { - jest.spyOn(fs, 'existsSync').mockImplementation((path) => { + mockExistsSync.mockImplementation((path) => { if (path.toString().endsWith(validDotnetPath)) { return true; } diff --git a/test/lsptoolshost/unitTests/roslynLanguageClient.test.ts b/test/lsptoolshost/unitTests/roslynLanguageClient.test.ts index 1dd4262ba9..7d7000ae83 100644 --- a/test/lsptoolshost/unitTests/roslynLanguageClient.test.ts +++ b/test/lsptoolshost/unitTests/roslynLanguageClient.test.ts @@ -5,11 +5,11 @@ import { describe, expect, jest, test } from '@jest/globals'; -jest.mock('vscode-languageclient/node', () => ({ +jest.unstable_mockModule('vscode-languageclient/node', () => ({ LanguageClient: class {}, State: { Running: 2 }, })); -jest.mock('vscode-languageclient', () => ({ +jest.unstable_mockModule('vscode-languageclient', () => ({ MessageDirection: { clientToServer: 1, serverToClient: 2, @@ -18,10 +18,11 @@ jest.mock('vscode-languageclient', () => ({ ProtocolRequestType: class {}, RequestType: class {}, RequestType0: class {}, + State: { Running: 2 }, })); -import { RoslynLanguageClient } from '../../../src/lsptoolshost/server/roslynLanguageClient'; -import { TelemetryEventNames } from '../../../src/shared/telemetryEventNames'; +const { RoslynLanguageClient } = await import('../../../src/lsptoolshost/server/roslynLanguageClient.ts'); +const { TelemetryEventNames } = await import('../../../src/shared/telemetryEventNames.ts'); describe('RoslynLanguageClient', () => { test('shows one crash notification and emits one telemetry event per crash', () => { diff --git a/test/omnisharp/omnisharpIntegrationTests/advisor.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/advisor.integration.test.ts index 86bebe0516..5802acab8b 100644 --- a/test/omnisharp/omnisharpIntegrationTests/advisor.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/advisor.integration.test.ts @@ -6,10 +6,10 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as path from 'path'; import * as vscode from 'vscode'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; -import { Advisor } from '../../../src/omnisharp/features/diagnosticsProvider'; +import { Advisor } from '../../../src/omnisharp/features/diagnosticsProvider.ts'; function setLimit(to: number | null) { const csharpConfig = vscode.workspace.getConfiguration('csharp'); diff --git a/test/omnisharp/omnisharpIntegrationTests/codeActionRename.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/codeActionRename.integration.test.ts index 5c305b12d3..e271268252 100644 --- a/test/omnisharp/omnisharpIntegrationTests/codeActionRename.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/codeActionRename.integration.test.ts @@ -5,11 +5,11 @@ import { expect, test, beforeAll, afterAll, describe } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; import * as path from 'path'; -import { assertWithPoll } from './poll'; -import { isNotNull } from '../testUtil'; +import { assertWithPoll } from './poll.ts'; +import { isNotNull } from '../testUtil.ts'; describe.skip(`Code Action Rename ${testAssetWorkspace.description}`, function () { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/codeLensProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/codeLensProvider.integration.test.ts index 548f0d99d0..fdf0a1724e 100644 --- a/test/omnisharp/omnisharpIntegrationTests/codeLensProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/codeLensProvider.integration.test.ts @@ -6,9 +6,9 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfSlnWithCsProj, describeIfNotGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { isNotNull } from '../testUtil'; +import { activateCSharpExtension, describeIfSlnWithCsProj, describeIfNotGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { isNotNull } from '../testUtil.ts'; describeIfNotGenerator(`CodeLensProvider: ${testAssetWorkspace.description}`, function () { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/completionProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/completionProvider.integration.test.ts index a00e85774b..56263cc866 100644 --- a/test/omnisharp/omnisharpIntegrationTests/completionProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/completionProvider.integration.test.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { expect, test, beforeAll, afterAll } from '@jest/globals'; -import OmniSharpCompletionProvider from '../../../src/omnisharp/features/completionProvider'; +import OmniSharpCompletionProvider from '../../../src/omnisharp/features/completionProvider.ts'; import * as vscode from 'vscode'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; import * as path from 'path'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`${OmniSharpCompletionProvider.name}: Returns the completion items`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/definitionProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/definitionProvider.test.ts index 62bf7013fb..fda563079b 100644 --- a/test/omnisharp/omnisharpIntegrationTests/definitionProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/definitionProvider.test.ts @@ -5,10 +5,14 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider'; +import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider.ts'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator, restartOmniSharpServer } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { + activateCSharpExtension, + describeIfNotRazorOrGenerator, + restartOmniSharpServer, +} from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`${OmniSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/diagnostics.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/diagnostics.integration.test.ts index b3808099e0..af142f32d4 100644 --- a/test/omnisharp/omnisharpIntegrationTests/diagnostics.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/diagnostics.integration.test.ts @@ -14,10 +14,10 @@ import { isRazorWorkspace, isSlnWithGenerator, restartOmniSharpServer, -} from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { poll, assertWithPoll, pollDoesNotHappen } from './poll'; -import { isNotNull } from '../testUtil'; +} from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { poll, assertWithPoll, pollDoesNotHappen } from './poll.ts'; +import { isNotNull } from '../testUtil.ts'; async function setDiagnosticWorkspaceLimit(to: number | null) { const csharpConfig = vscode.workspace.getConfiguration('csharp'); diff --git a/test/omnisharp/omnisharpIntegrationTests/documentSymbolProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/documentSymbolProvider.integration.test.ts index eb8ebf9ac4..a6fcaa1f1e 100644 --- a/test/omnisharp/omnisharpIntegrationTests/documentSymbolProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/documentSymbolProvider.integration.test.ts @@ -6,8 +6,8 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`DocumentSymbolProvider: ${testAssetWorkspace.description}`, function () { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/documentationCommentAutoFormatting.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/documentationCommentAutoFormatting.integration.test.ts index df49d08ee0..0952f91b5e 100644 --- a/test/omnisharp/omnisharpIntegrationTests/documentationCommentAutoFormatting.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/documentationCommentAutoFormatting.integration.test.ts @@ -6,7 +6,7 @@ import { expect, test, beforeAll, afterAll, describe } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; const onTypeFormatProviderCommand = 'vscode.executeFormatOnTypeProvider'; diff --git a/test/omnisharp/omnisharpIntegrationTests/dotnetTest.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/dotnetTest.integration.test.ts index 73a5b17246..d46907a6cf 100644 --- a/test/omnisharp/omnisharpIntegrationTests/dotnetTest.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/dotnetTest.integration.test.ts @@ -6,13 +6,13 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfSlnWithCsProj } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { EventStream } from '../../../src/eventStream'; -import { EventType } from '../../../src/shared/eventType'; -import { OmnisharpRequestMessage } from '../../../src/omnisharp/omnisharpLoggingEvents'; -import { V2 } from '../../../src/omnisharp/protocol'; -import { isNotNull } from '../testUtil'; +import { activateCSharpExtension, describeIfSlnWithCsProj } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { EventType } from '../../../src/shared/eventType.ts'; +import { OmnisharpRequestMessage } from '../../../src/omnisharp/omnisharpLoggingEvents.ts'; +import { V2 } from '../../../src/omnisharp/protocol.ts'; +import { isNotNull } from '../testUtil.ts'; // These tests only run on the slnWithCsproj solution describeIfSlnWithCsProj(`DotnetTest: ${testAssetWorkspace.description}`, function () { diff --git a/test/omnisharp/omnisharpIntegrationTests/hoverProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/hoverProvider.integration.test.ts index 798038385d..227505c5d5 100644 --- a/test/omnisharp/omnisharpIntegrationTests/hoverProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/hoverProvider.integration.test.ts @@ -6,8 +6,8 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; export type Test = 'a' | 'b' | ['c', any]; diff --git a/test/omnisharp/omnisharpIntegrationTests/implementationProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/implementationProvider.test.ts index bcb39a937d..7ff7de3f8d 100644 --- a/test/omnisharp/omnisharpIntegrationTests/implementationProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/implementationProvider.test.ts @@ -5,10 +5,10 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import OmniSharpImplementationProvider from '../../../src/omnisharp/features/implementationProvider'; +import OmniSharpImplementationProvider from '../../../src/omnisharp/features/implementationProvider.ts'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`${OmniSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/index.ts b/test/omnisharp/omnisharpIntegrationTests/index.ts index ac2e6a90a2..2a4654aef7 100644 --- a/test/omnisharp/omnisharpIntegrationTests/index.ts +++ b/test/omnisharp/omnisharpIntegrationTests/index.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { runIntegrationTests } from '../../runIntegrationTests'; -import { jestIntegrationTestProjectName } from './jest.config'; +import { runIntegrationTests } from '../../runIntegrationTests.ts'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; export async function run() { process.env.RUNNING_INTEGRATION_TESTS = 'true'; - await runIntegrationTests(jestIntegrationTestProjectName); + await runIntegrationTests(jestProjectNames.omnisharpIntegration); } diff --git a/test/omnisharp/omnisharpIntegrationTests/inlayHints.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/inlayHints.integration.test.ts index b8bce4c45e..794cd5565f 100644 --- a/test/omnisharp/omnisharpIntegrationTests/inlayHints.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/inlayHints.integration.test.ts @@ -5,11 +5,15 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator, restartOmniSharpServer } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { + activateCSharpExtension, + describeIfNotRazorOrGenerator, + restartOmniSharpServer, +} from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; import * as path from 'path'; -import { InlayHint, LinePositionSpanTextChange } from '../../../src/omnisharp/protocol'; -import { isNotNull } from '../testUtil'; +import { InlayHint, LinePositionSpanTextChange } from '../../../src/omnisharp/protocol.ts'; +import { isNotNull } from '../testUtil.ts'; describeIfNotRazorOrGenerator(`Inlay Hints ${testAssetWorkspace.description}`, function () { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/integrationHelpers.ts b/test/omnisharp/omnisharpIntegrationTests/integrationHelpers.ts index 60ab788210..48d60f56a4 100644 --- a/test/omnisharp/omnisharpIntegrationTests/integrationHelpers.ts +++ b/test/omnisharp/omnisharpIntegrationTests/integrationHelpers.ts @@ -5,10 +5,10 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import { Advisor } from '../../../src/omnisharp/features/diagnosticsProvider'; -import { EventStream } from '../../../src/eventStream'; -import { EventType } from '../../../src/shared/eventType'; -import { OmnisharpExtensionExports } from '../../../src/csharpExtensionExports'; +import { Advisor } from '../../../src/omnisharp/features/diagnosticsProvider.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { EventType } from '../../../src/shared/eventType.ts'; +import { OmnisharpExtensionExports } from '../../../src/csharpExtensionExports.ts'; import { describe } from '@jest/globals'; export interface ActivationResult { diff --git a/test/omnisharp/omnisharpIntegrationTests/jest.config.ts b/test/omnisharp/omnisharpIntegrationTests/jest.config.mjs similarity index 67% rename from test/omnisharp/omnisharpIntegrationTests/jest.config.ts rename to test/omnisharp/omnisharpIntegrationTests/jest.config.mjs index 0845965cd7..0d9cf7ba47 100644 --- a/test/omnisharp/omnisharpIntegrationTests/jest.config.ts +++ b/test/omnisharp/omnisharpIntegrationTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestIntegrationTestProjectName = 'OmniSharp Integration Tests'; +import { baseIntegrationProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a project configuration for jest integration tests. */ -const integrationTestConfig: Config = { - ...baseProjectConfig, - displayName: jestIntegrationTestProjectName, +/** @type {import('jest').Config} */ +const integrationTestConfig = { + ...baseIntegrationProjectConfig, + displayName: jestProjectNames.omnisharpIntegration, roots: [''], testEnvironment: '/../../vsCodeEnvironment.ts', setupFilesAfterEnv: ['/../../vsCodeFramework.ts'], diff --git a/test/omnisharp/omnisharpIntegrationTests/languageMiddleware.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/languageMiddleware.integration.test.ts index b802e7b4f5..502e37ec37 100644 --- a/test/omnisharp/omnisharpIntegrationTests/languageMiddleware.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/languageMiddleware.integration.test.ts @@ -6,9 +6,9 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import { LanguageMiddleware, LanguageMiddlewareFeature } from '../../../src/omnisharp/languageMiddlewareFeature'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import { LanguageMiddleware, LanguageMiddlewareFeature } from '../../../src/omnisharp/languageMiddlewareFeature.ts'; describeIfNotRazorOrGenerator(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/launchConfiguration.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/launchConfiguration.integration.test.ts index b37b45204b..bc0c585bd3 100644 --- a/test/omnisharp/omnisharpIntegrationTests/launchConfiguration.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/launchConfiguration.integration.test.ts @@ -4,12 +4,12 @@ *--------------------------------------------------------------------------------------------*/ import { describe, expect, test, beforeAll, afterAll } from '@jest/globals'; -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as vscode from 'vscode'; -import { activateCSharpExtension } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { poll } from './poll'; -import { isNotNull } from '../testUtil'; +import { activateCSharpExtension } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { poll } from './poll.ts'; +import { isNotNull } from '../testUtil.ts'; // Consistently failing in CI: https://github.com/OmniSharp/omnisharp-vscode/issues/4646 describe.skip(`Tasks generation: ${testAssetWorkspace.description}`, function () { diff --git a/test/omnisharp/omnisharpIntegrationTests/launcher.test.ts b/test/omnisharp/omnisharpIntegrationTests/launcher.test.ts index 72ee28e512..faa8b240fa 100644 --- a/test/omnisharp/omnisharpIntegrationTests/launcher.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/launcher.test.ts @@ -10,8 +10,8 @@ import { resourcesToLaunchTargets, vsls, vslsTarget, -} from '../../../src/omnisharp/launcher'; -import { LaunchTargetKind } from '../../../src/shared/launchTarget'; +} from '../../../src/omnisharp/launcher.ts'; +import { LaunchTargetKind } from '../../../src/shared/launchTarget.ts'; describe(`launcher:`, () => { const workspaceFolders: vscode.WorkspaceFolder[] = [{ uri: vscode.Uri.parse('/'), name: 'root', index: 0 }]; diff --git a/test/omnisharp/omnisharpIntegrationTests/omnisharpCommands.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/omnisharpCommands.integration.test.ts index f3d567ee51..00c9d13795 100644 --- a/test/omnisharp/omnisharpIntegrationTests/omnisharpCommands.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/omnisharpCommands.integration.test.ts @@ -5,9 +5,12 @@ import { expect, test, beforeAll, afterAll, describe } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { OmniSharpCommands, UnexpectedOmniSharpCommands } from '../../lsptoolshost/integrationTests/expectedCommands'; +import { activateCSharpExtension } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { + OmniSharpCommands, + UnexpectedOmniSharpCommands, +} from '../../lsptoolshost/integrationTests/expectedCommands.ts'; describe(`Command Enablement: ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/omnisharp/omnisharpIntegrationTests/parsedEnvironmentFile.test.ts b/test/omnisharp/omnisharpIntegrationTests/parsedEnvironmentFile.test.ts index 22c7e749e3..572176d879 100644 --- a/test/omnisharp/omnisharpIntegrationTests/parsedEnvironmentFile.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/parsedEnvironmentFile.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { ParsedEnvironmentFile } from '../../../src/coreclrDebug/parsedEnvironmentFile'; +import { ParsedEnvironmentFile } from '../../../src/coreclrDebug/parsedEnvironmentFile.ts'; describe('ParsedEnvironmentFile', () => { test('Add single variable', () => { diff --git a/test/omnisharp/omnisharpIntegrationTests/reAnalyze.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/reAnalyze.integration.test.ts index 5cb9752252..b1f51c8c9b 100644 --- a/test/omnisharp/omnisharpIntegrationTests/reAnalyze.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/reAnalyze.integration.test.ts @@ -6,14 +6,14 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { poll, assertWithPoll } from './poll'; -import { EventStream } from '../../../src/eventStream'; -import { EventType } from '../../../src/shared/eventType'; -import { BaseEvent } from '../../../src/shared/loggingEvents'; -import { OmnisharpBackgroundDiagnosticStatus } from '../../../src/omnisharp/omnisharpLoggingEvents'; -import { BackgroundDiagnosticStatus } from '../../../src/omnisharp/protocol'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { poll, assertWithPoll } from './poll.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { EventType } from '../../../src/shared/eventType.ts'; +import { BaseEvent } from '../../../src/shared/loggingEvents.ts'; +import { OmnisharpBackgroundDiagnosticStatus } from '../../../src/omnisharp/omnisharpLoggingEvents.ts'; +import { BackgroundDiagnosticStatus } from '../../../src/omnisharp/protocol.ts'; function listenEvents(stream: EventStream, type: EventType): T[] { const results: T[] = []; diff --git a/test/omnisharp/omnisharpIntegrationTests/referenceProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/referenceProvider.test.ts index 4d76051903..63fe7197f4 100644 --- a/test/omnisharp/omnisharpIntegrationTests/referenceProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/referenceProvider.test.ts @@ -5,10 +5,10 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import OmniSharpReferenceProvider from '../../../src/omnisharp/features/referenceProvider'; +import OmniSharpReferenceProvider from '../../../src/omnisharp/features/referenceProvider.ts'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`${OmniSharpReferenceProvider.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/semanticTokensProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/semanticTokensProvider.test.ts index d629b6e614..989a83ee8f 100644 --- a/test/omnisharp/omnisharpIntegrationTests/semanticTokensProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/semanticTokensProvider.test.ts @@ -6,8 +6,8 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; interface ExpectedToken { startLine: number; diff --git a/test/omnisharp/omnisharpIntegrationTests/signatureHelp.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/signatureHelp.integration.test.ts index a1b56ab7a6..40023c8e1f 100644 --- a/test/omnisharp/omnisharpIntegrationTests/signatureHelp.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/signatureHelp.integration.test.ts @@ -6,8 +6,8 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; describeIfNotRazorOrGenerator(`SignatureHelp: ${testAssetWorkspace.description}`, function () { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/sourceGeneratorDefinitionProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/sourceGeneratorDefinitionProvider.test.ts index 3edbc9f4f1..f8dc2dd650 100644 --- a/test/omnisharp/omnisharpIntegrationTests/sourceGeneratorDefinitionProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/sourceGeneratorDefinitionProvider.test.ts @@ -6,10 +6,10 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; import * as path from 'path'; -import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider'; -import { activateCSharpExtension, describeIfGenerator, restartOmniSharpServer } from './integrationHelpers'; -import { assertWithPoll, sleep } from './poll'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider.ts'; +import { activateCSharpExtension, describeIfGenerator, restartOmniSharpServer } from './integrationHelpers.ts'; +import { assertWithPoll, sleep } from './poll.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; describeIfGenerator(`${OmniSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/testAssets/activeTestAssetWorkspace.ts b/test/omnisharp/omnisharpIntegrationTests/testAssets/activeTestAssetWorkspace.ts index 458734000d..01b5030fe0 100644 --- a/test/omnisharp/omnisharpIntegrationTests/testAssets/activeTestAssetWorkspace.ts +++ b/test/omnisharp/omnisharpIntegrationTests/testAssets/activeTestAssetWorkspace.ts @@ -6,14 +6,14 @@ import * as path from 'path'; import * as vscode from 'vscode'; -import { ITestAssetWorkspace } from '../../../lsptoolshost/integrationTests/testAssets/testAssets'; +import { ITestAssetWorkspace } from '../../../lsptoolshost/integrationTests/testAssets/testAssets.ts'; -import singleCsproj from '../../../lsptoolshost/integrationTests/testAssets/singleCsproj'; -import slnWithCsproj from '../../../lsptoolshost/integrationTests/testAssets/slnWithCsproj'; -import slnFilterWithCsproj from '../../../lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj'; -import BasicRazorApp2_1 from '../../../lsptoolshost/integrationTests/testAssets/razorApp'; -import slnWithGenerator from '../../../lsptoolshost/integrationTests/testAssets/slnWithGenerator'; -import { OmnisharpTestAssetWorkspace } from './omnisharpTestAssetWorkspace'; +import singleCsproj from '../../../lsptoolshost/integrationTests/testAssets/singleCsproj.ts'; +import slnWithCsproj from '../../../lsptoolshost/integrationTests/testAssets/slnWithCsproj.ts'; +import slnFilterWithCsproj from '../../../lsptoolshost/integrationTests/testAssets/slnFilterWithCsproj.ts'; +import BasicRazorApp2_1 from '../../../lsptoolshost/integrationTests/testAssets/razorApp.ts'; +import slnWithGenerator from '../../../lsptoolshost/integrationTests/testAssets/slnWithGenerator.ts'; +import { OmnisharpTestAssetWorkspace } from './omnisharpTestAssetWorkspace.ts'; const testAssetWorkspaces: { [x: string]: ITestAssetWorkspace } = { singleCsproj, diff --git a/test/omnisharp/omnisharpIntegrationTests/testAssets/omnisharpTestAssetWorkspace.ts b/test/omnisharp/omnisharpIntegrationTests/testAssets/omnisharpTestAssetWorkspace.ts index e98b279d7f..655325385d 100644 --- a/test/omnisharp/omnisharpIntegrationTests/testAssets/omnisharpTestAssetWorkspace.ts +++ b/test/omnisharp/omnisharpIntegrationTests/testAssets/omnisharpTestAssetWorkspace.ts @@ -4,12 +4,15 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { EventStream } from '../../../../src/eventStream'; -import { EventType } from '../../../../src/shared/eventType'; -import { BaseEvent } from '../../../../src/shared/loggingEvents'; -import { poll } from '../poll'; -import { ITestAssetWorkspace, TestAssetWorkspace } from '../../../lsptoolshost/integrationTests/testAssets/testAssets'; -import { ActivationResult } from '../integrationHelpers'; +import { EventStream } from '../../../../src/eventStream.ts'; +import { EventType } from '../../../../src/shared/eventType.ts'; +import { BaseEvent } from '../../../../src/shared/loggingEvents.ts'; +import { poll } from '../poll.ts'; +import { + ITestAssetWorkspace, + TestAssetWorkspace, +} from '../../../lsptoolshost/integrationTests/testAssets/testAssets.ts'; +import { ActivationResult } from '../integrationHelpers.ts'; export class OmnisharpTestAssetWorkspace extends TestAssetWorkspace { constructor(workspace: ITestAssetWorkspace) { diff --git a/test/omnisharp/omnisharpIntegrationTests/typeDefinitionProvider.test.ts b/test/omnisharp/omnisharpIntegrationTests/typeDefinitionProvider.test.ts index 724d66df2e..cf5d557b68 100644 --- a/test/omnisharp/omnisharpIntegrationTests/typeDefinitionProvider.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/typeDefinitionProvider.test.ts @@ -5,10 +5,14 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider'; +import OmniSharpDefinitionProvider from '../../../src/omnisharp/features/definitionProvider.ts'; import * as path from 'path'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator, restartOmniSharpServer } from './integrationHelpers'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { + activateCSharpExtension, + describeIfNotRazorOrGenerator, + restartOmniSharpServer, +} from './integrationHelpers.ts'; describeIfNotRazorOrGenerator(`${OmniSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => { let fileUri: vscode.Uri; diff --git a/test/omnisharp/omnisharpIntegrationTests/virtualDocumentTracker.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/virtualDocumentTracker.integration.test.ts index cceb330ad8..864c6ece79 100644 --- a/test/omnisharp/omnisharpIntegrationTests/virtualDocumentTracker.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/virtualDocumentTracker.integration.test.ts @@ -5,9 +5,9 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension, describeIfNotGenerator, isSlnWithGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; -import { IDisposable } from '../../../src/disposable'; +import { activateCSharpExtension, describeIfNotGenerator, isSlnWithGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; +import { IDisposable } from '../../../src/disposable.ts'; describeIfNotGenerator(`Virtual Document Tracking ${testAssetWorkspace.description}`, function () { const virtualScheme = 'virtual'; diff --git a/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts index 7f6dff7cf5..a71f977f68 100644 --- a/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts @@ -5,8 +5,8 @@ import { expect, test, beforeAll, afterAll } from '@jest/globals'; import * as vscode from 'vscode'; -import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers'; -import testAssetWorkspace from './testAssets/activeTestAssetWorkspace'; +import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers.ts'; +import testAssetWorkspace from './testAssets/activeTestAssetWorkspace.ts'; describeIfNotRazorOrGenerator(`WorkspaceSymbolProvider: ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/omnisharp/omnisharpUnitTests/absolutePath.test.ts b/test/omnisharp/omnisharpUnitTests/absolutePath.test.ts index b1c5baf8f2..53db9acd24 100644 --- a/test/omnisharp/omnisharpUnitTests/absolutePath.test.ts +++ b/test/omnisharp/omnisharpUnitTests/absolutePath.test.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import { AbsolutePath } from '../../../src/packageManager/absolutePath'; -import { TmpAsset, CreateTmpFile } from '../../createTmpAsset'; +import { AbsolutePath } from '../../../src/packageManager/absolutePath.ts'; +import { TmpAsset, CreateTmpFile } from '../../createTmpAsset.ts'; import { join } from 'path'; describe(AbsolutePath.name, () => { diff --git a/test/omnisharp/omnisharpUnitTests/assets.test.ts b/test/omnisharp/omnisharpUnitTests/assets.test.ts index 3f4781c98d..0d94b83bed 100644 --- a/test/omnisharp/omnisharpUnitTests/assets.test.ts +++ b/test/omnisharp/omnisharpUnitTests/assets.test.ts @@ -14,11 +14,11 @@ import { ProgramLaunchType, replaceCommentPropertiesWithComments, updateJsonWithComments, -} from '../../../src/shared/assets'; +} from '../../../src/shared/assets.ts'; import { parse } from 'jsonc-parser'; -import { ProjectDebugInformation } from '../../../src/shared/IWorkspaceDebugInformationProvider'; -import { findNetCoreTargetFramework } from '../../../src/shared/utils'; -import { isNotNull } from '../testUtil'; +import { ProjectDebugInformation } from '../../../src/shared/IWorkspaceDebugInformationProvider.ts'; +import { findNetCoreTargetFramework } from '../../../src/shared/utils.ts'; +import { isNotNull } from '../testUtil.ts'; describe('Asset generation: csproj', () => { test('Create tasks.json for project opened in workspace', () => { diff --git a/test/omnisharp/omnisharpUnitTests/blazorWebAssemblyDetection.test.ts b/test/omnisharp/omnisharpUnitTests/blazorWebAssemblyDetection.test.ts index ee52091eac..a3222c014e 100644 --- a/test/omnisharp/omnisharpUnitTests/blazorWebAssemblyDetection.test.ts +++ b/test/omnisharp/omnisharpUnitTests/blazorWebAssemblyDetection.test.ts @@ -4,10 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as path from 'path'; -import { CreateTmpDir, TmpAsset } from '../../createTmpAsset'; -import { isBlazorWebAssemblyHostedServer, isBlazorWebAssemblyProject, isWebProject } from '../../../src/shared/utils'; +import { CreateTmpDir, TmpAsset } from '../../createTmpAsset.ts'; +import { + isBlazorWebAssemblyHostedServer, + isBlazorWebAssemblyProject, + isWebProject, +} from '../../../src/shared/utils.ts'; const webSdkCsproj = ` diff --git a/test/omnisharp/omnisharpUnitTests/common.test.ts b/test/omnisharp/omnisharpUnitTests/common.test.ts index 9d454e1e35..3e77557b36 100644 --- a/test/omnisharp/omnisharpUnitTests/common.test.ts +++ b/test/omnisharp/omnisharpUnitTests/common.test.ts @@ -6,7 +6,7 @@ import { describe, test, expect } from '@jest/globals'; import * as path from 'path'; -import { isSubfolderOf, safeLength, sum } from '../../../src/common'; +import { isSubfolderOf, safeLength, sum } from '../../../src/common.ts'; describe('Common', () => { describe('safeLength', () => { diff --git a/test/omnisharp/omnisharpUnitTests/coreclrDebug/targetArchitecture.test.ts b/test/omnisharp/omnisharpUnitTests/coreclrDebug/targetArchitecture.test.ts index ad12001afb..54f9f758ab 100644 --- a/test/omnisharp/omnisharpUnitTests/coreclrDebug/targetArchitecture.test.ts +++ b/test/omnisharp/omnisharpUnitTests/coreclrDebug/targetArchitecture.test.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { getTargetArchitecture } from '../../../../src/coreclrDebug/util'; -import { PlatformInformation } from '../../../../src/shared/platform'; -import { DotnetInfo } from '../../../../src/shared/utils/dotnetInfo'; +import { getTargetArchitecture } from '../../../../src/coreclrDebug/util.ts'; +import { PlatformInformation } from '../../../../src/shared/platform.ts'; +import { DotnetInfo } from '../../../../src/shared/utils/dotnetInfo.ts'; describe('getTargetArchitecture Tests', () => { describe('Windows', () => { diff --git a/test/omnisharp/omnisharpUnitTests/fakes/fakeDotnetResolver.ts b/test/omnisharp/omnisharpUnitTests/fakes/fakeDotnetResolver.ts index d74aeb7599..79e5cc751c 100644 --- a/test/omnisharp/omnisharpUnitTests/fakes/fakeDotnetResolver.ts +++ b/test/omnisharp/omnisharpUnitTests/fakes/fakeDotnetResolver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IHostExecutableResolver } from '../../../../src/shared/constants/IHostExecutableResolver'; -import { HostExecutableInformation } from '../../../../src/shared/constants/hostExecutableInformation'; +import { IHostExecutableResolver } from '../../../../src/shared/constants/IHostExecutableResolver.ts'; +import { HostExecutableInformation } from '../../../../src/shared/constants/hostExecutableInformation.ts'; export const fakeMonoInfo: HostExecutableInformation = { version: 'someDotNetVersion', diff --git a/test/omnisharp/omnisharpUnitTests/fakes/fakeMonoResolver.ts b/test/omnisharp/omnisharpUnitTests/fakes/fakeMonoResolver.ts index 97c45f410b..8a52f94c57 100644 --- a/test/omnisharp/omnisharpUnitTests/fakes/fakeMonoResolver.ts +++ b/test/omnisharp/omnisharpUnitTests/fakes/fakeMonoResolver.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IHostExecutableResolver } from '../../../../src/shared/constants/IHostExecutableResolver'; -import { HostExecutableInformation } from '../../../../src/shared/constants/hostExecutableInformation'; +import { IHostExecutableResolver } from '../../../../src/shared/constants/IHostExecutableResolver.ts'; +import { HostExecutableInformation } from '../../../../src/shared/constants/hostExecutableInformation.ts'; export const fakeMonoInfo: HostExecutableInformation = { version: 'someMonoVersion', diff --git a/test/omnisharp/omnisharpUnitTests/features/reportIssue.test.ts b/test/omnisharp/omnisharpUnitTests/features/reportIssue.test.ts index c052d189ab..4b3f8d4b46 100644 --- a/test/omnisharp/omnisharpUnitTests/features/reportIssue.test.ts +++ b/test/omnisharp/omnisharpUnitTests/features/reportIssue.test.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import reportIssue from '../../../../src/shared/reportIssue'; -import { FakeMonoResolver, fakeMonoInfo } from '../fakes/fakeMonoResolver'; -import { FakeDotnetResolver } from '../fakes/fakeDotnetResolver'; -import { DotnetInfo } from '../../../../src/shared/utils/dotnetInfo'; +import reportIssue from '../../../../src/shared/reportIssue.ts'; +import { FakeMonoResolver, fakeMonoInfo } from '../fakes/fakeMonoResolver.ts'; +import { FakeDotnetResolver } from '../fakes/fakeDotnetResolver.ts'; +import { DotnetInfo } from '../../../../src/shared/utils/dotnetInfo.ts'; import { jest, describe, test, expect, beforeEach } from '@jest/globals'; describe(`${reportIssue.name}`, () => { diff --git a/test/omnisharp/omnisharpUnitTests/informationMessageObserver.test.ts b/test/omnisharp/omnisharpUnitTests/informationMessageObserver.test.ts index d04aef9607..fea8513945 100644 --- a/test/omnisharp/omnisharpUnitTests/informationMessageObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/informationMessageObserver.test.ts @@ -5,8 +5,8 @@ import * as vscode from 'vscode'; import { jest, describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import { InformationMessageObserver } from '../../../src/omnisharp/observers/informationMessageObserver'; -import { getUnresolvedDependenices, getWorkspaceConfiguration } from '../../fakes'; +import { InformationMessageObserver } from '../../../src/omnisharp/observers/informationMessageObserver.ts'; +import { getUnresolvedDependenices, getWorkspaceConfiguration } from '../../fakes.ts'; import { Subject, from as observableFrom } from 'rxjs'; import { timeout } from 'rxjs/operators'; diff --git a/test/omnisharp/omnisharpUnitTests/installRuntimeDependencies.test.ts b/test/omnisharp/omnisharpUnitTests/installRuntimeDependencies.test.ts index 0ce27b8f82..706ad3f920 100644 --- a/test/omnisharp/omnisharpUnitTests/installRuntimeDependencies.test.ts +++ b/test/omnisharp/omnisharpUnitTests/installRuntimeDependencies.test.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { installRuntimeDependencies } from '../../../src/installRuntimeDependencies'; -import { IInstallDependencies } from '../../../src/packageManager/IInstallDependencies'; -import { EventStream } from '../../../src/eventStream'; -import { PlatformInformation } from '../../../src/shared/platform'; -import TestEventBus from './testAssets/testEventBus'; -import { AbsolutePathPackage } from '../../../src/packageManager/absolutePathPackage'; -import { Package } from '../../../src/packageManager/package'; -import { isNotNull } from '../testUtil'; +import { installRuntimeDependencies } from '../../../src/installRuntimeDependencies.ts'; +import { IInstallDependencies } from '../../../src/packageManager/IInstallDependencies.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { PlatformInformation } from '../../../src/shared/platform.ts'; +import TestEventBus from './testAssets/testEventBus.ts'; +import { AbsolutePathPackage } from '../../../src/packageManager/absolutePathPackage.ts'; +import { Package } from '../../../src/packageManager/package.ts'; +import { isNotNull } from '../testUtil.ts'; describe(`${installRuntimeDependencies.name}`, () => { let packageJSON = { diff --git a/test/omnisharp/omnisharpUnitTests/jest.config.ts b/test/omnisharp/omnisharpUnitTests/jest.config.mjs similarity index 77% rename from test/omnisharp/omnisharpUnitTests/jest.config.ts rename to test/omnisharp/omnisharpUnitTests/jest.config.mjs index 842dc5e763..bd56e7bbd7 100644 --- a/test/omnisharp/omnisharpUnitTests/jest.config.ts +++ b/test/omnisharp/omnisharpUnitTests/jest.config.mjs @@ -2,17 +2,17 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestOmniSharpUnitTestProjectName = 'OmniSharp Unit Tests'; +import { baseProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a jest project configuration for O# jest tests. */ -const omnisharpConfig: Config = { +/** @type {import('jest').Config} */ +const omnisharpConfig = { ...baseProjectConfig, - displayName: jestOmniSharpUnitTestProjectName, + displayName: jestProjectNames.omnisharpUnit, + setupFilesAfterEnv: ['/../../vsCodeUnitFramework.ts'], // We need to explicity ignore the out directory for modules - otherwise we'll get duplicate vscode module, // the TS version from the __mocks__ directory and the compiled js version from the out directory. modulePathIgnorePatterns: ['out'], diff --git a/test/omnisharp/omnisharpUnitTests/logging/backgroundWorkStatusBarObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/backgroundWorkStatusBarObserver.test.ts index 8d44d5f992..57148487bc 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/backgroundWorkStatusBarObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/backgroundWorkStatusBarObserver.test.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { StatusBarItem } from '../../../../src/vscodeAdapter'; -import { OmnisharpBackgroundDiagnosticStatus } from '../../../../src/omnisharp/omnisharpLoggingEvents'; -import { BackgroundWorkStatusBarObserver } from '../../../../src/omnisharp/observers/backgroundWorkStatusBarObserver'; -import { BackgroundDiagnosticStatus } from '../../../../src/omnisharp/protocol'; +import { StatusBarItem } from '../../../../src/vscodeAdapter.ts'; +import { OmnisharpBackgroundDiagnosticStatus } from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; +import { BackgroundWorkStatusBarObserver } from '../../../../src/omnisharp/observers/backgroundWorkStatusBarObserver.ts'; +import { BackgroundDiagnosticStatus } from '../../../../src/omnisharp/protocol.ts'; describe('BackgroundWorkStatusBarObserver', () => { let showCalled: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/dotnetChannelObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/dotnetChannelObserver.test.ts index 016bbb4f47..7812a3d29f 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/dotnetChannelObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/dotnetChannelObserver.test.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { DotNetChannelObserver } from '../../../../src/omnisharp/observers/dotnetChannelObserver'; -import { getNullChannel } from '../../../fakes'; -import { CommandDotNetRestoreStart } from '../../../../src/omnisharp/omnisharpLoggingEvents'; +import { DotNetChannelObserver } from '../../../../src/omnisharp/observers/dotnetChannelObserver.ts'; +import { getNullChannel } from '../../../fakes.ts'; +import { CommandDotNetRestoreStart } from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('DotnetChannelObserver', () => { let hasShown: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/dotnetLoggerObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/dotnetLoggerObserver.test.ts index 0e5eee3649..2fb17a5731 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/dotnetLoggerObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/dotnetLoggerObserver.test.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { getNullChannel } from '../../../fakes'; -import { DotnetLoggerObserver } from '../../../../src/omnisharp/observers/dotnetLoggerObserver'; -import { EventWithMessage } from '../../../../src/shared/loggingEvents'; +import { getNullChannel } from '../../../fakes.ts'; +import { DotnetLoggerObserver } from '../../../../src/omnisharp/observers/dotnetLoggerObserver.ts'; +import { EventWithMessage } from '../../../../src/shared/loggingEvents.ts'; import { CommandDotNetRestoreFailed, CommandDotNetRestoreProgress, CommandDotNetRestoreSucceeded, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('DotnetLoggerObserver', () => { [ diff --git a/test/omnisharp/omnisharpUnitTests/logging/dotnetTestChannelObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/dotnetTestChannelObserver.test.ts index cb2c57dce1..59f169e498 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/dotnetTestChannelObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/dotnetTestChannelObserver.test.ts @@ -4,16 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel } from '../../../fakes'; -import { BaseEvent } from '../../../../src/shared/loggingEvents'; -import DotnetTestChannelObserver from '../../../../src/omnisharp/observers/dotnetTestChannelObserver'; +import { getNullChannel } from '../../../fakes.ts'; +import { BaseEvent } from '../../../../src/shared/loggingEvents.ts'; +import DotnetTestChannelObserver from '../../../../src/omnisharp/observers/dotnetTestChannelObserver.ts'; import { DotNetTestDebugStart, DotNetTestRunFailure, DotNetTestRunStart, DotNetTestsInClassDebugStart, DotNetTestsInClassRunStart, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('DotnetTestChannelObserver', () => { let hasShown: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/dotnetTestLoggerObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/dotnetTestLoggerObserver.test.ts index 4de7ae08c3..6e1095a223 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/dotnetTestLoggerObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/dotnetTestLoggerObserver.test.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel } from '../../../fakes'; -import { EventWithMessage, BaseEvent } from '../../../../src/shared/loggingEvents'; -import DotNetTestLoggerObserver from '../../../../src/omnisharp/observers/dotnetTestLoggerObserver'; -import * as protocol from '../../../../src/omnisharp/protocol'; +import { getNullChannel } from '../../../fakes.ts'; +import { EventWithMessage, BaseEvent } from '../../../../src/shared/loggingEvents.ts'; +import DotNetTestLoggerObserver from '../../../../src/omnisharp/observers/dotnetTestLoggerObserver.ts'; +import * as protocol from '../../../../src/omnisharp/protocol.ts'; import { DotNetTestDebugComplete, DotNetTestDebugInContextStart, @@ -20,7 +20,7 @@ import { DotNetTestsInClassDebugStart, DotNetTestsInClassRunStart, ReportDotNetTestResults, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe(`${DotNetTestLoggerObserver.name}`, () => { let appendedMessage: string; diff --git a/test/omnisharp/omnisharpUnitTests/logging/errorMessageObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/errorMessageObserver.test.ts index a9348339e0..4b00525f38 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/errorMessageObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/errorMessageObserver.test.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { MessageItem, vscode } from '../../../../src/vscodeAdapter'; -import { ErrorMessageObserver } from '../../../../src/omnisharp/observers/errorMessageObserver'; -import { ZipError, EventWithMessage, IntegrityCheckFailure } from '../../../../src/shared/loggingEvents'; -import { getFakeVsCode } from '../../../fakes'; -import { DotNetTestDebugStartFailure, DotNetTestRunFailure } from '../../../../src/omnisharp/omnisharpLoggingEvents'; +import { MessageItem, vscode } from '../../../../src/vscodeAdapter.ts'; +import { ErrorMessageObserver } from '../../../../src/omnisharp/observers/errorMessageObserver.ts'; +import { ZipError, EventWithMessage, IntegrityCheckFailure } from '../../../../src/shared/loggingEvents.ts'; +import { getFakeVsCode } from '../../../fakes.ts'; +import { DotNetTestDebugStartFailure, DotNetTestRunFailure } from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('ErrorMessageObserver', () => { const vscode: vscode = getFakeVsCode(); diff --git a/test/omnisharp/omnisharpUnitTests/logging/omnisharpChannelObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/omnisharpChannelObserver.test.ts index 4a838a1e30..56e2a6e24f 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/omnisharpChannelObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/omnisharpChannelObserver.test.ts @@ -5,16 +5,16 @@ import * as vscode from 'vscode'; import { jest, describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel, getWorkspaceConfiguration } from '../../../fakes'; -import { OmnisharpChannelObserver } from '../../../../src/omnisharp/observers/omnisharpChannelObserver'; -import { BaseEvent } from '../../../../src/shared/loggingEvents'; +import { getNullChannel, getWorkspaceConfiguration } from '../../../fakes.ts'; +import { OmnisharpChannelObserver } from '../../../../src/omnisharp/observers/omnisharpChannelObserver.ts'; +import { BaseEvent } from '../../../../src/shared/loggingEvents.ts'; import { Subject } from 'rxjs'; import { OmnisharpFailure, OmnisharpRestart, OmnisharpServerOnStdErr, ShowOmniSharpChannel, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('OmnisharpChannelObserver', () => { let hasShown: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/omnisharpDebugModeLoggerObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/omnisharpDebugModeLoggerObserver.test.ts index 09ffa8a098..da29f32d7c 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/omnisharpDebugModeLoggerObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/omnisharpDebugModeLoggerObserver.test.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel } from '../../../fakes'; -import { EventWithMessage } from '../../../../src/shared/loggingEvents'; -import { OmnisharpDebugModeLoggerObserver } from '../../../../src/omnisharp/observers/omnisharpDebugModeLoggerObserver'; +import { getNullChannel } from '../../../fakes.ts'; +import { EventWithMessage } from '../../../../src/shared/loggingEvents.ts'; +import { OmnisharpDebugModeLoggerObserver } from '../../../../src/omnisharp/observers/omnisharpDebugModeLoggerObserver.ts'; import { OmnisharpEventPacketReceived, OmnisharpRequestMessage, @@ -15,7 +15,7 @@ import { OmnisharpServerProcessRequestStart, OmnisharpServerRequestCancelled, OmnisharpServerVerboseMessage, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('OmnisharpDebugModeLoggerObserver', () => { let logOutput = ''; diff --git a/test/omnisharp/omnisharpUnitTests/logging/omnisharpLoggerObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/omnisharpLoggerObserver.test.ts index 48c3c4725f..f0f6144679 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/omnisharpLoggerObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/omnisharpLoggerObserver.test.ts @@ -2,9 +2,9 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { getNullChannel } from '../../../fakes'; +import { getNullChannel } from '../../../fakes.ts'; import { describe, test, expect, beforeEach } from '@jest/globals'; -import { OmnisharpLoggerObserver } from '../../../../src/omnisharp/observers/omnisharpLoggerObserver'; +import { OmnisharpLoggerObserver } from '../../../../src/omnisharp/observers/omnisharpLoggerObserver.ts'; import { OmnisharpServerMsBuildProjectDiagnostics, OmnisharpServerOnStdErr, @@ -15,10 +15,10 @@ import { OmnisharpServerOnError, OmnisharpFailure, OmnisharpEventPacketReceived, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; import { OutputChannel } from 'vscode'; -import { PlatformInformation } from '../../../../src/shared/platform'; -import { EventWithMessage } from '../../../../src/shared/loggingEvents'; +import { PlatformInformation } from '../../../../src/shared/platform.ts'; +import { EventWithMessage } from '../../../../src/shared/loggingEvents.ts'; describe('OmnisharpLoggerObserver', () => { let logOutput = ''; diff --git a/test/omnisharp/omnisharpUnitTests/logging/omnisharpStatusBarObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/omnisharpStatusBarObserver.test.ts index 8bf0a4731b..57ddb8107e 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/omnisharpStatusBarObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/omnisharpStatusBarObserver.test.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { StatusBarItem } from '../../../../src/vscodeAdapter'; +import { StatusBarItem } from '../../../../src/vscodeAdapter.ts'; import { DownloadStart, InstallationStart, DownloadProgress, BaseEvent, InstallationSuccess, -} from '../../../../src/shared/loggingEvents'; +} from '../../../../src/shared/loggingEvents.ts'; import { OmnisharpOnBeforeServerInstall, OmnisharpOnBeforeServerStart, @@ -19,11 +19,11 @@ import { OmnisharpServerOnStart, OmnisharpServerOnStop, OmnisharpServerOnStdErr, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; import { OmnisharpStatusBarObserver, StatusBarColors, -} from '../../../../src/omnisharp/observers/omnisharpStatusBarObserver'; +} from '../../../../src/omnisharp/observers/omnisharpStatusBarObserver.ts'; describe('OmnisharpStatusBarObserver', () => { let showCalled: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/projectStatusBarObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/projectStatusBarObserver.test.ts index dd5da182b6..d41c50610e 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/projectStatusBarObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/projectStatusBarObserver.test.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getWorkspaceInformationUpdated, getMSBuildWorkspaceInformation } from '../../../fakes'; -import { StatusBarItem } from '../../../../src/vscodeAdapter'; -import { ProjectStatusBarObserver } from '../../../../src/omnisharp/observers/projectStatusBarObserver'; +import { getWorkspaceInformationUpdated, getMSBuildWorkspaceInformation } from '../../../fakes.ts'; +import { StatusBarItem } from '../../../../src/vscodeAdapter.ts'; +import { ProjectStatusBarObserver } from '../../../../src/omnisharp/observers/projectStatusBarObserver.ts'; import { OmnisharpOnMultipleLaunchTargets, OmnisharpServerOnStop, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('ProjectStatusBarObserver', () => { let showCalled: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/logging/razorLoggerObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/razorLoggerObserver.test.ts index 9336ca79ac..abe749b5d7 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/razorLoggerObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/razorLoggerObserver.test.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { getNullChannel } from '../../../fakes'; -import { RazorLoggerObserver } from '../../../../src/omnisharp/observers/razorLoggerObserver'; +import { getNullChannel } from '../../../fakes.ts'; +import { RazorLoggerObserver } from '../../../../src/omnisharp/observers/razorLoggerObserver.ts'; import { RazorPluginPathSpecified, RazorPluginPathDoesNotExist, RazorDevModeActive, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; describe('RazorLoggerObserver', () => { let logOutput = ''; diff --git a/test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts index 26b4bf3728..885a51e5bf 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { beforeEach, test, describe, expect } from '@jest/globals'; -import { TelemetryObserver } from '../../../../src/omnisharp/observers/telemetryObserver'; -import { PlatformInformation } from '../../../../src/shared/platform'; -import { PackageInstallation, InstallationFailure, InstallationSuccess } from '../../../../src/shared/loggingEvents'; +import { TelemetryObserver } from '../../../../src/omnisharp/observers/telemetryObserver.ts'; +import { PlatformInformation } from '../../../../src/shared/platform.ts'; +import { PackageInstallation, InstallationFailure, InstallationSuccess } from '../../../../src/shared/loggingEvents.ts'; import { TestExecutionCountReport, TelemetryEventWithMeasures, @@ -15,18 +15,17 @@ import { TelemetryEvent, ProjectConfiguration, TelemetryErrorEvent, -} from '../../../../src/omnisharp/omnisharpLoggingEvents'; -import { getNullTelemetryReporter } from '../../../fakes'; -import { Package } from '../../../../src/packageManager/package'; -import { PackageError } from '../../../../src/packageManager/packageError'; -import { isNotNull } from '../../testUtil'; +} from '../../../../src/omnisharp/omnisharpLoggingEvents.ts'; +import { getNullTelemetryReporter } from '../../../fakes.ts'; +import { Package } from '../../../../src/packageManager/package.ts'; +import { PackageError } from '../../../../src/packageManager/packageError.ts'; +import { isNotNull } from '../../testUtil.ts'; describe('TelemetryReporterObserver', () => { const platformInfo = new PlatformInformation('linux', 'architecture'); let name = ''; let property: { [key: string]: string } | undefined = undefined; let measure: { [key: string]: number }[] = []; - let errorProp: string[] = []; const useModernNet = true; const observer = new TelemetryObserver( platformInfo, @@ -45,15 +44,11 @@ describe('TelemetryReporterObserver', () => { sendTelemetryErrorEvent: ( eventName: string, properties?: { [key: string]: string }, - measures?: { [key: string]: number }, - errorProps?: string[] + measures?: { [key: string]: number } ) => { name += eventName; property = properties; measure.push(measures!); - errorProps!.forEach((prop) => { - errorProp.push(prop); - }); }, }; }, @@ -64,7 +59,6 @@ describe('TelemetryReporterObserver', () => { name = ''; property = undefined; measure = []; - errorProp = []; }); test('PackageInstallation: AcquisitionStart is reported', async () => { @@ -141,13 +135,12 @@ describe('TelemetryReporterObserver', () => { expect(property).toEqual(event.properties); }); - test(`${TelemetryErrorEvent.name}: SendTelemetry error event is called with the name, properties, measures, and errorProps`, async () => { + test(`${TelemetryErrorEvent.name}: SendTelemetry error event is called with the name, properties, and measures`, async () => { const event = new TelemetryErrorEvent('someName', { key: 'value' }, { someKey: 1 }, ['StackTrace']); await observer.post(event); expect(name).toContain(event.eventName); expect(measure).toMatchObject([event.measures!]); expect(property).toEqual(event.properties); - expect(errorProp).toEqual(event.errorProps!); }); describe('InstallationFailure', () => { diff --git a/test/omnisharp/omnisharpUnitTests/logging/warningMessageObserver.test.ts b/test/omnisharp/omnisharpUnitTests/logging/warningMessageObserver.test.ts index 053c03a780..e64ec7cee4 100644 --- a/test/omnisharp/omnisharpUnitTests/logging/warningMessageObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/logging/warningMessageObserver.test.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach } from '@jest/globals'; -import { WarningMessageObserver } from '../../../../src/omnisharp/observers/warningMessageObserver'; +import { WarningMessageObserver } from '../../../../src/omnisharp/observers/warningMessageObserver.ts'; import { getFakeVsCode, getMSBuildDiagnosticsMessage, getOmnisharpMSBuildProjectDiagnosticsEvent, getOmnisharpServerOnErrorEvent, -} from '../../../fakes'; -import { vscode } from '../../../../src/vscodeAdapter'; +} from '../../../fakes.ts'; +import { vscode } from '../../../../src/vscodeAdapter.ts'; import { TestScheduler } from 'rxjs/testing'; import { from as observableFrom, Subject } from 'rxjs'; import { timeout, map } from 'rxjs/operators'; diff --git a/test/omnisharp/omnisharpUnitTests/omnisharp/omniSharpMonoResolver.test.ts b/test/omnisharp/omnisharpUnitTests/omnisharp/omniSharpMonoResolver.test.ts index 3f6b21c324..3e3f387452 100644 --- a/test/omnisharp/omnisharpUnitTests/omnisharp/omniSharpMonoResolver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/omnisharp/omniSharpMonoResolver.test.ts @@ -5,10 +5,10 @@ import * as vscode from 'vscode'; import { describe, test, expect, beforeEach, jest } from '@jest/globals'; -import { OmniSharpMonoResolver } from '../../../../src/omnisharp/omniSharpMonoResolver'; +import { OmniSharpMonoResolver } from '../../../../src/omnisharp/omniSharpMonoResolver.ts'; import { join } from 'path'; -import { getWorkspaceConfiguration } from '../../../fakes'; +import { getWorkspaceConfiguration } from '../../../fakes.ts'; describe(`${OmniSharpMonoResolver.name}`, () => { let getMonoCalled: boolean; diff --git a/test/omnisharp/omnisharpUnitTests/omnisharpDownloader.test.ts b/test/omnisharp/omnisharpUnitTests/omnisharpDownloader.test.ts index 74d2b999f7..a85f85a034 100644 --- a/test/omnisharp/omnisharpUnitTests/omnisharpDownloader.test.ts +++ b/test/omnisharp/omnisharpUnitTests/omnisharpDownloader.test.ts @@ -4,16 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import { OmnisharpDownloader } from '../../../src/omnisharp/omnisharpDownloader'; -import NetworkSettings from '../../../src/networkSettings'; -import { EventStream } from '../../../src/eventStream'; -import { PlatformInformation } from '../../../src/shared/platform'; -import { CreateTmpDir, TmpAsset } from '../../createTmpAsset'; -import * as util from '../../../src/common'; +import { OmnisharpDownloader } from '../../../src/omnisharp/omnisharpDownloader.ts'; +import NetworkSettings from '../../../src/networkSettings.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { PlatformInformation } from '../../../src/shared/platform.ts'; +import { CreateTmpDir, TmpAsset } from '../../createTmpAsset.ts'; +import * as util from '../../../src/common.ts'; import * as path from 'path'; -import MockHttpsServer from './testAssets/mockHttpsServer'; -import TestZip from './testAssets/testZip'; -import { createTestFile } from './testAssets/testFile'; +import MockHttpsServer from './testAssets/mockHttpsServer.ts'; +import TestZip from './testAssets/testZip.ts'; +import { createTestFile } from './testAssets/testFile.ts'; import { PackageInstallation, LogPlatformInfo, @@ -24,10 +24,10 @@ import { InstallationStart, InstallationSuccess, PackageInstallStart, -} from '../../../src/shared/loggingEvents'; -import TestEventBus from './testAssets/testEventBus'; -import { testPackageJSON } from './testAssets/testAssets'; -import { modernNetVersion } from '../../../src/omnisharp/omnisharpPackageCreator'; +} from '../../../src/shared/loggingEvents.ts'; +import TestEventBus from './testAssets/testEventBus.ts'; +import { testPackageJSON } from './testAssets/testAssets.ts'; +import { modernNetVersion } from '../../../src/omnisharp/omnisharpPackageCreator.ts'; [true, false].forEach((useFramework) => { describe(`OmnisharpDownloader (useFramework: ${useFramework})`, () => { diff --git a/test/omnisharp/omnisharpUnitTests/omnisharpManager.test.ts b/test/omnisharp/omnisharpUnitTests/omnisharpManager.test.ts index 78f882771e..16bd33b0f0 100644 --- a/test/omnisharp/omnisharpUnitTests/omnisharpManager.test.ts +++ b/test/omnisharp/omnisharpUnitTests/omnisharpManager.test.ts @@ -4,19 +4,19 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import { OmnisharpManager } from '../../../src/omnisharp/omnisharpManager'; -import MockHttpsServer from './testAssets/mockHttpsServer'; -import TestZip from './testAssets/testZip'; -import { createTestFile } from './testAssets/testFile'; -import { PlatformInformation } from '../../../src/shared/platform'; -import { OmnisharpDownloader } from '../../../src/omnisharp/omnisharpDownloader'; -import NetworkSettings from '../../../src/networkSettings'; -import { EventStream } from '../../../src/eventStream'; -import { testPackageJSON } from './testAssets/testAssets'; -import { TmpAsset, CreateTmpDir, CreateTmpFile } from '../../createTmpAsset'; +import { OmnisharpManager } from '../../../src/omnisharp/omnisharpManager.ts'; +import MockHttpsServer from './testAssets/mockHttpsServer.ts'; +import TestZip from './testAssets/testZip.ts'; +import { createTestFile } from './testAssets/testFile.ts'; +import { PlatformInformation } from '../../../src/shared/platform.ts'; +import { OmnisharpDownloader } from '../../../src/omnisharp/omnisharpDownloader.ts'; +import NetworkSettings from '../../../src/networkSettings.ts'; +import { EventStream } from '../../../src/eventStream.ts'; +import { testPackageJSON } from './testAssets/testAssets.ts'; +import { TmpAsset, CreateTmpDir, CreateTmpFile } from '../../createTmpAsset.ts'; import * as path from 'path'; -import * as util from '../../../src/common'; -import { modernNetVersion } from '../../../src/omnisharp/omnisharpPackageCreator'; +import * as util from '../../../src/common.ts'; +import { modernNetVersion } from '../../../src/omnisharp/omnisharpPackageCreator.ts'; describe(OmnisharpManager.name, () => { let server: MockHttpsServer; diff --git a/test/omnisharp/omnisharpUnitTests/omnisharpPackageCreator.test.ts b/test/omnisharp/omnisharpUnitTests/omnisharpPackageCreator.test.ts index 68425752c9..fbad9c3a64 100644 --- a/test/omnisharp/omnisharpUnitTests/omnisharpPackageCreator.test.ts +++ b/test/omnisharp/omnisharpUnitTests/omnisharpPackageCreator.test.ts @@ -8,10 +8,10 @@ import { SetBinaryAndGetPackage, GetPackagesFromVersion, modernNetVersion, -} from '../../../src/omnisharp/omnisharpPackageCreator'; -import { Package } from '../../../src/packageManager/package'; -import { testPackageJSON } from './testAssets/testAssets'; -import { isNotNull } from '../testUtil'; +} from '../../../src/omnisharp/omnisharpPackageCreator.ts'; +import { Package } from '../../../src/packageManager/package.ts'; +import { testPackageJSON } from './testAssets/testAssets.ts'; +import { isNotNull } from '../testUtil.ts'; describe('GetOmnisharpPackage : Output package depends on the input package and other input parameters like serverUrl', () => { let serverUrl: string; diff --git a/test/omnisharp/omnisharpUnitTests/optionChangeObserver.test.ts b/test/omnisharp/omnisharpUnitTests/optionChangeObserver.test.ts index 29af13fbf2..d286dce6f1 100644 --- a/test/omnisharp/omnisharpUnitTests/optionChangeObserver.test.ts +++ b/test/omnisharp/omnisharpUnitTests/optionChangeObserver.test.ts @@ -5,11 +5,11 @@ import { timeout } from 'rxjs/operators'; import { from as observableFrom, Subject, BehaviorSubject } from 'rxjs'; -import { registerOmnisharpOptionChanges } from '../../../src/omnisharp/omnisharpOptionChanges'; +import { registerOmnisharpOptionChanges } from '../../../src/omnisharp/omnisharpOptionChanges.ts'; import { describe, beforeEach, test, expect } from '@jest/globals'; import * as vscode from 'vscode'; -import { getVSCodeWithConfig, updateConfig } from '../../fakes'; +import { getVSCodeWithConfig, updateConfig } from '../../fakes.ts'; describe('OmniSharpConfigChangeObserver', () => { let doClickOk: () => void; diff --git a/test/omnisharp/omnisharpUnitTests/optionStream.test.ts b/test/omnisharp/omnisharpUnitTests/optionStream.test.ts index 6817977ef3..be42a3f3fe 100644 --- a/test/omnisharp/omnisharpUnitTests/optionStream.test.ts +++ b/test/omnisharp/omnisharpUnitTests/optionStream.test.ts @@ -6,8 +6,8 @@ import * as vscode from 'vscode'; import { jest, describe, test, expect, beforeEach } from '@jest/globals'; import { Observable } from 'rxjs'; -import createOptionStream from '../../../src/shared/observables/createOptionStream'; -import Disposable from '../../../src/disposable'; +import createOptionStream from '../../../src/shared/observables/createOptionStream.ts'; +import Disposable from '../../../src/disposable.ts'; describe('OptionStream', () => { let listenerFunction: Array<(e: vscode.ConfigurationChangeEvent) => any>; diff --git a/test/omnisharp/omnisharpUnitTests/options.test.ts b/test/omnisharp/omnisharpUnitTests/options.test.ts index e69d912fc4..7d29c708a1 100644 --- a/test/omnisharp/omnisharpUnitTests/options.test.ts +++ b/test/omnisharp/omnisharpUnitTests/options.test.ts @@ -6,8 +6,8 @@ import * as vscode from 'vscode'; import { jest, describe, test, expect, beforeEach } from '@jest/globals'; import * as path from 'path'; -import { commonOptions, omnisharpOptions } from '../../../src/shared/options'; -import { getWorkspaceConfiguration } from '../../fakes'; +import { commonOptions, omnisharpOptions } from '../../../src/shared/options.ts'; +import { getWorkspaceConfiguration } from '../../fakes.ts'; describe('Options tests', () => { beforeEach(() => { diff --git a/test/omnisharp/omnisharpUnitTests/packages/downloadAndInstallPackages.test.ts b/test/omnisharp/omnisharpUnitTests/packages/downloadAndInstallPackages.test.ts index 9d8854a2bf..a66244a543 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/downloadAndInstallPackages.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/downloadAndInstallPackages.test.ts @@ -5,12 +5,12 @@ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; import * as path from 'path'; -import * as util from '../../../../src/common'; -import { CreateTmpDir, TmpAsset } from '../../../createTmpAsset'; -import TestZip from '../testAssets/testZip'; -import { downloadAndInstallPackages } from '../../../../src/packageManager/downloadAndInstallPackages'; -import NetworkSettings from '../../../../src/networkSettings'; -import { EventStream } from '../../../../src/eventStream'; +import * as util from '../../../../src/common.ts'; +import { CreateTmpDir, TmpAsset } from '../../../createTmpAsset.ts'; +import TestZip from '../testAssets/testZip.ts'; +import { downloadAndInstallPackages } from '../../../../src/packageManager/downloadAndInstallPackages.ts'; +import NetworkSettings from '../../../../src/networkSettings.ts'; +import { EventStream } from '../../../../src/eventStream.ts'; import { DownloadStart, DownloadSizeObtained, @@ -21,13 +21,13 @@ import { IntegrityCheckFailure, DownloadFailure, InstallationFailure, -} from '../../../../src/shared/loggingEvents'; -import MockHttpsServer from '../testAssets/mockHttpsServer'; -import { createTestFile } from '../testAssets/testFile'; -import TestEventBus from '../testAssets/testEventBus'; -import { AbsolutePathPackage } from '../../../../src/packageManager/absolutePathPackage'; -import { AbsolutePath } from '../../../../src/packageManager/absolutePath'; -import { DownloadValidator } from '../../../../src/packageManager/isValidDownload'; +} from '../../../../src/shared/loggingEvents.ts'; +import MockHttpsServer from '../testAssets/mockHttpsServer.ts'; +import { createTestFile } from '../testAssets/testFile.ts'; +import TestEventBus from '../testAssets/testEventBus.ts'; +import { AbsolutePathPackage } from '../../../../src/packageManager/absolutePathPackage.ts'; +import { AbsolutePath } from '../../../../src/packageManager/absolutePath.ts'; +import { DownloadValidator } from '../../../../src/packageManager/isValidDownload.ts'; describe(`${downloadAndInstallPackages.name}`, () => { let tmpInstallDir: TmpAsset; diff --git a/test/omnisharp/omnisharpUnitTests/packages/fileDownloader.test.ts b/test/omnisharp/omnisharpUnitTests/packages/fileDownloader.test.ts index 5775793899..5a7c8c2032 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/fileDownloader.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/fileDownloader.test.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import { EventStream } from '../../../../src/eventStream'; -import { DownloadFile } from '../../../../src/packageManager/fileDownloader'; -import NetworkSettings from '../../../../src/networkSettings'; +import { EventStream } from '../../../../src/eventStream.ts'; +import { DownloadFile } from '../../../../src/packageManager/fileDownloader.ts'; +import NetworkSettings from '../../../../src/networkSettings.ts'; import { DownloadStart, DownloadSizeObtained, @@ -14,9 +14,9 @@ import { DownloadSuccess, DownloadFallBack, DownloadFailure, -} from '../../../../src/shared/loggingEvents'; -import MockHttpsServer from '../testAssets/mockHttpsServer'; -import TestEventBus from '../testAssets/testEventBus'; +} from '../../../../src/shared/loggingEvents.ts'; +import MockHttpsServer from '../testAssets/mockHttpsServer.ts'; +import TestEventBus from '../testAssets/testEventBus.ts'; describe('FileDownloader', () => { const fileDescription = 'Test file'; diff --git a/test/omnisharp/omnisharpUnitTests/packages/isValidDownload.test.ts b/test/omnisharp/omnisharpUnitTests/packages/isValidDownload.test.ts index c53f7f1923..ab1b5d402a 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/isValidDownload.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/isValidDownload.test.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { isValidDownload } from '../../../../src/packageManager/isValidDownload'; -import { EventStream } from '../../../../src/eventStream'; +import { isValidDownload } from '../../../../src/packageManager/isValidDownload.ts'; +import { EventStream } from '../../../../src/eventStream.ts'; describe(`${isValidDownload.name}`, () => { const sampleBuffer = Buffer.from('sampleBuffer'); diff --git a/test/omnisharp/omnisharpUnitTests/packages/packageFilterer.test.ts b/test/omnisharp/omnisharpUnitTests/packages/packageFilterer.test.ts index e3a5c29426..63dc208127 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/packageFilterer.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/packageFilterer.test.ts @@ -3,19 +3,25 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, jest } from '@jest/globals'; -import { PlatformInformation } from '../../../../src/shared/platform'; -import { getNotInstalledPackagesForPlatform } from '../../../../src/packageManager/packageFilterer'; -import { Package } from '../../../../src/packageManager/package'; -import { AbsolutePathPackage } from '../../../../src/packageManager/absolutePathPackage'; +import { Package } from '../../../../src/packageManager/package.ts'; +import type { AbsolutePathPackage as AbsolutePathPackageType } from '../../../../src/packageManager/absolutePathPackage.ts'; import { MockedFunction } from 'jest-mock'; -import * as fs from 'fs'; +import type * as fs from 'fs'; import { join } from 'path'; -// Necessary when spying on module members. -jest.mock('fs', () => ({ __esModule: true, ...(jest.requireActual('fs')) })); +const mockStat = jest.fn() as unknown as MockedFunction< + (path: fs.PathLike, callback: (err: NodeJS.ErrnoException | null, stats: fs.Stats | undefined) => void) => void +>; +jest.unstable_mockModule('fs', async () => ({ + ...(await import('node:fs')), + stat: mockStat, +})); +const { PlatformInformation } = await import('../../../../src/shared/platform.ts'); +const { getNotInstalledPackagesForPlatform } = await import('../../../../src/packageManager/packageFilterer.ts'); +const { AbsolutePathPackage } = await import('../../../../src/packageManager/absolutePathPackage.ts'); describe(`${getNotInstalledPackagesForPlatform.name}`, () => { - let absolutePathPackages: AbsolutePathPackage[]; + let absolutePathPackages: AbsolutePathPackageType[]; const extensionPath = '/ExtensionPath'; const packages = [ { @@ -79,13 +85,7 @@ describe(`${getNotInstalledPackagesForPlatform.name}`, () => { absolutePathPackages = packages.map((pkg) => AbsolutePathPackage.getAbsolutePathPackage(pkg, extensionPath)); const installLockPath = join(absolutePathPackages[1].installPath.value, 'install.Lock'); //mock the install lock path so the package should be filtered - const statSpy = jest.spyOn(fs, 'stat') as unknown as MockedFunction< - ( - path: fs.PathLike, - callback: (err: NodeJS.ErrnoException | null, stats: fs.Stats | undefined) => void - ) => void - >; - statSpy.mockImplementation((path, callback) => { + mockStat.mockImplementation((path, callback) => { if (installLockPath === path) { callback(null, { isFile: () => true } as unknown as fs.Stats); } else { diff --git a/test/omnisharp/omnisharpUnitTests/packages/proxy.test.ts b/test/omnisharp/omnisharpUnitTests/packages/proxy.test.ts index 4badabccc1..430d20460f 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/proxy.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/proxy.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeAll, afterAll, beforeEach } from '@jest/globals'; -import { getProxyAgent } from '../../../../src/packageManager/proxy'; +import { getProxyAgent } from '../../../../src/packageManager/proxy.ts'; import url from 'url'; describe(`${getProxyAgent.name}`, () => { diff --git a/test/omnisharp/omnisharpUnitTests/packages/zipInstaller.test.ts b/test/omnisharp/omnisharpUnitTests/packages/zipInstaller.test.ts index 6e9b8ab61d..fac2d3481d 100644 --- a/test/omnisharp/omnisharpUnitTests/packages/zipInstaller.test.ts +++ b/test/omnisharp/omnisharpUnitTests/packages/zipInstaller.test.ts @@ -4,18 +4,18 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect, beforeEach, afterEach } from '@jest/globals'; -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import * as path from 'path'; -import * as util from '../../../../src/common'; -import { CreateTmpDir, TmpAsset } from '../../../createTmpAsset'; -import { InstallZip } from '../../../../src/packageManager/zipInstaller'; -import { EventStream } from '../../../../src/eventStream'; -import { PlatformInformation } from '../../../../src/shared/platform'; -import { BaseEvent, InstallationStart, ZipError } from '../../../../src/shared/loggingEvents'; -import { createTestFile } from '../testAssets/testFile'; -import TestZip from '../testAssets/testZip'; -import TestEventBus from '../testAssets/testEventBus'; -import { AbsolutePath } from '../../../../src/packageManager/absolutePath'; +import * as util from '../../../../src/common.ts'; +import { CreateTmpDir, TmpAsset } from '../../../createTmpAsset.ts'; +import { InstallZip } from '../../../../src/packageManager/zipInstaller.ts'; +import { EventStream } from '../../../../src/eventStream.ts'; +import { PlatformInformation } from '../../../../src/shared/platform.ts'; +import { BaseEvent, InstallationStart, ZipError } from '../../../../src/shared/loggingEvents.ts'; +import { createTestFile } from '../testAssets/testFile.ts'; +import TestZip from '../testAssets/testZip.ts'; +import TestEventBus from '../testAssets/testEventBus.ts'; +import { AbsolutePath } from '../../../../src/packageManager/absolutePath.ts'; describe('ZipInstaller', () => { const binaries = [createTestFile('binary1', 'binary1.txt'), createTestFile('binary2', 'binary2.txt')]; diff --git a/test/omnisharp/omnisharpUnitTests/platform.test.ts b/test/omnisharp/omnisharpUnitTests/platform.test.ts index 4d332c22dd..c67e872f0d 100644 --- a/test/omnisharp/omnisharpUnitTests/platform.test.ts +++ b/test/omnisharp/omnisharpUnitTests/platform.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { LinuxDistribution } from '../../../src/shared/platform'; +import { LinuxDistribution } from '../../../src/shared/platform.ts'; describe('Platform', () => { test('Retrieve correct information for Ubuntu 14.04', () => { diff --git a/test/omnisharp/omnisharpUnitTests/processPicker.test.ts b/test/omnisharp/omnisharpUnitTests/processPicker.test.ts index 1f9f7f2381..dcb9c37d30 100644 --- a/test/omnisharp/omnisharpUnitTests/processPicker.test.ts +++ b/test/omnisharp/omnisharpUnitTests/processPicker.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, test, expect } from '@jest/globals'; -import { RemoteAttachPicker, Process, CimProcessParser } from '../../../src/shared/processPicker'; +import { RemoteAttachPicker, Process, CimProcessParser } from '../../../src/shared/processPicker.ts'; describe('Remote Process Picker: Validate quoting arguments.', () => { test('Argument with no spaces', () => { diff --git a/test/omnisharp/omnisharpUnitTests/testAssets/getConfigChangeEvent.ts b/test/omnisharp/omnisharpUnitTests/testAssets/getConfigChangeEvent.ts index 47a8db2c84..3c1c5d2519 100644 --- a/test/omnisharp/omnisharpUnitTests/testAssets/getConfigChangeEvent.ts +++ b/test/omnisharp/omnisharpUnitTests/testAssets/getConfigChangeEvent.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ConfigurationChangeEvent } from '../../../../src/vscodeAdapter'; +import { ConfigurationChangeEvent } from '../../../../src/vscodeAdapter.ts'; export function GetConfigChangeEvent(changingConfig: string): ConfigurationChangeEvent { return { diff --git a/test/omnisharp/omnisharpUnitTests/testAssets/mockHttpsServer.ts b/test/omnisharp/omnisharpUnitTests/testAssets/mockHttpsServer.ts index 3dafd8e9cb..92e8942e2c 100644 --- a/test/omnisharp/omnisharpUnitTests/testAssets/mockHttpsServer.ts +++ b/test/omnisharp/omnisharpUnitTests/testAssets/mockHttpsServer.ts @@ -3,11 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as fs from 'fs-extra'; +import fs from 'fs-extra'; import getPort from 'get-port'; +import { createRequire } from 'node:module'; -// There are no typings for this library. -// eslint-disable-next-line @typescript-eslint/no-var-requires +// mock-http-server is CommonJS-only and has no type declarations. +const require = createRequire(import.meta.url); const ServerMock = require('mock-http-server'); export default class MockHttpsServer { diff --git a/test/omnisharp/omnisharpUnitTests/testAssets/testEventBus.ts b/test/omnisharp/omnisharpUnitTests/testAssets/testEventBus.ts index 5370d02e07..42d8702cc3 100644 --- a/test/omnisharp/omnisharpUnitTests/testAssets/testEventBus.ts +++ b/test/omnisharp/omnisharpUnitTests/testAssets/testEventBus.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EventStream } from '../../../../src/eventStream'; -import { BaseEvent } from '../../../../src/shared/loggingEvents'; -import Disposable, { IDisposable } from '../../../../src/disposable'; +import { EventStream } from '../../../../src/eventStream.ts'; +import { BaseEvent } from '../../../../src/shared/loggingEvents.ts'; +import Disposable, { IDisposable } from '../../../../src/disposable.ts'; export default class TestEventBus { private eventBus: Array; diff --git a/test/omnisharp/omnisharpUnitTests/testAssets/testZip.ts b/test/omnisharp/omnisharpUnitTests/testAssets/testZip.ts index 45d109b9a0..7de47f82ea 100644 --- a/test/omnisharp/omnisharpUnitTests/testAssets/testZip.ts +++ b/test/omnisharp/omnisharpUnitTests/testAssets/testZip.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import archiver from 'archiver'; -import { TestFile } from './testFile'; +import { TestFile } from './testFile.ts'; export default class TestZip { constructor( diff --git a/test/omnisharp/runFeatureTests.ts b/test/omnisharp/runFeatureTests.ts index ac23047302..104d7a1ca3 100644 --- a/test/omnisharp/runFeatureTests.ts +++ b/test/omnisharp/runFeatureTests.ts @@ -4,17 +4,19 @@ *--------------------------------------------------------------------------------------------*/ import * as path from 'path'; +import { fileURLToPath } from 'url'; import { runTests } from '@vscode/test-electron'; async function main() { try { + const currentDirectory = path.dirname(fileURLToPath(import.meta.url)); // The folder containing the Extension Manifest package.json // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + const extensionDevelopmentPath = path.resolve(currentDirectory, '../../'); // The path to the extension test runner script // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './omnisharpFeatureTests/index'); + const extensionTestsPath = path.resolve(currentDirectory, './omnisharpFeatureTests/index'); // Download VS Code, unzip it and run the integration test const exitCode = await runTests({ diff --git a/test/razor/razorIntegrationTests/completion.integration.test.ts b/test/razor/razorIntegrationTests/completion.integration.test.ts index 76444b5011..a34ac65740 100644 --- a/test/razor/razorIntegrationTests/completion.integration.test.ts +++ b/test/razor/razorIntegrationTests/completion.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers.ts'; describe(`Razor Hover ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/razor/razorIntegrationTests/formatting.integration.test.ts b/test/razor/razorIntegrationTests/formatting.integration.test.ts index 8f31b37e02..fbf54f1e69 100644 --- a/test/razor/razorIntegrationTests/formatting.integration.test.ts +++ b/test/razor/razorIntegrationTests/formatting.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers.ts'; describe(`Razor Formatting ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/razor/razorIntegrationTests/hover.integration.test.ts b/test/razor/razorIntegrationTests/hover.integration.test.ts index 1ef66f6fb6..cdabeae3d7 100644 --- a/test/razor/razorIntegrationTests/hover.integration.test.ts +++ b/test/razor/razorIntegrationTests/hover.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers.ts'; describe(`Razor Hover ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/razor/razorIntegrationTests/index.ts b/test/razor/razorIntegrationTests/index.ts index ac2e6a90a2..a229e0117e 100644 --- a/test/razor/razorIntegrationTests/index.ts +++ b/test/razor/razorIntegrationTests/index.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { runIntegrationTests } from '../../runIntegrationTests'; -import { jestIntegrationTestProjectName } from './jest.config'; +import { runIntegrationTests } from '../../runIntegrationTests.ts'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; export async function run() { process.env.RUNNING_INTEGRATION_TESTS = 'true'; - await runIntegrationTests(jestIntegrationTestProjectName); + await runIntegrationTests(jestProjectNames.razorIntegration); } diff --git a/test/lsptoolshost/integrationTests/jest.config.ts b/test/razor/razorIntegrationTests/jest.config.mjs similarity index 67% rename from test/lsptoolshost/integrationTests/jest.config.ts rename to test/razor/razorIntegrationTests/jest.config.mjs index 4865b32f23..c2e634c872 100644 --- a/test/lsptoolshost/integrationTests/jest.config.ts +++ b/test/razor/razorIntegrationTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestIntegrationTestProjectName = 'Integration Tests'; +import { baseIntegrationProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a project configuration for jest integration tests. */ -const integrationTestConfig: Config = { - ...baseProjectConfig, - displayName: jestIntegrationTestProjectName, +/** @type {import('jest').Config} */ +const integrationTestConfig = { + ...baseIntegrationProjectConfig, + displayName: jestProjectNames.razorIntegration, roots: [''], testEnvironment: '/../../vsCodeEnvironment.ts', setupFilesAfterEnv: ['/../../vsCodeFramework.ts'], diff --git a/test/razor/razorIntegrationTests/reference.integration.test.ts b/test/razor/razorIntegrationTests/reference.integration.test.ts index db16443eb2..e0312fde98 100644 --- a/test/razor/razorIntegrationTests/reference.integration.test.ts +++ b/test/razor/razorIntegrationTests/reference.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers.ts'; describe(`Razor References ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/razor/razorIntegrationTests/rename.integration.test.ts b/test/razor/razorIntegrationTests/rename.integration.test.ts index cfcf51c37f..cf38114253 100644 --- a/test/razor/razorIntegrationTests/rename.integration.test.ts +++ b/test/razor/razorIntegrationTests/rename.integration.test.ts @@ -6,8 +6,8 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals'; -import testAssetWorkspace from './testAssets/testAssetWorkspace'; -import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers'; +import testAssetWorkspace from './testAssets/testAssetWorkspace.ts'; +import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers.ts'; describe(`Razor Rename ${testAssetWorkspace.description}`, function () { beforeAll(async function () { diff --git a/test/razor/razorIntegrationTests/testAssets/testAssetWorkspace.ts b/test/razor/razorIntegrationTests/testAssets/testAssetWorkspace.ts index 8fdef79f25..2492b91a71 100644 --- a/test/razor/razorIntegrationTests/testAssets/testAssetWorkspace.ts +++ b/test/razor/razorIntegrationTests/testAssets/testAssetWorkspace.ts @@ -3,7 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITestAssetWorkspace, TestAssetWorkspace } from '../../../lsptoolshost/integrationTests/testAssets/testAssets'; +import { + ITestAssetWorkspace, + TestAssetWorkspace, +} from '../../../lsptoolshost/integrationTests/testAssets/testAssets.ts'; const workspace: ITestAssetWorkspace = { description: 'Basic Razor app', diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/addTagHelperDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/addTagHelperDirective.ts index 6ddf2220ac..2cc0495898 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/addTagHelperDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/addTagHelperDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/attributeDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/attributeDirective.ts index cff873f625..ec3bf8cf3e 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/attributeDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/attributeDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeBlock.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeBlock.ts index 5acec8d531..e70d3cf983 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeBlock.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeBlock.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeDirective.ts index 26671f7d54..5bf21d7ea3 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/codeDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/doStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/doStatement.ts index f04db7eb76..256263d640 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/doStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/doStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/elsePart.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/elsePart.ts index 0bda9a4f81..1db5bc8a04 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/elsePart.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/elsePart.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressionInAttribute.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressionInAttribute.ts index cc714c4dca..40d5f46e9e 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressionInAttribute.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressionInAttribute.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressions.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressions.ts index 2b8722132f..9dabaa0864 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressions.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/explicitExpressions.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/forStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/forStatement.ts index d800857605..51c55e2b3f 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/forStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/forStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/foreachStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/foreachStatement.ts index 68e6c8342a..d1c6a2e8d0 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/foreachStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/foreachStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/functionsDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/functionsDirective.ts index 37cb1d37dc..fd579c74e1 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/functionsDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/functionsDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/grammarTests.test.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/grammarTests.test.ts index dff265a4ab..3ac368c467 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/grammarTests.test.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/grammarTests.test.ts @@ -4,45 +4,45 @@ *--------------------------------------------------------------------------------------------*/ import { describe } from '@jest/globals'; -import { RunAddTagHelperDirectiveSuite } from './addTagHelperDirective'; -import { RunAttributeDirectiveSuite } from './attributeDirective'; -import { RunCodeBlockSuite } from './codeBlock'; -import { RunCodeDirectiveSuite } from './codeDirective'; -import { RunDoStatementSuite } from './doStatement'; -import { RunElsePartSuite } from './elsePart'; -import { RunExplicitExpressionInAttributeSuite } from './explicitExpressionInAttribute'; -import { RunExplicitExpressionSuite } from './explicitExpressions'; -import { RunForeachStatementSuite } from './foreachStatement'; -import { RunForStatementSuite } from './forStatement'; -import { RunFunctionsDirectiveSuite } from './functionsDirective'; -import { RunIfStatementSuite } from './ifStatement'; -import { RunImplementsDirectiveSuite } from './implementsDirective'; -import { RunImplicitExpressionInAttributeSuite } from './implicitExpressionInAttribute'; -import { RunImplicitExpressionSuite } from './implicitExpressions'; -import { RunInheritsDirectiveSuite } from './inheritsDirective'; -import { RunInjectDirectiveSuite } from './injectDirective'; -import { RunLayoutDirectiveSuite } from './layoutDirective'; -import { RunLockStatementSuite } from './lockStatement'; -import { RunModelDirectiveSuite } from './modelDirective'; -import { RunNamespaceDirectiveSuite } from './namespaceDirective'; -import { RunPageDirectiveSuite } from './pageDirective'; -import { RunRazorCommentSuite } from './razorComment'; -import { RunRazorTemplateSuite } from './razorTemplate'; -import { RunRemoveTagHelperDirectiveSuite } from './removeTagHelperDirective'; -import { RunScriptBlockSuite } from './scriptBlock'; -import { RunSectionDirectiveSuite } from './sectionDirective'; -import { RunStyleBlockSuite } from './styleBlock'; -import { RunSwitchStatementSuite } from './switchStatement'; -import { RunTagHelperPrefixDirectiveSuite } from './tagHelperPrefixDirective'; -import { RunTransitionsSuite } from './transitions'; -import { RunTryStatementSuite } from './tryStatement'; -import { RunUsingDirectiveSuite } from './usingDirective'; -import { RunUsingStatementSuite } from './usingStatement'; -import { RunWhileStatementSuite } from './whileStatement'; -import { RunRendermodeDirectiveSuite } from './rendermodeDirective'; -import { RunPreservewhitespaceDirectiveSuite } from './preservewhitespaceDirective'; -import { RunTypeparamDirectiveSuite } from './typeparamDirective'; -import { RunHTMLDynamicAttributeSuite } from './htmlDynamicAttribute'; +import { RunAddTagHelperDirectiveSuite } from './addTagHelperDirective.ts'; +import { RunAttributeDirectiveSuite } from './attributeDirective.ts'; +import { RunCodeBlockSuite } from './codeBlock.ts'; +import { RunCodeDirectiveSuite } from './codeDirective.ts'; +import { RunDoStatementSuite } from './doStatement.ts'; +import { RunElsePartSuite } from './elsePart.ts'; +import { RunExplicitExpressionInAttributeSuite } from './explicitExpressionInAttribute.ts'; +import { RunExplicitExpressionSuite } from './explicitExpressions.ts'; +import { RunForeachStatementSuite } from './foreachStatement.ts'; +import { RunForStatementSuite } from './forStatement.ts'; +import { RunFunctionsDirectiveSuite } from './functionsDirective.ts'; +import { RunIfStatementSuite } from './ifStatement.ts'; +import { RunImplementsDirectiveSuite } from './implementsDirective.ts'; +import { RunImplicitExpressionInAttributeSuite } from './implicitExpressionInAttribute.ts'; +import { RunImplicitExpressionSuite } from './implicitExpressions.ts'; +import { RunInheritsDirectiveSuite } from './inheritsDirective.ts'; +import { RunInjectDirectiveSuite } from './injectDirective.ts'; +import { RunLayoutDirectiveSuite } from './layoutDirective.ts'; +import { RunLockStatementSuite } from './lockStatement.ts'; +import { RunModelDirectiveSuite } from './modelDirective.ts'; +import { RunNamespaceDirectiveSuite } from './namespaceDirective.ts'; +import { RunPageDirectiveSuite } from './pageDirective.ts'; +import { RunRazorCommentSuite } from './razorComment.ts'; +import { RunRazorTemplateSuite } from './razorTemplate.ts'; +import { RunRemoveTagHelperDirectiveSuite } from './removeTagHelperDirective.ts'; +import { RunScriptBlockSuite } from './scriptBlock.ts'; +import { RunSectionDirectiveSuite } from './sectionDirective.ts'; +import { RunStyleBlockSuite } from './styleBlock.ts'; +import { RunSwitchStatementSuite } from './switchStatement.ts'; +import { RunTagHelperPrefixDirectiveSuite } from './tagHelperPrefixDirective.ts'; +import { RunTransitionsSuite } from './transitions.ts'; +import { RunTryStatementSuite } from './tryStatement.ts'; +import { RunUsingDirectiveSuite } from './usingDirective.ts'; +import { RunUsingStatementSuite } from './usingStatement.ts'; +import { RunWhileStatementSuite } from './whileStatement.ts'; +import { RunRendermodeDirectiveSuite } from './rendermodeDirective.ts'; +import { RunPreservewhitespaceDirectiveSuite } from './preservewhitespaceDirective.ts'; +import { RunTypeparamDirectiveSuite } from './typeparamDirective.ts'; +import { RunHTMLDynamicAttributeSuite } from './htmlDynamicAttribute.ts'; // We bring together all test suites and wrap them in one here. The reason behind this is that // modules get reloaded per test suite and the vscode-textmate library doesn't support the way diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/htmlDynamicAttribute.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/htmlDynamicAttribute.ts index 3a86ebec48..02ec0f4ed0 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/htmlDynamicAttribute.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/htmlDynamicAttribute.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/ifStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/ifStatement.ts index 0c46756f4c..dcdd5d2dbe 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/ifStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/ifStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implementsDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implementsDirective.ts index 7a14291168..8c222b5186 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implementsDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implementsDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressionInAttribute.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressionInAttribute.ts index 60a32935d4..5292180b1e 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressionInAttribute.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressionInAttribute.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressions.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressions.ts index 788a66cd49..414b3148ff 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressions.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/implicitExpressions.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/snapshotFactory.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/snapshotFactory.ts index 7e09070506..65af772317 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/snapshotFactory.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/snapshotFactory.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITokenizedContent } from './ITokenizedContent'; +import { ITokenizedContent } from './ITokenizedContent.ts'; export function createSnapshot(tokenizedContent: ITokenizedContent): string { const snapshotLines: string[] = []; diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/testUtilities.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/testUtilities.ts index 36acf8d37b..879aaaa21f 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/testUtilities.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/testUtilities.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { expect } from '@jest/globals'; -import { createSnapshot } from './snapshotFactory'; -import { tokenize } from './tokenizedContentProvider'; +import { createSnapshot } from './snapshotFactory.ts'; +import { tokenize } from './tokenizedContentProvider.ts'; export async function assertMatchesSnapshot(content: string) { const tokenizedContent = await tokenize(content); diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/tokenizedContentProvider.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/tokenizedContentProvider.ts index c04117bcbc..8fb41c639c 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/tokenizedContentProvider.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/infrastructure/tokenizedContentProvider.ts @@ -5,14 +5,20 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as oniguruma from 'vscode-oniguruma'; -import { IGrammar, INITIAL, IRawGrammar, ITokenizeLineResult, parseRawGrammar, Registry } from 'vscode-textmate'; -import { ITokenizedContent } from './ITokenizedContent'; +import { fileURLToPath } from 'url'; +import oniguruma from 'vscode-oniguruma'; +import vscodeTextmate from 'vscode-textmate'; +import type { IGrammar, IRawGrammar, ITokenizeLineResult } from 'vscode-textmate'; +import { ITokenizedContent } from './ITokenizedContent.ts'; +const { INITIAL, parseRawGrammar, Registry } = vscodeTextmate; let razorGrammarCache: IGrammar | undefined; const wasmBin = fs.readFileSync( - path.join(__dirname, '../../../../../../node_modules/vscode-oniguruma/release/onig.wasm') + path.join( + path.dirname(fileURLToPath(import.meta.url)), + '../../../../../../node_modules/vscode-oniguruma/release/onig.wasm' + ) ).buffer; const vscodeOnigurumaLib = oniguruma.loadWASM(wasmBin).then(() => { return { diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/inheritsDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/inheritsDirective.ts index b3a29d0204..01d7462ac4 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/inheritsDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/inheritsDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/injectDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/injectDirective.ts index 7dfbdcada2..0c4f6dc320 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/injectDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/injectDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/layoutDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/layoutDirective.ts index 0b1ae02425..7135a680c4 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/layoutDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/layoutDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/lockStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/lockStatement.ts index c2c0542270..56a6af3330 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/lockStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/lockStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/modelDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/modelDirective.ts index 6764132696..2ff488a45f 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/modelDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/modelDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/namespaceDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/namespaceDirective.ts index 39f5c5cc4e..cffe1c1609 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/namespaceDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/namespaceDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/pageDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/pageDirective.ts index 03294fecd7..2f0ed753b3 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/pageDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/pageDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/preservewhitespaceDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/preservewhitespaceDirective.ts index c81b59d014..c86e2f3aad 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/preservewhitespaceDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/preservewhitespaceDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorComment.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorComment.ts index 45db85a3eb..1322096e7a 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorComment.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorComment.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorTemplate.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorTemplate.ts index 00f384c295..f3940049da 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorTemplate.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/razorTemplate.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/removeTagHelperDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/removeTagHelperDirective.ts index bf7aaf493e..6663648ed7 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/removeTagHelperDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/removeTagHelperDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/rendermodeDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/rendermodeDirective.ts index 9da60b4e5b..a9c64b0f57 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/rendermodeDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/rendermodeDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/scriptBlock.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/scriptBlock.ts index 49a55f3a41..9ab24238dd 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/scriptBlock.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/scriptBlock.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/sectionDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/sectionDirective.ts index 7c3ad559a5..5c02642b64 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/sectionDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/sectionDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/styleBlock.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/styleBlock.ts index 741e7a392b..29fbbb3917 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/styleBlock.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/styleBlock.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/switchStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/switchStatement.ts index 736624bd27..fbbbc088bf 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/switchStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/switchStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tagHelperPrefixDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tagHelperPrefixDirective.ts index befb4f29a0..64ef1c7a96 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tagHelperPrefixDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tagHelperPrefixDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/transitions.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/transitions.ts index 7a4f6831ef..a12c3f7055 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/transitions.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/transitions.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tryStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tryStatement.ts index bc85c2719b..b3cb0d4577 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tryStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/tryStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/typeparamDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/typeparamDirective.ts index 8930205497..f3dd04895d 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/typeparamDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/typeparamDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingDirective.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingDirective.ts index cd77473a5e..89f2a44dea 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingDirective.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingDirective.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingStatement.ts index 6d65b804d6..4dcb741b84 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/usingStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/whileStatement.ts b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/whileStatement.ts index 2a57cfd265..ab81559027 100644 --- a/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/whileStatement.ts +++ b/test/razor/razorTests/Microsoft.AspNetCore.Razor.VSCode.Grammar.Test/tests/whileStatement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it } from '@jest/globals'; -import { assertMatchesSnapshot } from './infrastructure/testUtilities'; +import { assertMatchesSnapshot } from './infrastructure/testUtilities.ts'; // See GrammarTests.test.ts for details on exporting this test suite instead of running in place. diff --git a/test/razor/razorTests/jest.config.ts b/test/razor/razorTests/jest.config.mjs similarity index 77% rename from test/razor/razorTests/jest.config.ts rename to test/razor/razorTests/jest.config.mjs index 3a24378f4e..599a3311c0 100644 --- a/test/razor/razorTests/jest.config.ts +++ b/test/razor/razorTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const razorTestProjectName = 'Razor Unit Tests'; +import { baseProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a jest project configuration for Razor jest tests. */ -const razorConfig: Config = { +/** @type {import('jest').Config} */ +const razorConfig = { ...baseProjectConfig, - displayName: razorTestProjectName, + displayName: jestProjectNames.razorUnit, // We need to explicity ignore the out directory for modules - otherwise we'll get duplicate vscode module, // the TS version from the __mocks__ directory and the compiled js version from the out directory. modulePathIgnorePatterns: ['out'], diff --git a/test/runIntegrationTests.ts b/test/runIntegrationTests.ts index 7acedc7156..4a2906e922 100644 --- a/test/runIntegrationTests.ts +++ b/test/runIntegrationTests.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as jest from 'jest'; +import jest from 'jest'; import { Config } from '@jest/types'; import * as path from 'path'; @@ -13,7 +13,7 @@ export async function runIntegrationTests(projectName: string) { throw new Error('CODE_EXTENSIONS_PATH not set.'); } - const jestConfigPath = path.join(repoRoot, 'jest.config.ts'); + const jestConfigPath = path.join(repoRoot, 'jest.config.mjs'); const jestConfig = { config: jestConfigPath, selectProjects: [projectName], diff --git a/test/tasks/bundleAudit.test.js b/test/tasks/bundleAudit.test.js new file mode 100644 index 0000000000..5ada00d4b9 --- /dev/null +++ b/test/tasks/bundleAudit.test.js @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { expect, test } from '@jest/globals'; +import { auditBundle } from '../../tasks/compilation/bundleAudit.mjs'; + +test('bundle audit rejects first-party CommonJS runtime requires', async () => { + const metafile = { + inputs: { + 'src/unexpected.ts': { + imports: [{ external: true, kind: 'require-call', path: 'node:fs' }], + }, + }, + outputs: { + 'dist/extension.mjs': { + exports: ['activate'], + imports: [{ external: true, kind: 'import-statement', path: 'vscode' }], + }, + }, + }; + + await expect(auditBundle(metafile, false)).rejects.toThrow( + 'First-party source emitted CommonJS runtime requires: src/unexpected.ts -> node:fs' + ); +}); diff --git a/test/tasks/jest.config.ts b/test/tasks/jest.config.mjs similarity index 71% rename from test/tasks/jest.config.ts rename to test/tasks/jest.config.mjs index 70d7886a5e..e2c63f9df2 100644 --- a/test/tasks/jest.config.ts +++ b/test/tasks/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../baseJestConfig'; - -export const jestTasksTestProjectName = 'Tasks Unit Tests'; +import { baseProjectConfig } from '../../baseJestConfig.mjs'; +import { jestProjectNames } from '../jestProjectNames.mjs'; /** * Defines a jest project configuration for tasks unit tests. */ -const tasksTestConfig: Config = { +/** @type {import('jest').Config} */ +const tasksTestConfig = { ...baseProjectConfig, - displayName: jestTasksTestProjectName, + displayName: jestProjectNames.tasksUnit, modulePathIgnorePatterns: ['out'], roots: ['', '../../__mocks__'], }; diff --git a/test/tasks/versionHelper.test.ts b/test/tasks/versionHelper.test.ts index 2ba42ef180..679cf316a7 100644 --- a/test/tasks/versionHelper.test.ts +++ b/test/tasks/versionHelper.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { getNextReleaseVersion } from '../../tasks/snap/snapTasks'; +import { getNextReleaseVersion } from '../../tasks/snap/snapTasks.ts'; import { describe, test, expect } from '@jest/globals'; describe('getNextReleaseVersion', () => { diff --git a/test/untrustedWorkspace/integrationTests/index.ts b/test/untrustedWorkspace/integrationTests/index.ts index ac2e6a90a2..09032c55de 100644 --- a/test/untrustedWorkspace/integrationTests/index.ts +++ b/test/untrustedWorkspace/integrationTests/index.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { runIntegrationTests } from '../../runIntegrationTests'; -import { jestIntegrationTestProjectName } from './jest.config'; +import { runIntegrationTests } from '../../runIntegrationTests.ts'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; export async function run() { process.env.RUNNING_INTEGRATION_TESTS = 'true'; - await runIntegrationTests(jestIntegrationTestProjectName); + await runIntegrationTests(jestProjectNames.untrustedIntegration); } diff --git a/test/razor/razorIntegrationTests/jest.config.ts b/test/untrustedWorkspace/integrationTests/jest.config.mjs similarity index 67% rename from test/razor/razorIntegrationTests/jest.config.ts rename to test/untrustedWorkspace/integrationTests/jest.config.mjs index fd5bec1dc4..7e85705ec7 100644 --- a/test/razor/razorIntegrationTests/jest.config.ts +++ b/test/untrustedWorkspace/integrationTests/jest.config.mjs @@ -2,17 +2,16 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { Config } from 'jest'; -import { baseProjectConfig } from '../../../baseJestConfig'; - -export const jestIntegrationTestProjectName = 'Razor Integration Tests'; +import { baseIntegrationProjectConfig } from '../../../baseJestConfig.mjs'; +import { jestProjectNames } from '../../jestProjectNames.mjs'; /** * Defines a project configuration for jest integration tests. */ -const integrationTestConfig: Config = { - ...baseProjectConfig, - displayName: jestIntegrationTestProjectName, +/** @type {import('jest').Config} */ +const integrationTestConfig = { + ...baseIntegrationProjectConfig, + displayName: jestProjectNames.untrustedIntegration, roots: [''], testEnvironment: '/../../vsCodeEnvironment.ts', setupFilesAfterEnv: ['/../../vsCodeFramework.ts'], diff --git a/test/untrustedWorkspace/integrationTests/untrustedWorkspace.integration.test.ts b/test/untrustedWorkspace/integrationTests/untrustedWorkspace.integration.test.ts index 2068e1dfd4..019b594e3c 100644 --- a/test/untrustedWorkspace/integrationTests/untrustedWorkspace.integration.test.ts +++ b/test/untrustedWorkspace/integrationTests/untrustedWorkspace.integration.test.ts @@ -5,7 +5,7 @@ import { describe, expect, jest, test } from '@jest/globals'; import * as vscode from 'vscode'; -import { CSharpExtensionExports, LimitedExtensionExports } from '../../../src/csharpExtensionExports'; +import { CSharpExtensionExports, LimitedExtensionExports } from '../../../src/csharpExtensionExports.ts'; describe(`Untrusted Workspace`, () => { test(`Limited activation in untrusted workspace`, async () => { diff --git a/test/vsCodeEnvironment.ts b/test/vsCodeEnvironment.ts index 0c886c1164..4d727493bb 100644 --- a/test/vsCodeEnvironment.ts +++ b/test/vsCodeEnvironment.ts @@ -27,4 +27,4 @@ class VsCodeEnvironment extends TestEnvironment { } } -module.exports = VsCodeEnvironment; +export default VsCodeEnvironment; diff --git a/test/vsCodeFramework.ts b/test/vsCodeFramework.ts index 816be12031..4c791b7741 100644 --- a/test/vsCodeFramework.ts +++ b/test/vsCodeFramework.ts @@ -7,3 +7,4 @@ import { jest } from '@jest/globals'; // Defines a virtual mock for the vscode library since it doesn't exist until it gets loaded in by the vscode extension process. jest.mock('vscode', () => (global as any).vscode, { virtual: true }); +jest.unstable_mockModule('vscode', () => (global as any).vscode, { virtual: true }); diff --git a/test/vsCodeUnitFramework.ts b/test/vsCodeUnitFramework.ts new file mode 100644 index 0000000000..2d44262306 --- /dev/null +++ b/test/vsCodeUnitFramework.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { jest } from '@jest/globals'; +import * as mockVsCode from '../__mocks__/vscode.ts'; + +jest.mock('vscode', () => mockVsCode, { virtual: true }); +jest.unstable_mockModule('vscode', () => mockVsCode, { virtual: true }); diff --git a/test/vscodeLauncher.ts b/test/vscodeLauncher.ts index 639925b8d3..03c2f16cd3 100644 --- a/test/vscodeLauncher.ts +++ b/test/vscodeLauncher.ts @@ -6,7 +6,7 @@ import * as cp from 'child_process'; import * as path from 'path'; import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron'; -import { execChildProcess } from '../src/common'; +import { execChildProcess } from '../src/common.ts'; export async function prepareVSCodeAndExecuteTests( extensionDevelopmentPath: string, diff --git a/tsconfig.jest.json b/tsconfig.jest.json new file mode 100644 index 0000000000..e20794f4bf --- /dev/null +++ b/tsconfig.jest.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "moduleResolution": "Node" + } +} diff --git a/tsconfig.json b/tsconfig.json index 9cf7928aac..489935b5e3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "esModuleInterop": true, "target": "ES2022", - "module": "CommonJS", + "module": "NodeNext", "outDir": "out", "lib": [ "ES2021", @@ -28,21 +28,26 @@ "vscode-jsonrpc/node": ["./node_modules/vscode-jsonrpc/lib/node/main"], }, "sourceMap": true, - "moduleResolution": "node", + "moduleResolution": "NodeNext", "moduleDetection": "force", + "allowJs": true, + "rewriteRelativeImportExtensions": true, + "isolatedModules": true, "strict": true, "forceConsistentCasingInFileNames": true, "skipLibCheck": true, "noUnusedLocals": true, "noFallthroughCasesInSwitch": true }, + "files": [ + "test/jestProjectNames.mjs", + "test/jestProjectNames.d.mts", + ], "include": [ - "src", - "tasks", - "test", - "typings", - "__mocks__", - "jest.config.ts", - "baseJestConfig.ts", + "src/**/*.ts", + "tasks/**/*.ts", + "test/**/*.ts", + "typings/**/*.ts", + "__mocks__/**/*.ts", ], } diff --git a/wallaby.js b/wallaby.js index 2f854e80bd..fb2c0313b6 100644 --- a/wallaby.js +++ b/wallaby.js @@ -1,20 +1,20 @@ -module.exports = function(_wallaby) { - return { - env: { - type: "node" - }, - files: [ - "src/**/*.ts*", - "src/**/*.css", - "test/omnisharp/omnisharpUnitTests/**/*.ts*", - "!test/omnisharp/omnisharpUnitTests/**/*.test.ts*" - ], - tests: ["test/omnisharp/omnisharpUnitTests/**/*.test.ts*"], +export default function (_wallaby) { + return { + env: { + type: 'node', + }, + files: [ + 'src/**/*.ts*', + 'src/**/*.css', + 'test/omnisharp/omnisharpUnitTests/**/*.ts*', + '!test/omnisharp/omnisharpUnitTests/**/*.test.ts*', + ], + tests: ['test/omnisharp/omnisharpUnitTests/**/*.test.ts*'], - debug: true, + debug: true, - setup: function(wallaby) { - wallaby.testFramework.ui("tdd"); - } - }; -}; + setup(wallaby) { + wallaby.testFramework.ui('tdd'); + }, + }; +}