diff --git a/libs/interpreter-lib/src/parsing-util.spec.ts b/libs/interpreter-lib/src/parsing-util.spec.ts index 58e7dcf68..cd5de83db 100644 --- a/libs/interpreter-lib/src/parsing-util.spec.ts +++ b/libs/interpreter-lib/src/parsing-util.spec.ts @@ -8,11 +8,10 @@ import { CachedLogger } from '@jvalue/jayvee-execution'; import { JayveeServices, createJayveeServices, - useExtension, + initializeWorkspace, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, parseHelper, readJvTestAssetHelper, @@ -39,7 +38,7 @@ describe('Validation of parsing-util', () => { '../test/assets/parsing-util/', ); - beforeAll(() => { + beforeAll(async () => { // Mock Process.exit exitSpy = jest .spyOn(process, 'exit') @@ -50,10 +49,16 @@ describe('Validation of parsing-util', () => { throw new Error(`process.exit: ${code}`); }); - // Register test extension - useExtension(new TestLangExtension()); // Create language services services = createJayveeServices(NodeFileSystem).Jayvee; + + await initializeWorkspace(services, [ + { + uri: process.cwd(), + name: 'TestBlockTypes.jv', + }, + ]); + // Parse function for Jayvee (without validation) parse = parseHelper(services); }); diff --git a/libs/interpreter-lib/src/validation-checks/runtime-parameter-literal.spec.ts b/libs/interpreter-lib/src/validation-checks/runtime-parameter-literal.spec.ts index 3475001a1..2e392e10f 100644 --- a/libs/interpreter-lib/src/validation-checks/runtime-parameter-literal.spec.ts +++ b/libs/interpreter-lib/src/validation-checks/runtime-parameter-literal.spec.ts @@ -9,11 +9,10 @@ import { RuntimeParameterProvider, ValidationContext, createJayveeServices, - useExtension, + initializeWorkspace, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, parseHelper, readJvTestAssetHelper, @@ -66,12 +65,18 @@ describe('Validation of validateRuntimeParameterLiteral', () => { ); } - beforeAll(() => { - // Register test extension - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + + await initializeWorkspace(services, [ + { + uri: process.cwd(), + name: 'TestBlockTypes.jv', + }, + ]); locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) parse = parseHelper(services); }); diff --git a/libs/interpreter-lib/test/assets/parsing-util/test-extension/TestBlockTypes.jv b/libs/interpreter-lib/test/assets/parsing-util/test-extension/TestBlockTypes.jv new file mode 100644 index 000000000..99437d387 --- /dev/null +++ b/libs/interpreter-lib/test/assets/parsing-util/test-extension/TestBlockTypes.jv @@ -0,0 +1,14 @@ +builtin blocktype TestFileExtractor { + input inPort oftype None; + output outPort oftype File; +} + +builtin blocktype TestFileLoader { + input inPort oftype File; + output outPort oftype None; +} + +builtin blocktype TestTableLoader { + input inPort oftype Table; + output outPort oftype None; +} diff --git a/libs/language-server/src/lib/builtin-library/jayvee-workspace-manager.ts b/libs/language-server/src/lib/builtin-library/jayvee-workspace-manager.ts index 88f43e3a3..5c93277c7 100644 --- a/libs/language-server/src/lib/builtin-library/jayvee-workspace-manager.ts +++ b/libs/language-server/src/lib/builtin-library/jayvee-workspace-manager.ts @@ -40,8 +40,8 @@ export class JayveeWorkspaceManager extends DefaultWorkspaceManager { */ export async function initializeWorkspace( services: LangiumServices, + workspaceFolders: WorkspaceFolder[] = [], ): Promise { - const workspaceFolders: WorkspaceFolder[] = []; await services.shared.workspace.WorkspaceManager.initializeWorkspace( workspaceFolders, );