-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vml Library Support #1602
base: develop
Are you sure you want to change the base?
Vml Library Support #1602
Conversation
04fbbe2
to
1acdc23
Compare
6bded13
to
553ee27
Compare
0f3fcfe
to
2be0db9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will approve this as I’ll be out tomorrow. If you’d like to merge, please feel free to do so.
We’ve already discussed some issues:
Autocomplete doesn’t pop up with Control+Space; please verify with Bryan (non-blocking).
SeqN’s Selected command panel needs full hookups for library sequences like VML (see [GitHub issue #1550]). (non-blocking)
No big issues that I ran into.
if (statementNode) { | ||
const vmManagementNode = statementNode.getChild(RULE_VM_MANAGEMENT); | ||
if (vmManagementNode) { | ||
const spawnNode = vmManagementNode.getChild(RULE_SPAWN); | ||
if (spawnNode) { | ||
return spawnNode.getChild(RULE_CALL_PARAMETERS); | ||
} | ||
} | ||
|
||
// ISSUE and ISSUE_DYNAMIC | ||
return statementNode.firstChild?.getChild(RULE_CALL_PARAMETERS) ?? null; | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: Always found that make conditionals top level and removing nesting more readability.
if (!statementNode) {
return null;
}
const vmManagementNode = statementNode.getChild(RULE_VM_MANAGEMENT);
if (!vmManagementNode) {
return statementNode.firstChild?.getChild(RULE_CALL_PARAMETERS) ?? null;
}
const spawnNode = vmManagementNode.getChild(RULE_SPAWN);
if (!spawnNode) {
return null;
}
return spawnNode.getChild(RULE_CALL_PARAMETERS);
workspace_id: sequence.workspace_id, | ||
}; | ||
}); | ||
if (isInVmlMode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pull this logic out into a util function so we can add some unit tests to it?
name: sequence.name, | ||
parameters: parseVariables(tree.topNode, sequence.definition, 'ParameterDeclaration') ?? [], | ||
tree, | ||
type: 'librarySequence', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make librarySequence
an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, or remove it depending on your take on #1602 (comment)
} | ||
} | ||
</script> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be wrapped in a <div></div>
so that it doesn't affect the parent component's hierarchy in an unexpected way?
@@ -155,9 +155,16 @@ export type LibrarySequence = { | |||
name: string; | |||
parameters: VariableDeclaration[]; | |||
tree: Tree; | |||
type: 'librarySequence'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other type strings that this can be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I added it to keep the associated type guard trivial and match the pattern we're using with FswCommand.
Do you have a preference on avoiding explicit typing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh I see it now. I don't necessarily have an issue with the explicit typing, but it's not intuitive as to what the purpose was. There's nothing relating the LibrarySequence
type to a FswCommand
type unless you have enough context of how it's being used and that might cause some issues in the future if we have to change the Command
types. I think ideally, these types can extend from a common interface. If that's too out of this scope, then I think making the type
an enum that's shared with all the command types would suffice for now.
const cursorLine = context.state.doc.lineAt(selection.ranges[0].to); | ||
const cursorLineTrimmed = cursorLine.text.trim(); | ||
|
||
if (!cursorLineTrimmed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to compare cursorLineTrimmed
explicitly with an ""
to make it more apparent what the comment on the following line means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in b848d63
case 'UINT': | ||
case 'FLOAT': | ||
return { | ||
arg_type: { FLOAT: 'float', INT: 'integer', UINT: 'unsigned' }[variable.type] as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little forced. I think I'd be okay with this being a little repetitive for the sake of being more clear if each number case returned almost the same object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 284aa51
function validateArguments( | ||
commandDictionary: CommandDictionary, | ||
commandDef: FswCommand, | ||
functionNode: SyntaxNode, | ||
functionNameNode: SyntaxNode, | ||
docText: string, | ||
// issue_dynamic puts the stem into the first argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind fleshing this comment out a little bit more to be clearer to someone who's not too familiar with VML?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in fa3ed42
above: true, | ||
create() { | ||
const dom = document.createElement('div'); | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is something generating an error here for a try/catch to be necessary? It's not immediately clear as to what that would be. StringTooltip.svelte
isn't throwing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to satisfy SonarQube, I'll look for another way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh weird. It's not flagging the other tooltips though, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe they haven't been scanned yet since they are unchanged in the PR
|
resolves #1610
Juno Command Dictionary
Adaptation