- {argDef.description}
+
+ {#if formattedRange}
+
Range
+
{formattedRange}
+ {/if}
+
+ {#if typeInfo}
+
Type
+
{typeInfo}
+ {/if}
+
+
Description
+
+ {argDef.description}
+
+
+
Value Type
+
+
+
+
diff --git a/src/utilities/codemirror/commandInfoMapper.ts b/src/utilities/codemirror/commandInfoMapper.ts
index 4ecfaf6347..b04269e0a4 100644
--- a/src/utilities/codemirror/commandInfoMapper.ts
+++ b/src/utilities/codemirror/commandInfoMapper.ts
@@ -1,4 +1,5 @@
import type { SyntaxNode, Tree } from '@lezer/common';
+import type { EnumMap, FswCommandArgument } from '@nasa-jpl/aerie-ampcs';
export interface CommandInfoMapper {
/** format string of multiple arguments */
@@ -16,6 +17,8 @@ export interface CommandInfoMapper {
/** ascends parse tree to find scope to display in form editor */
getContainingCommand(node: SyntaxNode | null): SyntaxNode | null;
+ getDefaultValueForArgumentDef(argDef: FswCommandArgument, enumMap: EnumMap): string;
+
/** finds the node in the parse tree containing the name */
getNameNode(stepNode: SyntaxNode | null): SyntaxNode | null;
diff --git a/src/utilities/codemirror/seq-n-tree-utils.ts b/src/utilities/codemirror/seq-n-tree-utils.ts
index 38d733d6c9..12045baa5a 100644
--- a/src/utilities/codemirror/seq-n-tree-utils.ts
+++ b/src/utilities/codemirror/seq-n-tree-utils.ts
@@ -1,4 +1,5 @@
import type { SyntaxNode, Tree } from '@lezer/common';
+import type { EnumMap, FswCommandArgument } from '@nasa-jpl/aerie-ampcs';
import {
RULE_ARGS,
RULE_COMMAND,
@@ -16,6 +17,7 @@ import {
TOKEN_REQUEST,
TOKEN_STRING,
} from '../../constants/seq-n-grammar-constants';
+import { fswCommandArgDefault } from '../sequence-editor/command-dictionary';
import { validateVariables } from '../sequence-editor/sequence-linter';
import { getFromAndTo, getNearestAncestorNodeOfType } from '../sequence-editor/tree-utils';
import type { CommandInfoMapper } from './commandInfoMapper';
@@ -86,6 +88,10 @@ export class SeqNCommandInfoMapper implements CommandInfoMapper {
return getAncestorStepOrRequest(node);
}
+ getDefaultValueForArgumentDef(argDef: FswCommandArgument, enumMap: EnumMap): string {
+ return fswCommandArgDefault(argDef, enumMap);
+ }
+
getNameNode(stepNode: SyntaxNode | null): SyntaxNode | null {
return getNameNode(stepNode);
}
diff --git a/src/utilities/codemirror/vml/vmlAdaptation.ts b/src/utilities/codemirror/vml/vmlAdaptation.ts
index 8436915b47..cce847c934 100644
--- a/src/utilities/codemirror/vml/vmlAdaptation.ts
+++ b/src/utilities/codemirror/vml/vmlAdaptation.ts
@@ -1,6 +1,6 @@
import { type CompletionContext, type CompletionResult } from '@codemirror/autocomplete';
import { syntaxTree } from '@codemirror/language';
-import type { CommandDictionary, FswCommand, FswCommandArgument } from '@nasa-jpl/aerie-ampcs';
+import type { CommandDictionary, EnumMap, FswCommand, FswCommandArgument } from '@nasa-jpl/aerie-ampcs';
import { getNearestAncestorNodeOfType } from '../../sequence-editor/tree-utils';
import { RULE_FUNCTION_NAME, RULE_ISSUE, RULE_STATEMENT, TOKEN_STRING_CONST } from './vmlConstants';
import { getArgumentPosition } from './vmlTreeUtils';
@@ -72,12 +72,12 @@ export function vmlAutoComplete(
function getStemAndDefaultArguments(commandDictionary: CommandDictionary, cmd: FswCommand): string {
if (cmd.arguments.length) {
- return `${cmd.stem} ${cmd.arguments.map(argNode => getDefaultArgumentValue(commandDictionary, argNode)).join(',')}`;
+ return `${cmd.stem} ${cmd.arguments.map(argNode => getDefaultArgumentValue(argNode, commandDictionary.enumMap)).join(',')}`;
}
return cmd.stem;
}
-function getDefaultArgumentValue(commandDictionary: CommandDictionary, argDef: FswCommandArgument): string {
+export function getDefaultArgumentValue(argDef: FswCommandArgument, enumMap: EnumMap): string {
switch (argDef.arg_type) {
case 'boolean':
return argDef.default_value ?? 'TRUE';
@@ -88,7 +88,7 @@ function getDefaultArgumentValue(commandDictionary: CommandDictionary, argDef: F
// ignores conversion setting
return (argDef.default_value ?? argDef.range?.min)?.toString(10) ?? '0';
case 'enum':
- return `"${commandDictionary.enumMap[argDef.enum_name]?.values[0]?.symbol ?? ''}"`;
+ return `"${enumMap[argDef.enum_name]?.values[0]?.symbol ?? ''}"`;
case 'var_string':
return '""';
}
diff --git a/src/utilities/codemirror/vml/vmlTreeUtils.ts b/src/utilities/codemirror/vml/vmlTreeUtils.ts
index 177c59a22c..72915573b2 100644
--- a/src/utilities/codemirror/vml/vmlTreeUtils.ts
+++ b/src/utilities/codemirror/vml/vmlTreeUtils.ts
@@ -1,4 +1,5 @@
import type { SyntaxNode, Tree } from '@lezer/common';
+import type { EnumMap, FswCommandArgument } from '@nasa-jpl/aerie-ampcs';
import {
filterNodesToArray,
getChildrenNode,
@@ -6,6 +7,7 @@ import {
isDefined,
} from '../../sequence-editor/tree-utils';
import type { CommandInfoMapper } from '../commandInfoMapper';
+import { getDefaultArgumentValue } from './vmlAdaptation';
import {
RULE_CALL_PARAMETER,
RULE_CALL_PARAMETERS,
@@ -65,6 +67,10 @@ export class VmlCommandInfoMapper implements CommandInfoMapper {
return getNearestAncestorNodeOfType(node, [RULE_TIME_TAGGED_STATEMENT]);
}
+ getDefaultValueForArgumentDef(argDef: FswCommandArgument, enumMap: EnumMap): string {
+ return getDefaultArgumentValue(argDef, enumMap);
+ }
+
getNameNode(statementNode: SyntaxNode | null): SyntaxNode | null {
const statementSubNode = statementNode?.getChild(RULE_STATEMENT)?.getChild(RULE_ISSUE);
if (statementSubNode?.name === RULE_ISSUE) {