Skip to content

Commit

Permalink
Merge branch 'custom-editor-language-server-extension' into custom-ed…
Browse files Browse the repository at this point in the history
…itor-vscode-client
  • Loading branch information
GideonKoenig committed Jan 21, 2025
2 parents 09e3f53 + a0cc4ec commit 5e730cd
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isSdsLiteral, SdsArgument } from '../../generated/ast.js';
import { CustomError } from '../global.js';
import { Call } from './call.js';
import { Placeholder } from './placeholder.js';
import { Expression, GenericExpression } from './expression.js';
import { Parameter } from './parameter.js';
import { Parser } from './parser.js';
import { CustomError } from '../types.js';

export class Argument {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
isSdsReference,
isSdsSegment,
} from '../../generated/ast.js';
import { CustomError } from '../global.js';
import { Argument } from './argument.js';
import { Edge, Port } from './edge.js';
import { GenericExpression } from './expression.js';
Expand All @@ -24,6 +23,7 @@ import { Placeholder } from './placeholder.js';
import { Result } from './result.js';
import { filterErrors } from './utils.js';
import { Parser } from './parser.js';
import { CustomError } from '../types.js';

export class Call {
private constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ILexingError, IRecognitionException } from 'chevrotain';
import { URI, AstNode, LangiumDocument, AstNodeLocator } from 'langium';
import { SafeDsLogger } from '../../communication/safe-ds-messaging-provider.js';
import { CustomError, Graph, Segment } from '../global.js';
import { SdsModule, isSdsPipeline, SdsStatement, isSdsSegment, SdsAnnotatedObject } from '../../generated/ast.js';
import { documentToJson, saveJson } from './tools/debug-utils.js';
import { Statement } from './statement.js';
import { SafeDsAnnotations } from '../../builtins/safe-ds-annotations.js';
import { SafeDsTypeComputer } from '../../typing/safe-ds-type-computer.js';
import { CustomError, Graph } from '../types.js';
import { Segment } from './segment.js';

export class Parser {
private lastId: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { SdsSegment, SdsStatement } from '../../generated/ast.js';
import { Call, CustomError, Edge, GenericExpression, Graph, Placeholder } from '../global.js';
import { CustomError, Graph } from '../types.js';
import { Call } from './call.js';
import { Edge } from './edge.js';
import { GenericExpression } from './expression.js';
import { Parameter } from './parameter.js';
import { Parser } from './parser.js';
import { Placeholder } from './placeholder.js';
import { Result } from './result.js';
import { Statement } from './statement.js';
import { filterErrors } from './utils.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
isSdsWildcard,
isSdsYield,
} from '../../generated/ast.js';
import { CustomError } from '../global.js';
import { Call } from './call.js';
import { Edge, Port } from './edge.js';
import { Expression, GenericExpression } from './expression.js';
Expand All @@ -17,6 +16,7 @@ import { Result } from './result.js';
import { SegmentGroupId } from './segment.js';
import { zip } from './utils.js';
import { Parser } from './parser.js';
import { CustomError } from '../types.js';

export class Statement {
public static parse(node: SdsStatement, parser: Parser) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomError } from '../global.js';
import { CustomError } from '../types.js';

export const zip = <A, B>(arrayA: A[], arrayB: B[]): [A, B][] => {
const minLength = Math.min(arrayA.length, arrayB.length);
Expand Down
40 changes: 2 additions & 38 deletions packages/safe-ds-lang/src/language/graphical-editor/global.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Call } from './ast-parser/call.js';
import { GenericExpression } from './ast-parser/expression.js';
import { Edge } from './ast-parser/edge.js';
import { Placeholder } from './ast-parser/placeholder.js';
import { Segment } from './ast-parser/segment.js';
import { Graph, CustomError } from './types.js';

export { SegmentGroupId } from './ast-parser/segment.js';
export { Segment } from './ast-parser/segment.js';
Expand All @@ -12,43 +9,10 @@ export { GenericExpression } from './ast-parser/expression.js';
export { Edge } from './ast-parser/edge.js';
export { Parameter } from './ast-parser/parameter.js';
export { Result } from './ast-parser/result.js';
export { Graph, Buildin, CustomError } from './types.js';

export interface Collection {
pipeline: Graph;
segmentList: Segment[];
errorList: CustomError[];
}

export class Graph {
constructor(
public readonly type: 'segment' | 'pipeline',
public readonly placeholderList: Placeholder[] = [],
public readonly callList: Call[] = [],
public readonly genericExpressionList: GenericExpression[] = [],
public readonly edgeList: Edge[] = [],
public uniquePath: string = '',
public name: string = '',
) {}
}

export class Buildin {
constructor(
public readonly name: string,
public readonly parent: string | undefined,
public readonly category:
| 'DataImport'
| 'DataExport'
| 'DataProcessing'
| 'DataExploration'
| 'Modeling'
| 'ModelEvaluation'
| (string & Record<never, never>),
) {}
}

export class CustomError {
constructor(
public readonly action: 'block' | 'notify',
public readonly message: string,
) {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SafeDsLogger, SafeDsMessagingProvider } from '../communication/safe-ds-messaging-provider.js';
import { SafeDsServices } from '../safe-ds-module.js';
import { type SafeDsServices } from '../safe-ds-module.js';
import { Uri } from 'vscode';
import { extname } from 'path';
import {
Expand All @@ -23,7 +23,7 @@ import {
isSdsSegment,
} from '../generated/ast.js';
import { Connection, DidSaveTextDocumentParams } from 'vscode-languageserver';
import { Buildin, Collection } from './global.js';
import { Collection } from './global.js';
import {
GraphicalEditorCloseSyncChannelRequest,
GraphicalEditorGetBuildinsRequest,
Expand All @@ -36,6 +36,7 @@ import { isPrivate } from '../helpers/nodeProperties.js';
import { SafeDsAnnotations } from '../builtins/safe-ds-annotations.js';
import { Parser } from './ast-parser/parser.js';
import { SafeDsTypeComputer } from '../typing/safe-ds-type-computer.js';
import { Buildin } from './types.js';

export class SafeDsGraphicalEditorProvider {
private readonly logger: SafeDsLogger;
Expand Down
38 changes: 38 additions & 0 deletions packages/safe-ds-lang/src/language/graphical-editor/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Call } from './ast-parser/call.js';
import { Edge } from './ast-parser/edge.js';
import { GenericExpression } from './ast-parser/expression.js';
import { Placeholder } from './ast-parser/placeholder.js';

export class Graph {
constructor(
public readonly type: 'segment' | 'pipeline',
public readonly placeholderList: Placeholder[] = [],
public readonly callList: Call[] = [],
public readonly genericExpressionList: GenericExpression[] = [],
public readonly edgeList: Edge[] = [],
public uniquePath: string = '',
public name: string = '',
) {}
}

export class Buildin {
constructor(
public readonly name: string,
public readonly parent: string | undefined,
public readonly category:
| 'DataImport'
| 'DataExport'
| 'DataProcessing'
| 'DataExploration'
| 'Modeling'
| 'ModelEvaluation'
| (string & Record<never, never>),
) {}
}

export class CustomError {
constructor(
public readonly action: 'block' | 'notify',
public readonly message: string,
) {}
}

0 comments on commit 5e730cd

Please sign in to comment.