diff --git a/package-lock.json b/package-lock.json index b58010c91..555032477 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6775,9 +6775,9 @@ "dev": true }, "node_modules/langium": { - "version": "3.0.0-next.e78aeba", - "resolved": "https://registry.npmjs.org/langium/-/langium-3.0.0-next.e78aeba.tgz", - "integrity": "sha512-aWBY6e2DarLHTYtO6+O5m+A8Dop1WRyMyFroAj5krkU59LOQCL68/Uaydxa4XD8mVjHoKa5JtT58ztgBHwvg8A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/langium/-/langium-3.0.0.tgz", + "integrity": "sha512-+Ez9EoiByeoTu/2BXmEaZ06iPNXM6thWJp02KfBO/raSMyCJ4jw7AkWWa+zBCTm0+Tw1Fj9FOxdqSskyN5nAwg==", "dependencies": { "chevrotain": "~11.0.3", "chevrotain-allstar": "~0.3.0", @@ -6790,17 +6790,17 @@ } }, "node_modules/langium-cli": { - "version": "3.0.0-next.e78aeba", - "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-3.0.0-next.e78aeba.tgz", - "integrity": "sha512-/JHu9zenrvSouTt3VS3AWFtrZsaqTVif3a5gFDgh6ddWvY97JKxuhQ7Z7m7lyZKCX4TazG2BcQKGAT0TRD2qpg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-3.0.1.tgz", + "integrity": "sha512-s1R/4GKkWItfu2o05DxqP71ID5MiGqb1BfXyPeFvIO3+aRSCj6fCj9EXtasvf18lSTUe27H37aO66TNU9VRr+Q==", "dev": true, "dependencies": { "chalk": "~5.3.0", "commander": "~11.0.0", "fs-extra": "~11.1.1", "jsonschema": "~1.4.1", - "langium": "3.0.0-next.e78aeba", - "langium-railroad": "3.0.0-next.e78aeba", + "langium": "~3.0.0", + "langium-railroad": "~3.0.0", "lodash": "~4.17.21" }, "bin": { @@ -6846,12 +6846,12 @@ } }, "node_modules/langium-railroad": { - "version": "3.0.0-next.e78aeba", - "resolved": "https://registry.npmjs.org/langium-railroad/-/langium-railroad-3.0.0-next.e78aeba.tgz", - "integrity": "sha512-4JvT+bNkSM1sL4y1BcCLUfY6MJd5PM58UrQn52U/AfChMdYr1vrte2DcNTVSXjeaR5/zkmRs9bvThS+gdaA6BQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/langium-railroad/-/langium-railroad-3.0.0.tgz", + "integrity": "sha512-GQOnQBGl5gJqzgK/4bKvJO5QhJGNnprpYH6Fghbl4FviVLHwP6yzyqiouDelLSoCadChCr2JqKaBp5HXv7CgWw==", "dev": true, "dependencies": { - "langium": "3.0.0-next.e78aeba", + "langium": "~3.0.0", "railroad-diagrams": "~1.0.0" } }, @@ -14557,7 +14557,7 @@ "chalk": "^5.3.0", "commander": "^12.0.0", "glob": "^10.3.10", - "langium": "^3.0.0-next.e78aeba", + "langium": "^3.0.0", "true-myth": "^7.1.0" }, "bin": { @@ -14603,7 +14603,7 @@ "dependencies": { "chevrotain": "^11.0.3", "glob": "^10.3.10", - "langium": "^3.0.0-next.e78aeba", + "langium": "^3.0.0", "semver": "^7.6.0", "source-map": "^0.7.4", "tree-kill": "^1.2.2", @@ -14614,7 +14614,7 @@ "devDependencies": { "@types/node": "^18.18.12", "@types/ws": "^8.5.10", - "langium-cli": "^3.0.0-next.e78aeba", + "langium-cli": "^3.0.1", "true-myth": "^7.1.0" }, "engines": { diff --git a/packages/safe-ds-cli/package.json b/packages/safe-ds-cli/package.json index a54bb548e..74de4f2dd 100644 --- a/packages/safe-ds-cli/package.json +++ b/packages/safe-ds-cli/package.json @@ -44,7 +44,7 @@ "chalk": "^5.3.0", "commander": "^12.0.0", "glob": "^10.3.10", - "langium": "^3.0.0-next.e78aeba", + "langium": "^3.0.0", "true-myth": "^7.1.0" }, "devDependencies": { diff --git a/packages/safe-ds-cli/src/cli/check.ts b/packages/safe-ds-cli/src/cli/check.ts index 54b688690..1b3c1931a 100644 --- a/packages/safe-ds-cli/src/cli/check.ts +++ b/packages/safe-ds-cli/src/cli/check.ts @@ -1,4 +1,4 @@ -import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang'; +import { createSafeDsServices } from '@safe-ds/lang'; import { NodeFileSystem } from 'langium/node'; import { extractDocuments } from '../helpers/documents.js'; import { diagnosticToString, getDiagnostics } from '../helpers/diagnostics.js'; @@ -7,7 +7,7 @@ import chalk from 'chalk'; import { ExitCode } from './exitCode.js'; export const check = async (fsPaths: string[], options: CheckOptions): Promise => { - const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; + const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; let errorCount = 0; diff --git a/packages/safe-ds-cli/src/cli/format.ts b/packages/safe-ds-cli/src/cli/format.ts index f01ca003e..94a5f0f75 100644 --- a/packages/safe-ds-cli/src/cli/format.ts +++ b/packages/safe-ds-cli/src/cli/format.ts @@ -1,4 +1,4 @@ -import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang'; +import { createSafeDsServices } from '@safe-ds/lang'; import { NodeFileSystem } from 'langium/node'; import { extractDocuments } from '../helpers/documents.js'; import { exitIfDocumentHasSyntaxErrors } from '../helpers/diagnostics.js'; @@ -7,7 +7,7 @@ import { writeFile } from 'node:fs/promises'; import chalk from 'chalk'; export const format = async (fsPaths: string[]): Promise => { - const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; + const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const documents = await extractDocuments(services, fsPaths); // Exit if any document has syntax errors before formatting code diff --git a/packages/safe-ds-cli/src/cli/generate.ts b/packages/safe-ds-cli/src/cli/generate.ts index a4f752262..cc1eadf6b 100644 --- a/packages/safe-ds-cli/src/cli/generate.ts +++ b/packages/safe-ds-cli/src/cli/generate.ts @@ -1,4 +1,4 @@ -import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang'; +import { createSafeDsServices } from '@safe-ds/lang'; import chalk from 'chalk'; import { URI } from 'langium'; import { NodeFileSystem } from 'langium/node'; @@ -9,7 +9,7 @@ import { makeParentDirectoriesSync } from '../helpers/files.js'; import { exitIfDocumentHasErrors } from '../helpers/diagnostics.js'; export const generate = async (fsPaths: string[], options: GenerateOptions): Promise => { - const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; + const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const documents = await extractDocuments(services, fsPaths); // Exit if any document has errors before generating code diff --git a/packages/safe-ds-cli/tests/helpers/documents.test.ts b/packages/safe-ds-cli/tests/helpers/documents.test.ts index 9416cfa38..219163b37 100644 --- a/packages/safe-ds-cli/tests/helpers/documents.test.ts +++ b/packages/safe-ds-cli/tests/helpers/documents.test.ts @@ -1,14 +1,14 @@ import { describe, expect, it } from 'vitest'; import { Result } from 'true-myth'; import { processPaths } from '../../src/helpers/documents.js'; -import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang'; +import { createSafeDsServices } from '@safe-ds/lang'; import { NodeFileSystem } from 'langium/node'; import { fileURLToPath } from 'url'; import path from 'node:path'; import { ExitCode } from '../../src/cli/exitCode.js'; describe('processPaths', async () => { - const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; + const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const testResourcesRoot = new URL('../resources/processPaths/', import.meta.url); const tests: ProcessPathsTest[] = [ diff --git a/packages/safe-ds-lang/package.json b/packages/safe-ds-lang/package.json index cc49fc1b4..f0ee36d1c 100644 --- a/packages/safe-ds-lang/package.json +++ b/packages/safe-ds-lang/package.json @@ -45,7 +45,7 @@ "dependencies": { "chevrotain": "^11.0.3", "glob": "^10.3.10", - "langium": "^3.0.0-next.e78aeba", + "langium": "^3.0.0", "semver": "^7.6.0", "source-map": "^0.7.4", "tree-kill": "^1.2.2", @@ -56,7 +56,7 @@ "devDependencies": { "@types/node": "^18.18.12", "@types/ws": "^8.5.10", - "langium-cli": "^3.0.0-next.e78aeba", + "langium-cli": "^3.0.1", "true-myth": "^7.1.0" }, "engines": { diff --git a/packages/safe-ds-lang/src/language/index.ts b/packages/safe-ds-lang/src/language/index.ts index b6f7c4ede..c4ad95b27 100644 --- a/packages/safe-ds-lang/src/language/index.ts +++ b/packages/safe-ds-lang/src/language/index.ts @@ -1,6 +1,6 @@ // Services export type { SafeDsServices } from './safe-ds-module.js'; -export { createSafeDsServices, createSafeDsServicesWithBuiltins } from './safe-ds-module.js'; +export { createSafeDsServices } from './safe-ds-module.js'; // Language Server export { startLanguageServer } from './main.js'; diff --git a/packages/safe-ds-lang/src/language/safe-ds-module.ts b/packages/safe-ds-lang/src/language/safe-ds-module.ts index 4e12a62e7..c45d65f9d 100644 --- a/packages/safe-ds-lang/src/language/safe-ds-module.ts +++ b/packages/safe-ds-lang/src/language/safe-ds-module.ts @@ -186,46 +186,33 @@ export const SafeDsSharedModule: Module { const shared = inject(createDefaultSharedModule(context), SafeDsGeneratedSharedModule, SafeDsSharedModule); const SafeDs = inject(createDefaultModule({ shared }), SafeDsGeneratedModule, SafeDsModule); + shared.ServiceRegistry.register(SafeDs); registerValidationChecks(SafeDs); - SafeDs.runtime.Runner.updateRunnerCommand(options?.runnerCommand); - return { shared, SafeDs }; -}; -/** - * Create the full set of services required by Langium and load all builtin files into the workspace. - * - * First inject the shared services by merging two modules: - * - Langium default shared services - * - Services generated by langium-cli - * - * Then inject the language-specific services by merging three modules: - * - Langium default language-specific services - * - Services generated by langium-cli - * - Services specified in this file - * - * @param context Optional module context with the LSP connection. - * @param options Further options to configure the Safe-DS module. - * @return An object wrapping the shared services and the language-specific services. - */ -export const createSafeDsServicesWithBuiltins = async function ( - context: DefaultSharedModuleContext, - options?: ModuleOptions, -): Promise<{ - shared: LangiumSharedServices; - SafeDs: SafeDsServices; -}> { - const { shared, SafeDs } = createSafeDsServices(context, options); - await shared.workspace.WorkspaceManager.initializeWorkspace([]); + // If we don't run inside a language server, initialize the configuration provider instantly + if (!context.connection) { + await shared.workspace.ConfigurationProvider.initialized({}); + } + + // Apply options + if (!options?.omitBuiltins) { + await shared.workspace.WorkspaceManager.initializeWorkspace([]); + } + if (options?.runnerCommand) { + /* c8 ignore next 2 */ + SafeDs.runtime.Runner.updateRunnerCommand(options?.runnerCommand); + } + return { shared, SafeDs }; }; @@ -234,7 +221,12 @@ export const createSafeDsServicesWithBuiltins = async function ( */ export interface ModuleOptions { /** - * Optional command to start the runner, if available. + * By default, builtins are loaded into the workspace. If this option is set to true, builtins are omitted. + */ + omitBuiltins?: boolean; + + /** + * Command to start the runner. */ runnerCommand?: string; } diff --git a/packages/safe-ds-lang/tests/helpers/nodeFinder.test.ts b/packages/safe-ds-lang/tests/helpers/nodeFinder.test.ts index 8ab06cd9b..6cda0de50 100644 --- a/packages/safe-ds-lang/tests/helpers/nodeFinder.test.ts +++ b/packages/safe-ds-lang/tests/helpers/nodeFinder.test.ts @@ -1,13 +1,13 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { getNodeOfType, getNodeByLocation } from './nodeFinder.js'; -import { createSafeDsServices } from '../../src/language/safe-ds-module.js'; +import { getNodeByLocation, getNodeOfType } from './nodeFinder.js'; +import { createSafeDsServices } from '../../src/language/index.js'; import { EmptyFileSystem } from 'langium'; import { AssertionError } from 'assert'; import { clearDocuments, parseHelper } from 'langium/test'; import { isSdsClass, isSdsDeclaration, isSdsEnum } from '../../src/language/generated/ast.js'; -describe('getNodeByLocation', () => { - const services = createSafeDsServices(EmptyFileSystem).SafeDs; +describe('getNodeByLocation', async () => { + const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; afterEach(async () => { await clearDocuments(services); @@ -56,8 +56,8 @@ describe('getNodeByLocation', () => { }); }); -describe('getNodeOfType', () => { - const services = createSafeDsServices(EmptyFileSystem).SafeDs; +describe('getNodeOfType', async () => { + const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; afterEach(async () => { await clearDocuments(services); diff --git a/packages/safe-ds-lang/tests/language/builtins/builtinFilesCorrectness.test.ts b/packages/safe-ds-lang/tests/language/builtins/builtinFilesCorrectness.test.ts index 8db0b8d97..647c47152 100644 --- a/packages/safe-ds-lang/tests/language/builtins/builtinFilesCorrectness.test.ts +++ b/packages/safe-ds-lang/tests/language/builtins/builtinFilesCorrectness.test.ts @@ -12,7 +12,7 @@ import { CODE_EXPERIMENTAL_LANGUAGE_FEATURE } from '../../../src/language/valida import { locationToString } from '../../../src/helpers/locations.js'; import { loadDocuments } from '../../helpers/testResources.js'; -const services = createSafeDsServices(NodeFileSystem).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; const builtinFiles = listBuiltinFiles(); diff --git a/packages/safe-ds-lang/tests/language/documentation/safe-ds-comment-provider.test.ts b/packages/safe-ds-lang/tests/language/documentation/safe-ds-comment-provider.test.ts index 6d084c48a..ebf7d7f22 100644 --- a/packages/safe-ds-lang/tests/language/documentation/safe-ds-comment-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/documentation/safe-ds-comment-provider.test.ts @@ -15,7 +15,7 @@ import { import { createSafeDsServices } from '../../../src/language/index.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const commentProvider = services.documentation.CommentProvider; const testComment = '/* test */'; diff --git a/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts b/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts index 333761d09..bf8343c2c 100644 --- a/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts @@ -12,7 +12,7 @@ import { createSafeDsServices } from '../../../src/language/index.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; import { expandToString } from 'langium/generate'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const documentationProvider = services.documentation.DocumentationProvider; const testDocumentation = 'Lorem ipsum.'; diff --git a/packages/safe-ds-lang/tests/language/flow/creator.ts b/packages/safe-ds-lang/tests/language/flow/creator.ts index 61c19c945..f6f36685a 100644 --- a/packages/safe-ds-lang/tests/language/flow/creator.ts +++ b/packages/safe-ds-lang/tests/language/flow/creator.ts @@ -7,7 +7,7 @@ import fs from 'fs'; import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; import { findTestChecks } from '../../helpers/testChecks.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'call graph'; export const createCallGraphTests = (): Promise => { diff --git a/packages/safe-ds-lang/tests/language/flow/model.test.ts b/packages/safe-ds-lang/tests/language/flow/model.test.ts index 2b1e680bb..cb849d6bc 100644 --- a/packages/safe-ds-lang/tests/language/flow/model.test.ts +++ b/packages/safe-ds-lang/tests/language/flow/model.test.ts @@ -5,7 +5,7 @@ import { createSafeDsServices } from '../../../src/language/index.js'; import { EmptyFileSystem } from 'langium'; import { isSdsModule, SdsCallable } from '../../../src/language/generated/ast.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const code = ` fun f1() fun f2() diff --git a/packages/safe-ds-lang/tests/language/flow/safe-ds-call-graph-computer.test.ts b/packages/safe-ds-lang/tests/language/flow/safe-ds-call-graph-computer.test.ts index a6063e36f..720070b32 100644 --- a/packages/safe-ds-lang/tests/language/flow/safe-ds-call-graph-computer.test.ts +++ b/packages/safe-ds-lang/tests/language/flow/safe-ds-call-graph-computer.test.ts @@ -9,7 +9,7 @@ import { SdsCall, SdsCallable, } from '../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; import { createCallGraphTests } from './creator.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; import { isRangeEqual } from 'langium/test'; @@ -17,7 +17,7 @@ import { locationToString } from '../../../src/helpers/locations.js'; import { AssertionError } from 'assert'; import { NodeFileSystem } from 'langium/node'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const callGraphComputer = services.flow.CallGraphComputer; describe('SafeDsCallGraphComputer', () => { diff --git a/packages/safe-ds-lang/tests/language/generation/creator.ts b/packages/safe-ds-lang/tests/language/generation/creator.ts index 9f5d5e559..bbb626a56 100644 --- a/packages/safe-ds-lang/tests/language/generation/creator.ts +++ b/packages/safe-ds-lang/tests/language/generation/creator.ts @@ -5,7 +5,6 @@ import { uriToShortenedTestResourceName, } from '../../helpers/testResources.js'; import path from 'path'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { ErrorsInCodeError, getErrorsAtURI } from '../../helpers/diagnostics.js'; import { findTestChecks } from '../../helpers/testChecks.js'; import { Location } from 'vscode-languageserver'; @@ -13,8 +12,9 @@ import { NodeFileSystem } from 'langium/node'; import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; import { locationToString } from '../../../src/helpers/locations.js'; import { URI } from 'langium'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; const rootResourceName = 'generation'; diff --git a/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts index 8b43d9747..242c5f323 100644 --- a/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts +++ b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts @@ -1,11 +1,11 @@ -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { describe, expect, it } from 'vitest'; import { NodeFileSystem } from 'langium/node'; import { createGenerationTests } from './creator.js'; import { loadDocuments } from '../../helpers/testResources.js'; import { stream, URI } from 'langium'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; const pythonGenerator = services.generation.PythonGenerator; diff --git a/packages/safe-ds-lang/tests/language/grammar/safe-ds-grammar.test.ts b/packages/safe-ds-lang/tests/language/grammar/safe-ds-grammar.test.ts index d86a82044..56d75603d 100644 --- a/packages/safe-ds-lang/tests/language/grammar/safe-ds-grammar.test.ts +++ b/packages/safe-ds-lang/tests/language/grammar/safe-ds-grammar.test.ts @@ -5,7 +5,7 @@ import { NodeFileSystem } from 'langium/node'; import { createGrammarTests } from './creator.js'; import { getSyntaxErrors } from '../../helpers/diagnostics.js'; -const services = createSafeDsServices(NodeFileSystem).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; describe('grammar', () => { it.each(createGrammarTests())('$testName', async (test) => { diff --git a/packages/safe-ds-lang/tests/language/grammar/safe-ds-value-converter.test.ts b/packages/safe-ds-lang/tests/language/grammar/safe-ds-value-converter.test.ts index 53c1f1e41..9731d6301 100644 --- a/packages/safe-ds-lang/tests/language/grammar/safe-ds-value-converter.test.ts +++ b/packages/safe-ds-lang/tests/language/grammar/safe-ds-value-converter.test.ts @@ -13,7 +13,7 @@ import { } from '../../../src/language/generated/ast.js'; import { escapeString } from '../../../src/language/grammar/safe-ds-value-converter.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; describe('runConverter', () => { describe('ID', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/argumentToParameter.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/argumentToParameter.test.ts index 5355a1249..91d671b20 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/argumentToParameter.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/argumentToParameter.test.ts @@ -1,11 +1,10 @@ import { EmptyFileSystem } from 'langium'; import { describe, expect, it } from 'vitest'; import { isSdsAbstractCall, SdsArgument } from '../../../../src/language/generated/ast.js'; -import { getArguments } from '../../../../src/language/helpers/nodeProperties.js'; -import { createSafeDsServices } from '../../../../src/language/index.js'; +import { createSafeDsServices, getArguments } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/assigneeToAssignedObject.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/assigneeToAssignedObject.test.ts index 676b1462c..4ce91c25e 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/assigneeToAssignedObject.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/assigneeToAssignedObject.test.ts @@ -7,10 +7,10 @@ import { SdsAssignee, } from '../../../../src/language/generated/ast.js'; import { getAssignees } from '../../../../src/language/helpers/nodeProperties.js'; -import { createSafeDsServicesWithBuiltins } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; +import { createSafeDsServices } from '../../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToCallable.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToCallable.test.ts index cfd8ccd02..3fca91233 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToCallable.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToCallable.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; import { isSdsAbstractCall } from '../../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; import { NodeFileSystem } from 'langium/node'; +import { createSafeDsServices } from '../../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToParameterValue.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToParameterValue.test.ts index abcf69afa..f5174edec 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToParameterValue.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/callToParameterValue.test.ts @@ -7,12 +7,11 @@ import { SdsParameter, SdsPipeline, } from '../../../../src/language/generated/ast.js'; -import { createSafeDsServices } from '../../../../src/language/index.js'; +import { createSafeDsServices, getModuleMembers, getParameters } from '../../../../src/language/index.js'; import { Constant, IntConstant } from '../../../../src/language/partialEvaluation/model.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -import { getModuleMembers, getParameters } from '../../../../src/language/helpers/nodeProperties.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const callGraphComputer = services.flow.CallGraphComputer; const nodeMapper = services.helpers.NodeMapper; const partialEvaluator = services.evaluation.PartialEvaluator; diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parameterToReferences.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parameterToReferences.test.ts index 690883cf2..5b3b18457 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parameterToReferences.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parameterToReferences.test.ts @@ -4,7 +4,7 @@ import { isSdsParameter } from '../../../../src/language/generated/ast.js'; import { createSafeDsServices } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parametersToArguments.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parametersToArguments.test.ts index a26899bf7..234e7ea40 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parametersToArguments.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/parametersToArguments.test.ts @@ -7,11 +7,10 @@ import { SdsParameter, SdsPipeline, } from '../../../../src/language/generated/ast.js'; -import { createSafeDsServices } from '../../../../src/language/index.js'; +import { createSafeDsServices, getArguments, getModuleMembers, getParameters } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -import { getArguments, getModuleMembers, getParameters } from '../../../../src/language/helpers/nodeProperties.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const callGraphComputer = services.flow.CallGraphComputer; const nodeMapper = services.helpers.NodeMapper; diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/placeholdersToReferences.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/placeholdersToReferences.test.ts index 16dd15f9d..f7468827c 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/placeholdersToReferences.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/placeholdersToReferences.test.ts @@ -4,7 +4,7 @@ import { isSdsPlaceholder } from '../../../../src/language/generated/ast.js'; import { createSafeDsServices } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/resultToYields.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/resultToYields.test.ts index f96c086e5..ee3d29e1d 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/resultToYields.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/resultToYields.test.ts @@ -4,7 +4,7 @@ import { isSdsResult } from '../../../../src/language/generated/ast.js'; import { createSafeDsServices } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/typeArgumentToTypeParameter.test.ts b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/typeArgumentToTypeParameter.test.ts index f688ca00c..ea194e058 100644 --- a/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/typeArgumentToTypeParameter.test.ts +++ b/packages/safe-ds-lang/tests/language/helpers/safe-ds-node-mapper/typeArgumentToTypeParameter.test.ts @@ -5,7 +5,7 @@ import { getTypeArguments } from '../../../../src/language/helpers/nodePropertie import { createSafeDsServices } from '../../../../src/language/index.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const nodeMapper = services.helpers.NodeMapper; describe('SafeDsNodeMapper', () => { diff --git a/packages/safe-ds-lang/tests/language/lsp/formatting/creator.ts b/packages/safe-ds-lang/tests/language/lsp/formatting/creator.ts index 844864667..09c678524 100644 --- a/packages/safe-ds-lang/tests/language/lsp/formatting/creator.ts +++ b/packages/safe-ds-lang/tests/language/lsp/formatting/creator.ts @@ -7,7 +7,7 @@ import { getSyntaxErrors } from '../../../helpers/diagnostics.js'; import { TestDescription, TestDescriptionError } from '../../../helpers/testDescription.js'; import { listTestSafeDsFiles, uriToShortenedTestResourceName } from '../../../helpers/testResources.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'formatting'; const separator = '// -----------------------------------------------------------------------------'; diff --git a/packages/safe-ds-lang/tests/language/lsp/formatting/safe-ds-formatter.test.ts b/packages/safe-ds-lang/tests/language/lsp/formatting/safe-ds-formatter.test.ts index 02119f12e..b2821f6c5 100644 --- a/packages/safe-ds-lang/tests/language/lsp/formatting/safe-ds-formatter.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/formatting/safe-ds-formatter.test.ts @@ -4,7 +4,7 @@ import { afterEach, describe, it } from 'vitest'; import { EmptyFileSystem } from 'langium'; import { createFormattingTests } from './creator.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const formatterTests = createFormattingTests(); describe('formatter', async () => { diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-call-hierarchy-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-call-hierarchy-provider.test.ts index e364324a0..cc9841576 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-call-hierarchy-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-call-hierarchy-provider.test.ts @@ -2,10 +2,10 @@ import { NodeFileSystem } from 'langium/node'; import { parseHelper } from 'langium/test'; import { describe, expect, it } from 'vitest'; import { type CallHierarchyItem } from 'vscode-languageserver'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { findTestRanges } from '../../helpers/testRanges.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const callHierarchyProvider = services.lsp.CallHierarchyProvider!; const parse = parseHelper(services); diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-document-symbol-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-document-symbol-provider.test.ts index 4efdbf37b..2f62fc5ba 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-document-symbol-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-document-symbol-provider.test.ts @@ -2,9 +2,9 @@ import { NodeFileSystem } from 'langium/node'; import { parseDocument, textDocumentParams } from 'langium/test'; import { describe, expect, it } from 'vitest'; import { DocumentSymbol, SymbolKind, SymbolTag } from 'vscode-languageserver'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const symbolProvider = services.lsp.DocumentSymbolProvider!; describe('SafeDsSemanticTokenProvider', async () => { diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-inlay-hint-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-inlay-hint-provider.test.ts index 1dca3873d..d159820f0 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-inlay-hint-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-inlay-hint-provider.test.ts @@ -1,12 +1,12 @@ import { describe, expect, it } from 'vitest'; import { parseHelper } from 'langium/test'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { InlayHint, Position } from 'vscode-languageserver'; import { NodeFileSystem } from 'langium/node'; import { findTestChecks } from '../../helpers/testChecks.js'; import { URI } from 'langium'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const inlayHintProvider = services.lsp.InlayHintProvider!; const parse = parseHelper(services); diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-rename-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-rename-provider.test.ts index 992b26f59..4f24dcd8e 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-rename-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-rename-provider.test.ts @@ -1,12 +1,12 @@ import { NodeFileSystem } from 'langium/node'; import { afterEach, describe, expect, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins, getModuleMembers } from '../../../src/language/index.js'; +import { createSafeDsServices, getModuleMembers } from '../../../src/language/index.js'; import { clearDocuments } from 'langium/test'; import { SdsModule } from '../../../src/language/generated/ast.js'; import { URI } from 'langium'; import { TextDocument } from 'vscode-languageserver-textdocument'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const documentBuilder = services.shared.workspace.DocumentBuilder; const langiumDocuments = services.shared.workspace.LangiumDocuments; const langiumDocumentFactory = services.shared.workspace.LangiumDocumentFactory; diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-semantic-token-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-semantic-token-provider.test.ts index 3eb440192..a6314b606 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-semantic-token-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-semantic-token-provider.test.ts @@ -3,9 +3,9 @@ import { NodeFileSystem } from 'langium/node'; import { highlightHelper } from 'langium/test'; import { describe, it } from 'vitest'; import { SemanticTokenTypes } from 'vscode-languageserver'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; describe('SafeDsSemanticTokenProvider', async () => { it.each([ diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-signature-help-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-signature-help-provider.test.ts index 2fde5cb1c..84fc27905 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-signature-help-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-signature-help-provider.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from 'vitest'; import { parseHelper } from 'langium/test'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { SignatureHelp } from 'vscode-languageserver'; import { NodeFileSystem } from 'langium/node'; import { findTestRanges } from '../../helpers/testRanges.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const signatureHelpProvider = services.lsp.SignatureHelp!; const parse = parseHelper(services); diff --git a/packages/safe-ds-lang/tests/language/lsp/safe-ds-type-hierarchy-provider.test.ts b/packages/safe-ds-lang/tests/language/lsp/safe-ds-type-hierarchy-provider.test.ts index c005939ad..372fa0353 100644 --- a/packages/safe-ds-lang/tests/language/lsp/safe-ds-type-hierarchy-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/lsp/safe-ds-type-hierarchy-provider.test.ts @@ -2,10 +2,10 @@ import { NodeFileSystem } from 'langium/node'; import { parseHelper } from 'langium/test'; import { describe, expect, it } from 'vitest'; import { type TypeHierarchyItem } from 'vscode-languageserver'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { findTestRanges } from '../../helpers/testRanges.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const typeHierarchyProvider = services.lsp.TypeHierarchyProvider!; const parse = parseHelper(services); diff --git a/packages/safe-ds-lang/tests/language/partialEvaluation/canBeValueOfConstantParameter.test.ts b/packages/safe-ds-lang/tests/language/partialEvaluation/canBeValueOfConstantParameter.test.ts index b0377f117..677325e9f 100644 --- a/packages/safe-ds-lang/tests/language/partialEvaluation/canBeValueOfConstantParameter.test.ts +++ b/packages/safe-ds-lang/tests/language/partialEvaluation/canBeValueOfConstantParameter.test.ts @@ -1,10 +1,10 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; import { isSdsExpression } from '../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const partialEvaluator = services.evaluation.PartialEvaluator; describe('SafeDsTypeChecker', async () => { diff --git a/packages/safe-ds-lang/tests/language/partialEvaluation/creator.ts b/packages/safe-ds-lang/tests/language/partialEvaluation/creator.ts index 5606fd19c..1a65ed268 100644 --- a/packages/safe-ds-lang/tests/language/partialEvaluation/creator.ts +++ b/packages/safe-ds-lang/tests/language/partialEvaluation/creator.ts @@ -10,7 +10,7 @@ import { uriToShortenedTestResourceName, } from '../../helpers/testResources.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'partial evaluation'; export const createPartialEvaluationTests = (): Promise => { diff --git a/packages/safe-ds-lang/tests/language/partialEvaluation/model.test.ts b/packages/safe-ds-lang/tests/language/partialEvaluation/model.test.ts index dd536fac3..0dcd0630c 100644 --- a/packages/safe-ds-lang/tests/language/partialEvaluation/model.test.ts +++ b/packages/safe-ds-lang/tests/language/partialEvaluation/model.test.ts @@ -8,8 +8,7 @@ import { isSdsSegment, type SdsBlockLambdaResult, } from '../../../src/language/generated/ast.js'; -import { getAbstractResults, getParameters } from '../../../src/language/helpers/nodeProperties.js'; -import { createSafeDsServices } from '../../../src/language/index.js'; +import { createSafeDsServices, getAbstractResults, getParameters } from '../../../src/language/index.js'; import { BlockLambdaClosure, BooleanConstant, @@ -31,7 +30,7 @@ import { import { getNodeOfType } from '../../helpers/nodeFinder.js'; import type { EqualsTest, ToStringTest } from '../../helpers/testDescription.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const code = ` enum MyEnum { MyEnumVariant1 diff --git a/packages/safe-ds-lang/tests/language/partialEvaluation/safe-ds-partial-evalutator.test.ts b/packages/safe-ds-lang/tests/language/partialEvaluation/safe-ds-partial-evalutator.test.ts index c8d6465de..27a6d3d44 100644 --- a/packages/safe-ds-lang/tests/language/partialEvaluation/safe-ds-partial-evalutator.test.ts +++ b/packages/safe-ds-lang/tests/language/partialEvaluation/safe-ds-partial-evalutator.test.ts @@ -1,13 +1,13 @@ import { AssertionError } from 'assert'; import { NodeFileSystem } from 'langium/node'; import { describe, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { locationToString } from '../../../src/helpers/locations.js'; import { getNodeByLocation } from '../../helpers/nodeFinder.js'; import { loadDocuments } from '../../helpers/testResources.js'; import { createPartialEvaluationTests } from './creator.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const partialEvaluator = services.evaluation.PartialEvaluator; describe('partial evaluation', async () => { diff --git a/packages/safe-ds-lang/tests/language/purity/model.test.ts b/packages/safe-ds-lang/tests/language/purity/model.test.ts index 9b2bf9851..157e8fefa 100644 --- a/packages/safe-ds-lang/tests/language/purity/model.test.ts +++ b/packages/safe-ds-lang/tests/language/purity/model.test.ts @@ -1,7 +1,6 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; import { isSdsParameter } from '../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { EndlessRecursion, FileRead, @@ -13,8 +12,9 @@ import { } from '../../../src/language/purity/model.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; import { type EqualsTest, ToStringTest } from '../../helpers/testDescription.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const parameter = await getNodeOfType(services, 'fun f(p: Int)', isSdsParameter); describe('purity model', async () => { diff --git a/packages/safe-ds-lang/tests/language/purity/safe-ds-purity-computer.test.ts b/packages/safe-ds-lang/tests/language/purity/safe-ds-purity-computer.test.ts index a6ea70ea4..cfd7b104e 100644 --- a/packages/safe-ds-lang/tests/language/purity/safe-ds-purity-computer.test.ts +++ b/packages/safe-ds-lang/tests/language/purity/safe-ds-purity-computer.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; import { NodeFileSystem } from 'langium/node'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { isSdsCall, isSdsCallable, isSdsExpression, isSdsParameter } from '../../../src/language/generated/ast.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const purityComputer = services.purity.PurityComputer; describe('SafeDsPurityComputer', async () => { diff --git a/packages/safe-ds-lang/tests/language/runner/safe-ds-runner.test.ts b/packages/safe-ds-lang/tests/language/runner/safe-ds-runner.test.ts index 05355add2..b0ff26f23 100644 --- a/packages/safe-ds-lang/tests/language/runner/safe-ds-runner.test.ts +++ b/packages/safe-ds-lang/tests/language/runner/safe-ds-runner.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { NodeFileSystem } from 'langium/node'; import net from 'net'; import { URI } from 'langium'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const runner = services.runtime.Runner; describe('SafeDsRunner', async () => { diff --git a/packages/safe-ds-lang/tests/language/scoping/creator.ts b/packages/safe-ds-lang/tests/language/scoping/creator.ts index 7c7db5f37..8219f6f15 100644 --- a/packages/safe-ds-lang/tests/language/scoping/creator.ts +++ b/packages/safe-ds-lang/tests/language/scoping/creator.ts @@ -10,7 +10,7 @@ import { uriToShortenedTestResourceName, } from '../../helpers/testResources.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'scoping'; export const createScopingTests = (): Promise => { diff --git a/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts b/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts index 23df444bb..8abe06e58 100644 --- a/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts +++ b/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts @@ -11,7 +11,7 @@ import { createScopingTests, ExpectedReference } from './creator.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; import { isSdsAnnotationCall, isSdsNamedType, isSdsReference } from '../../../src/language/generated/ast.js'; -const services = createSafeDsServices(NodeFileSystem).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const builtinAnnotations = services.builtins.Annotations; const builtinEnums = services.builtins.Enums; const builtinClasses = services.builtins.Classes; diff --git a/packages/safe-ds-lang/tests/language/typing/model.test.ts b/packages/safe-ds-lang/tests/language/typing/model.test.ts index c626b0213..e9be2a0ab 100644 --- a/packages/safe-ds-lang/tests/language/typing/model.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/model.test.ts @@ -1,12 +1,7 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; import { isSdsClass, isSdsEnum, isSdsEnumVariant, isSdsFunction } from '../../../src/language/generated/ast.js'; -import { - createSafeDsServicesWithBuiltins, - getParameters, - getResults, - getTypeParameters, -} from '../../../src/language/index.js'; +import { createSafeDsServices, getParameters, getResults, getTypeParameters } from '../../../src/language/index.js'; import { BooleanConstant, IntConstant, NullConstant } from '../../../src/language/partialEvaluation/model.js'; import { ClassType, @@ -22,7 +17,7 @@ import { getNodeOfType } from '../../helpers/nodeFinder.js'; import type { EqualsTest, ToStringTest } from '../../helpers/testDescription.js'; import { expectEqualTypes } from '../../helpers/testAssertions.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const coreTypes = services.types.CoreTypes; const factory = services.types.TypeFactory; diff --git a/packages/safe-ds-lang/tests/language/typing/safe-ds-class-hierarchy.test.ts b/packages/safe-ds-lang/tests/language/typing/safe-ds-class-hierarchy.test.ts index 0628a5ced..766659551 100644 --- a/packages/safe-ds-lang/tests/language/typing/safe-ds-class-hierarchy.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/safe-ds-class-hierarchy.test.ts @@ -7,10 +7,10 @@ import { SdsClass, type SdsClassMember, } from '../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins, getClassMembers } from '../../../src/language/index.js'; +import { createSafeDsServices, getClassMembers } from '../../../src/language/index.js'; import { getNodeOfType } from '../../helpers/nodeFinder.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const builtinClasses = services.builtins.Classes; const classHierarchy = services.types.ClassHierarchy; diff --git a/packages/safe-ds-lang/tests/language/typing/type checker/canBeTypeOfConstantParameter.test.ts b/packages/safe-ds-lang/tests/language/typing/type checker/canBeTypeOfConstantParameter.test.ts index 312a2afc4..b07583d0a 100644 --- a/packages/safe-ds-lang/tests/language/typing/type checker/canBeTypeOfConstantParameter.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type checker/canBeTypeOfConstantParameter.test.ts @@ -1,11 +1,11 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; import { isSdsClass, isSdsEnum, isSdsModule } from '../../../../src/language/generated/ast.js'; -import { createSafeDsServicesWithBuiltins, getEnumVariants, getModuleMembers } from '../../../../src/language/index.js'; +import { createSafeDsServices, getEnumVariants, getModuleMembers } from '../../../../src/language/index.js'; import { ClassType, EnumType, EnumVariantType, Type, UnknownType } from '../../../../src/language/typing/model.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const coreTypes = services.types.CoreTypes; const factory = services.types.TypeFactory; const typeChecker = services.types.TypeChecker; diff --git a/packages/safe-ds-lang/tests/language/typing/type checker/isSubOrSupertypeOf.test.ts b/packages/safe-ds-lang/tests/language/typing/type checker/isSubOrSupertypeOf.test.ts index 0d81b4a6f..247a85fc7 100644 --- a/packages/safe-ds-lang/tests/language/typing/type checker/isSubOrSupertypeOf.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type checker/isSubOrSupertypeOf.test.ts @@ -10,7 +10,7 @@ import { SdsDeclaration, } from '../../../../src/language/generated/ast.js'; import { - createSafeDsServicesWithBuiltins, + createSafeDsServices, getClassMembers, getModuleMembers, getTypeParameters, @@ -34,7 +34,7 @@ import { import { getNodeOfType } from '../../../helpers/nodeFinder.js'; import { AstUtils } from 'langium'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const coreTypes = services.types.CoreTypes; const factory = services.types.TypeFactory; const typeChecker = services.types.TypeChecker; diff --git a/packages/safe-ds-lang/tests/language/typing/type computer/computeClassTypeForLiteralType.test.ts b/packages/safe-ds-lang/tests/language/typing/type computer/computeClassTypeForLiteralType.test.ts index 70066dc28..eedecb292 100644 --- a/packages/safe-ds-lang/tests/language/typing/type computer/computeClassTypeForLiteralType.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type computer/computeClassTypeForLiteralType.test.ts @@ -1,6 +1,5 @@ import { NodeFileSystem } from 'langium/node'; import { describe, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../../src/language/index.js'; import { BooleanConstant, FloatConstant, @@ -10,8 +9,9 @@ import { } from '../../../../src/language/partialEvaluation/model.js'; import { LiteralType, Type } from '../../../../src/language/typing/model.js'; import { expectEqualTypes } from '../../../helpers/testAssertions.js'; +import { createSafeDsServices } from '../../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const coreTypes = services.types.CoreTypes; const factory = services.types.TypeFactory; const typeComputer = services.types.TypeComputer; diff --git a/packages/safe-ds-lang/tests/language/typing/type computer/computeUpperBound.test.ts b/packages/safe-ds-lang/tests/language/typing/type computer/computeUpperBound.test.ts index 2019d451f..916e1826b 100644 --- a/packages/safe-ds-lang/tests/language/typing/type computer/computeUpperBound.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type computer/computeUpperBound.test.ts @@ -1,16 +1,12 @@ import { NodeFileSystem } from 'langium/node'; import { describe, it } from 'vitest'; import { isSdsClass, isSdsModule, SdsTypeParameter } from '../../../../src/language/generated/ast.js'; -import { - createSafeDsServicesWithBuiltins, - getModuleMembers, - getTypeParameters, -} from '../../../../src/language/index.js'; +import { createSafeDsServices, getModuleMembers, getTypeParameters } from '../../../../src/language/index.js'; import { Type, UnknownType } from '../../../../src/language/typing/model.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; import { expectEqualTypes } from '../../../helpers/testAssertions.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const coreTypes = services.types.CoreTypes; const typeComputer = services.types.TypeComputer; diff --git a/packages/safe-ds-lang/tests/language/typing/type computer/creator.ts b/packages/safe-ds-lang/tests/language/typing/type computer/creator.ts index 3a8ac72db..4c11a5584 100644 --- a/packages/safe-ds-lang/tests/language/typing/type computer/creator.ts +++ b/packages/safe-ds-lang/tests/language/typing/type computer/creator.ts @@ -10,7 +10,7 @@ import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../../src/language/index.js'; import { TestDescription, TestDescriptionError } from '../../../helpers/testDescription.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'typing'; export const createTypingTests = (): Promise => { diff --git a/packages/safe-ds-lang/tests/language/typing/type computer/safe-ds-type-computer.test.ts b/packages/safe-ds-lang/tests/language/typing/type computer/safe-ds-type-computer.test.ts index e708e7b06..e69b125d4 100644 --- a/packages/safe-ds-lang/tests/language/typing/type computer/safe-ds-type-computer.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type computer/safe-ds-type-computer.test.ts @@ -1,13 +1,13 @@ import { describe, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../../src/language/index.js'; import { NodeFileSystem } from 'langium/node'; import { AssertionError } from 'assert'; import { locationToString } from '../../../../src/helpers/locations.js'; import { createTypingTests } from './creator.js'; import { getNodeByLocation } from '../../../helpers/nodeFinder.js'; import { loadDocuments } from '../../../helpers/testResources.js'; +import { createSafeDsServices } from '../../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const typeComputer = services.types.TypeComputer; describe('typing', async () => { diff --git a/packages/safe-ds-lang/tests/language/typing/type computer/streamSupertypes.test.ts b/packages/safe-ds-lang/tests/language/typing/type computer/streamSupertypes.test.ts index 53bce186a..8aab8e68c 100644 --- a/packages/safe-ds-lang/tests/language/typing/type computer/streamSupertypes.test.ts +++ b/packages/safe-ds-lang/tests/language/typing/type computer/streamSupertypes.test.ts @@ -1,12 +1,12 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../../src/language/index.js'; import { ClassType } from '../../../../src/language/typing/model.js'; import { isSdsAttribute } from '../../../../src/language/generated/ast.js'; import { getNodeOfType } from '../../../helpers/nodeFinder.js'; import { AssertionError } from 'assert'; +import { createSafeDsServices } from '../../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const typeComputer = services.types.TypeComputer; describe('streamProperSupertypes', async () => { diff --git a/packages/safe-ds-lang/tests/language/validation/creator.ts b/packages/safe-ds-lang/tests/language/validation/creator.ts index d78f6811d..16ef01022 100644 --- a/packages/safe-ds-lang/tests/language/validation/creator.ts +++ b/packages/safe-ds-lang/tests/language/validation/creator.ts @@ -10,7 +10,7 @@ import { createSafeDsServices } from '../../../src/language/index.js'; import { Range } from 'vscode-languageserver'; import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const rootResourceName = 'validation'; export const createValidationTests = (): Promise => { diff --git a/packages/safe-ds-lang/tests/language/validation/safe-ds-validator.test.ts b/packages/safe-ds-lang/tests/language/validation/safe-ds-validator.test.ts index 33c1980c1..9e8472744 100644 --- a/packages/safe-ds-lang/tests/language/validation/safe-ds-validator.test.ts +++ b/packages/safe-ds-lang/tests/language/validation/safe-ds-validator.test.ts @@ -3,12 +3,12 @@ import { NodeFileSystem } from 'langium/node'; import { isRangeEqual } from 'langium/test'; import { describe, it } from 'vitest'; import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { locationToString } from '../../../src/helpers/locations.js'; import { loadDocuments } from '../../helpers/testResources.js'; import { createValidationTests, ExpectedIssue } from './creator.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; describe('validation', async () => { diff --git a/packages/safe-ds-lang/tests/language/workspace/safe-ds-package-manager.test.ts b/packages/safe-ds-lang/tests/language/workspace/safe-ds-package-manager.test.ts index fa235a328..0200b35bf 100644 --- a/packages/safe-ds-lang/tests/language/workspace/safe-ds-package-manager.test.ts +++ b/packages/safe-ds-lang/tests/language/workspace/safe-ds-package-manager.test.ts @@ -3,7 +3,7 @@ import { clearDocuments, parseHelper } from 'langium/test'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { createSafeDsServices } from '../../../src/language/index.js'; -const services = createSafeDsServices(EmptyFileSystem).SafeDs; +const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs; const packageManager = services.workspace.PackageManager; const document1 = ` diff --git a/packages/safe-ds-lang/tests/language/workspace/safe-ds-workspace-manager.test.ts b/packages/safe-ds-lang/tests/language/workspace/safe-ds-workspace-manager.test.ts index 9ca4bfaf2..c66bd95f0 100644 --- a/packages/safe-ds-lang/tests/language/workspace/safe-ds-workspace-manager.test.ts +++ b/packages/safe-ds-lang/tests/language/workspace/safe-ds-workspace-manager.test.ts @@ -1,9 +1,9 @@ import { NodeFileSystem } from 'langium/node'; import { describe, expect, it } from 'vitest'; -import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js'; import { getLinkingErrors } from '../../helpers/diagnostics.js'; +import { createSafeDsServices } from '../../../src/language/index.js'; -const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs; +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; describe('SafeDsWorkspaceManager', () => { describe('loadAdditionalDocuments', () => { diff --git a/packages/safe-ds-vscode/src/extension/mainClient.ts b/packages/safe-ds-vscode/src/extension/mainClient.ts index 1b3e54d43..4fd5a0b5a 100644 --- a/packages/safe-ds-vscode/src/extension/mainClient.ts +++ b/packages/safe-ds-vscode/src/extension/mainClient.ts @@ -2,7 +2,7 @@ import * as path from 'node:path'; import * as vscode from 'vscode'; import type { LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node.js'; import { LanguageClient, TransportKind } from 'vscode-languageclient/node.js'; -import { ast, createSafeDsServicesWithBuiltins, messages, SafeDsServices } from '@safe-ds/lang'; +import { ast, createSafeDsServices, messages, SafeDsServices } from '@safe-ds/lang'; import { NodeFileSystem } from 'langium/node'; import { getSafeDSOutputChannel, initializeLog, logError, logOutput, printOutputMessage } from './output.js'; import crypto from 'crypto'; @@ -21,7 +21,7 @@ export const activate = async function (context: vscode.ExtensionContext) { initializeLog(); client = startLanguageClient(context); const runnerCommandSetting = vscode.workspace.getConfiguration('safe-ds.runner').get('command')!; // Default is set - services = (await createSafeDsServicesWithBuiltins(NodeFileSystem, { runnerCommand: runnerCommandSetting })).SafeDs; + services = (await createSafeDsServices(NodeFileSystem, { runnerCommand: runnerCommandSetting })).SafeDs; services.runtime.Runner.updateRunnerLogging({ displayError(value: string): void { vscode.window.showErrorMessage(value);