mirror of
https://github.com/duhanbalci/dexpr.git
synced 2026-07-02 00:29:15 +00:00
0.3.0
This commit is contained in:
15
editor/dist/index.cjs
vendored
15
editor/dist/index.cjs
vendored
@@ -285,6 +285,15 @@ function inferMethodReturnType(method) {
|
||||
// depends on input type
|
||||
case "join":
|
||||
return "String";
|
||||
// List methods
|
||||
case "map":
|
||||
return null;
|
||||
// depends on field type (NumberList, StringList, or List)
|
||||
case "filter":
|
||||
return "List";
|
||||
case "find":
|
||||
return null;
|
||||
// returns single element
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -318,7 +327,7 @@ function dexprCompletion(info) {
|
||||
}
|
||||
const objectFieldCompletions = /* @__PURE__ */ new Map();
|
||||
for (const v of info.variables ?? []) {
|
||||
if (v.type === "Object" && v.fields) {
|
||||
if ((v.type === "Object" || v.type === "List") && v.fields) {
|
||||
const fieldItems = [];
|
||||
for (const f of v.fields) {
|
||||
configVarTypes.set(`${v.name}.${f.name}`, f.type);
|
||||
@@ -392,6 +401,10 @@ function dexprCompletion(info) {
|
||||
const fieldItems = objectFieldCompletions.get(rootVarName) ?? [];
|
||||
const objMethods = methodsByType["Object"] ?? [];
|
||||
options = [...fieldItems, ...objMethods];
|
||||
} else if (finalType === "List") {
|
||||
const rootVarName = path[0];
|
||||
const listMethods = methodsByType["List"] ?? [];
|
||||
options = [...listMethods];
|
||||
} else if (finalType) {
|
||||
options = methodsByType[finalType] ?? allMethods;
|
||||
} else {
|
||||
|
||||
2
editor/dist/index.d.cts
vendored
2
editor/dist/index.d.cts
vendored
@@ -2,7 +2,7 @@ import { Extension } from '@codemirror/state';
|
||||
import { Completion } from '@codemirror/autocomplete';
|
||||
import { LRLanguage, HighlightStyle } from '@codemirror/language';
|
||||
|
||||
type DexprType = "String" | "Number" | "Boolean" | "NumberList" | "StringList" | "Object";
|
||||
type DexprType = "String" | "Number" | "Boolean" | "NumberList" | "StringList" | "Object" | "List";
|
||||
interface FunctionInfo {
|
||||
name: string;
|
||||
signature: string;
|
||||
|
||||
2
editor/dist/index.d.ts
vendored
2
editor/dist/index.d.ts
vendored
@@ -2,7 +2,7 @@ import { Extension } from '@codemirror/state';
|
||||
import { Completion } from '@codemirror/autocomplete';
|
||||
import { LRLanguage, HighlightStyle } from '@codemirror/language';
|
||||
|
||||
type DexprType = "String" | "Number" | "Boolean" | "NumberList" | "StringList" | "Object";
|
||||
type DexprType = "String" | "Number" | "Boolean" | "NumberList" | "StringList" | "Object" | "List";
|
||||
interface FunctionInfo {
|
||||
name: string;
|
||||
signature: string;
|
||||
|
||||
15
editor/dist/index.js
vendored
15
editor/dist/index.js
vendored
@@ -258,6 +258,15 @@ function inferMethodReturnType(method) {
|
||||
// depends on input type
|
||||
case "join":
|
||||
return "String";
|
||||
// List methods
|
||||
case "map":
|
||||
return null;
|
||||
// depends on field type (NumberList, StringList, or List)
|
||||
case "filter":
|
||||
return "List";
|
||||
case "find":
|
||||
return null;
|
||||
// returns single element
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -291,7 +300,7 @@ function dexprCompletion(info) {
|
||||
}
|
||||
const objectFieldCompletions = /* @__PURE__ */ new Map();
|
||||
for (const v of info.variables ?? []) {
|
||||
if (v.type === "Object" && v.fields) {
|
||||
if ((v.type === "Object" || v.type === "List") && v.fields) {
|
||||
const fieldItems = [];
|
||||
for (const f of v.fields) {
|
||||
configVarTypes.set(`${v.name}.${f.name}`, f.type);
|
||||
@@ -365,6 +374,10 @@ function dexprCompletion(info) {
|
||||
const fieldItems = objectFieldCompletions.get(rootVarName) ?? [];
|
||||
const objMethods = methodsByType["Object"] ?? [];
|
||||
options = [...fieldItems, ...objMethods];
|
||||
} else if (finalType === "List") {
|
||||
const rootVarName = path[0];
|
||||
const listMethods = methodsByType["List"] ?? [];
|
||||
options = [...listMethods];
|
||||
} else if (finalType) {
|
||||
options = methodsByType[finalType] ?? allMethods;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user