Skip to content

Commit fe475d4

Browse files
committed
Updated to address Ryan PR comments.
1 parent 0488de3 commit fe475d4

File tree

11 files changed

+22
-53
lines changed

11 files changed

+22
-53
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nasa-jpl/aerie-sequence-languages",
3-
"version": "0.1.0-alpha.6",
3+
"version": "0.1.0-alpha.7",
44
"description": "Consolidated parsing for languages with first-party support in Aerie sequencing",
55
"type": "module",
66
"author": "NASA/JPL",

src/languages/satf/grammar/satf-sasf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { PhoenixResources } from 'interfaces/phoenix.js';
55

66
export const SatfSasfParser = parser;
77

8-
export function getSatfLanguage(resources: PhoenixResources) {
8+
export function getSatfLRLanguage(resources: PhoenixResources) {
99
return resources.LRLanguage.define({
1010
languageData: {
1111
commentTokens: { line: '#' },

src/languages/seq-n/seq-n-completion.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SEQN_NODES } from './seqn-grammar-constants.js';
55
import { fswCommandArgDefault } from '../../utils/sequence-utils.js';
66
import { getDefaultVariableArgs } from '../../utils/sequence-utils.js';
77
import { getFromAndTo, getNearestAncestorNodeOfType } from '../../utils/tree-utils.js';
8-
import { getDoyTime } from '../../utils/time.js';
8+
import { isoFromJSDate } from '@nasa-jpl/aerie-time-utils';
99
import type { PhoenixContext } from '../../interfaces/phoenix.js';
1010
import type { GlobalVariable } from '../../types/global-types.js';
1111
import { seqnParser } from './seq-n.js';
@@ -161,7 +161,7 @@ export function seqnCompletion(
161161
date.setMilliseconds(0);
162162
timeTagCompletions.push(
163163
{
164-
apply: `A${getDoyTime(date)} `,
164+
apply: `A${isoFromJSDate(date)} `,
165165
info: 'Execute command at an absolute time',
166166
label: `A (absolute)`,
167167
section: 'Time Tags',
@@ -245,9 +245,7 @@ export function seqnCompletion(
245245
// If TimeTag has not been entered by the user wait for 2 characters before showing the command completions list
246246
// If TimeTag has been entered show the completion list when 1 character has been entered
247247
if (word.text.length > (cursor.isAfterTimeTag || cursor.isBeforeImmedOrHDWCommands === false ? 0 : 1)) {
248-
fswCommandsCompletions.push(
249-
...generateCommandCompletions(cursor, phoenixContext, mapper),
250-
);
248+
fswCommandsCompletions.push(...generateCommandCompletions(cursor, phoenixContext, mapper));
251249

252250
//add load, activate, ground_block, and ground_event commands
253251
fswCommandsCompletions.push(...generateStepCompletion(cursor));

src/languages/seq-n/seq-n-linter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
isHexValue,
2424
parseNumericArg,
2525
} from '../../utils/sequence-utils.js';
26-
import { quoteEscape } from '../../utils/string.js';
27-
import { pluralize } from '../../utils/text.js';
28-
import { getDoyTime } from '../../utils/time.js';
26+
import { pluralize, quoteEscape } from '../../utils/string.js';
27+
28+
import { isoFromJSDate } from '@nasa-jpl/aerie-time-utils';
2929
import { getChildrenNode, getDeepestNode, getFromAndTo } from '../../utils/tree-utils.js';
3030
import { closeSuggestion, computeBlocks, openSuggestion } from './custom-folder.js';
3131
import { TOKEN_ERROR } from './seq-n-constants.js';
@@ -773,7 +773,7 @@ function validateTimeTags(command: SyntaxNode, text: string): Diagnostic[] {
773773
diagnostics.push({
774774
actions: [],
775775
from: timeTagAbsoluteNode.from,
776-
message: ERROR_MESSAGES.UNBALANCED_TIME + getDoyTime(new Date(convertIsoToUnixEpoch(absoluteText))),
776+
message: ERROR_MESSAGES.UNBALANCED_TIME + isoFromJSDate(new Date(convertIsoToUnixEpoch(absoluteText))),
777777
severity: 'warning',
778778
to: timeTagAbsoluteNode.to,
779779
});

src/utils/string.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isQuoted, quoteEscape, removeEscapedQuotes, unquoteUnescape } from './string.js';
1+
import { isQuoted, pluralize, quoteEscape, removeEscapedQuotes, unquoteUnescape } from './string.js';
22
import { describe, expect, it } from 'vitest';
33

44
describe(`'Escaped quotes' from input`, () => {
@@ -81,4 +81,10 @@ describe('quoteEscape', () => {
8181
expect(unquoteUnescape('hello"')).toBe('hello"');
8282
});
8383
});
84+
85+
it('pluralize', () => {
86+
expect(pluralize(0)).toBe('s');
87+
expect(pluralize(1)).toBe('');
88+
expect(pluralize(10)).toBe('s');
89+
});
8490
});

src/utils/string.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export function removeQuote(s: string) {
2020
return s;
2121
}
2222

23+
export function pluralize(count: number): string {
24+
return count === 1 ? '' : 's';
25+
}
26+
2327
export function removeEscapedQuotes(text: string): string;
2428
export function removeEscapedQuotes(text: number): number;
2529
export function removeEscapedQuotes(text: boolean): boolean;

src/utils/text.test.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/utils/text.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/utils/time.test.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)