aglinxinyuan commented on code in PR #4997:
URL: https://github.com/apache/texera/pull/4997#discussion_r3264001613
##########
frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts:
##########
@@ -31,10 +31,10 @@ import { OperatorSchema } from
"../../types/operator-schema.interface";
import { of } from "rxjs";
// Operator types that the constructor's language-detection branch must map
-// to a specific language. `RUDFSource` / `RUDF` -> `r`; the three V2 Python
-// types -> `python`; everything else -> `java`. Local to this spec so we
-// don't perturb the shared mock-workflow-data fixtures.
-const R_OPERATOR_TYPES = ["RUDFSource", "RUDF"];
+// to a specific language. The three V2 Python types -> `python`; everything
+// else (including the legacy `RUDF*` types) -> `java`, since R UDF editor
+// support was retired in this branch. Local to this spec so we don't
Review Comment:
Reverted in f6536d790d — R UDF editor support is back. Added an
`R_OPERATOR_TYPES` set alongside the Python one and a new `else if` branch in
the constructor that maps `RUDFSource` / `RUDF` to `language = "r"`, plus `.r`
through the two file-suffix call sites. The R operator types are kept on the
frontend even though Texera proper no longer bundles the backend — when the
non-apache R UDF plugin is installed, the editor opens those operators in R
mode.
##########
frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts:
##########
@@ -52,7 +52,6 @@ const synthesizeSchema = (operatorType: string):
OperatorSchema => ({ ...baseSch
const augmentedSchemas: OperatorSchema[] = [
...mockOperatorMetaData.operators,
...PYTHON_OPERATOR_TYPES.map(synthesizeSchema),
- ...R_OPERATOR_TYPES.map(synthesizeSchema),
Review Comment:
Same fix in f6536d790d — `R_OPERATOR_TYPES = ["RUDFSource", "RUDF"]` is now
back in the spec setup and the synthetic-schema augmentation includes both R
operator types so `addOperator` accepts them.
##########
frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts:
##########
@@ -117,19 +116,11 @@ describe("CodeEditorComponent", () => {
expect(fixture.componentInstance.currentOperatorId).toBe(mockJavaUDFPredicate.operatorID);
});
- // Language detection — the constructor maps `RUDFSource` / `RUDF` to `r`,
- // the three V2-era Python operator types to `python`, and anything else
- // to `java`. The exact branch lives in the constructor; the public
- // `language` field is what the rest of the editor (LSP wiring, file-
- // suffix selection) keys off.
-
- R_OPERATOR_TYPES.forEach((operatorType, index) => {
- it(`picks language="r" for operatorType=${operatorType}`, () => {
- const fixture = makeFixture(buildPredicate(`r-${index}`, operatorType));
- expect(fixture.componentInstance.language).toBe("r");
- expect(fixture.componentInstance.languageTitle).toBe("R UDF");
- });
- });
Review Comment:
Same fix in f6536d790d — added an `R_OPERATOR_TYPES.forEach(...)` test block
that pins `language === "r"` and `languageTitle === "R UDF"` for each R
operator type, parallel to the Python loop.
##########
frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.ts:
##########
@@ -143,18 +145,8 @@ export class CodeEditorComponent implements AfterViewInit,
SafeStyle, OnDestroy
) {
this.currentOperatorId =
this.workflowActionService.getJointGraphWrapper().getCurrentHighlightedOperatorIDs()[0];
const operatorType =
this.workflowActionService.getTexeraGraph().getOperator(this.currentOperatorId).operatorType;
-
- if (operatorType === "RUDFSource" || operatorType === "RUDF") {
- this.setLanguage("r");
- } else if (
- operatorType === "PythonUDFV2" ||
- operatorType === "PythonUDFSourceV2" ||
- operatorType === "DualInputPortsPythonUDFV2"
- ) {
- this.setLanguage("python");
- } else {
- this.setLanguage("java");
- }
+ this.language =
CodeEditorComponent.PYTHON_OPERATOR_TYPES.has(operatorType) ? "python" : "java";
+ this.languageTitle =
`${this.language[0].toUpperCase()}${this.language.slice(1)} UDF`;
Review Comment:
Fixed in f6536d790d — the constructor now does:
```ts
if (CodeEditorComponent.PYTHON_OPERATOR_TYPES.has(operatorType)) {
this.language = "python";
} else if (CodeEditorComponent.R_OPERATOR_TYPES.has(operatorType)) {
this.language = "r";
} else {
this.language = "java";
}
```
so `RUDFSource` / `RUDF` route to `r` like before. No
`@codingame/monaco-vscode-r-default-extension` is loaded (upstream stopped
publishing a v25-compatible build) — the editor opens in R mode without
TextMate syntax colours but the model URI carries the `.r` suffix so any future
language-client config keys off it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]