Skip to content

Commit

Permalink
fix: import error when exploring tables in pipelines that call segments
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 22, 2024
1 parent 7206d62 commit 9ce890a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
7 changes: 6 additions & 1 deletion packages/safe-ds-lang/src/language/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ export { locationToString, positionToString, rangeToString } from '../helpers/lo
// Messages
export * as messages from './runtime/messages.js';

// Constants
// Commands
export * as commands from './communication/commands.js';

// RPC
export * as rpc from './communication/rpc.js';

// Generation
export { CODEGEN_PREFIX } from './generation/safe-ds-python-generator.js';

// Dependencies
export const dependencies = {
'safe-ds-runner': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,9 @@ describe('SafeDsRenameProvider', async () => {
}

// Add documents to workspace
const documents = descriptions.map((description) => {
const document = langiumDocumentFactory.fromString(description.originalContent, URI.parse(description.uri));
langiumDocuments.addDocument(document);
return document;
});
const documents = descriptions.map((description) =>
langiumDocuments.createDocument(URI.parse(description.uri), description.originalContent),
);
await documentBuilder.build(documents);

// Get the element to rename
Expand Down
17 changes: 11 additions & 6 deletions packages/safe-ds-vscode/src/extension/eda/apis/runnerApi.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { Base64Image, Column, Profiling, ProfilingDetailStatistical, Table } from '@safe-ds/eda/types/state.js';
import { ast, messages, SafeDsServices } from '@safe-ds/lang';
import { AstNode, LangiumDocument } from 'langium';
import { ast, CODEGEN_PREFIX, messages, SafeDsServices } from '@safe-ds/lang';
import { LangiumDocument } from 'langium';
import * as vscode from 'vscode';
import crypto from 'crypto';
import { getPipelineDocument } from '../../mainClient.ts';
import { CODEGEN_PREFIX } from '../../../../../safe-ds-lang/src/language/generation/safe-ds-python-generator.ts';
import { safeDsLogger } from '../../helpers/logging.js';

export class RunnerApi {
services: SafeDsServices;
pipelinePath: vscode.Uri;
pipelineName: string;
pipelineNode: ast.SdsPipeline;
baseDocument: LangiumDocument<AstNode> | undefined;
baseDocument: LangiumDocument | undefined;
placeholderCounter = 0;

constructor(
Expand Down Expand Up @@ -52,12 +51,18 @@ export class RunnerApi {
const afterPipelineEnd = documentText.substring(endOfPipeline - 1);
const newDocumentText = beforePipelineEnd + addedLines + afterPipelineEnd;

const newDoc = this.services.shared.workspace.LangiumDocumentFactory.fromString(
newDocumentText,
this.services.shared.workspace.LangiumDocuments.deleteDocument(this.pipelinePath);
const newDoc = this.services.shared.workspace.LangiumDocuments.createDocument(
this.pipelinePath,
newDocumentText,
);
await this.services.shared.workspace.DocumentBuilder.build([newDoc]);

await this.services.runtime.Runner.executePipeline(pipelineExecutionId, newDoc, this.pipelineName);

this.services.shared.workspace.LangiumDocuments.deleteDocument(this.pipelinePath);
this.services.shared.workspace.LangiumDocuments.addDocument(this.baseDocument);

const runtimeCallback = (message: messages.RuntimeProgressMessage) => {
if (message.id !== pipelineExecutionId) {
return;
Expand Down

0 comments on commit 9ce890a

Please sign in to comment.