Skip to content
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

Sequence Editor Auto-indent, Ground support #1425

Merged
merged 5 commits into from
Aug 19, 2024

Conversation

goetzrrGit
Copy link
Contributor

@goetzrrGit goetzrrGit commented Aug 14, 2024

Closes #1409

Custom Folding:

Adds custom folding capabilities for commonly used code blocks (ground_block, ground_event, request, load, activate, metadata, models).
Enables nested folding for better code organization and readability.

Autocomplete:

Extends autocomplete functionality to include request, activate, load, ground_event, and ground_blocks.
Fixes minor bugs related to incorrect autocomplete suggestions.

Auto-Indent:

Implements basic auto-indent functionality for improved code formatting.
Future improvements may include support for conditionals and loops.
NOTE: We should expose this feature to the adaptation layer.

You can take this below sequence and play around with the folding

@ID ""

@METADATA "Key1" "Value"
@METADATA "Key2" "Value"
@METADATA "Key3" "Value"
@METADATA "Key4" "Value"
@METADATA "Key5" "Value"
@METADATA "Key6" "Value"

C @ACTIVATE("activate.name") 1 2 "3" # description
@ENGINE 1
@EPOCH ""
@MODEL "Variable" 0 "Offset"
@MODEL "Variable" 0 "Offset"

C @LOAD("load.name") 1 2 [21 22]
@EPOCH ""

C @GROUND_BLOCK("ground_block.name")
@MODEL "Variable" 0 "Offset"
@MODEL "Variable" 0 "Offset"

C @GROUND_EVENT("ground_block.name") 1 2
@METADATA "Key" "Value"
@MODEL "Variable" 0 "Offset"
@MODEL "Variable" 0 "Offset"

@GROUND_EPOCH("Name", "+0.00") @REQUEST_BEGIN("request.name")
  C SEQ_ECHO ""
  @METADATA "Key" "Value"
  @METADATA "Key1" "Value"
  @METADATA "Key2" "Value"
  @METADATA "Key3" "Value"
  
  C @GROUND_BLOCK("ground_block.name")
  
  C @LOAD("load.name")
  @ENGINE 1
  @MODEL "Variable" 0 "Offset"
  @MODEL "Variable" 0 "Offset"
  @MODEL "Variable" 0 "Offset"
@REQUEST_END
@METADATA "Key1" "Value"
@METADATA "Key2" "Value"
@METADATA "Key3" "Value"
@METADATA "Key4" "Value"
@METADATA "Key5" "Value"


@goetzrrGit goetzrrGit added feature New feature or request sequencing Anything related to the sequencing domain labels Aug 14, 2024
@goetzrrGit goetzrrGit requested a review from a team as a code owner August 14, 2024 18:23
Copy link
Collaborator

@duranb duranb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I just type "R", I'm only seeing "relative" as a suggestion. Once I type "RE", then I see the request suggestion. Is that intentional?

@goetzrrGit
Copy link
Contributor Author

Yep, the user will almost always need to start a line with a time tag (C, R, E, A) so it should be showing up as the first thing when you type.

Copy link
Collaborator

@duranb duranb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /utilities/codemirror/custom-folder.ts file is getting a little more complicated. Would it be possible to start adding some unit tests for this?

@goetzrrGit goetzrrGit force-pushed the feature/improved-code-formatting branch from 3aaffdc to 32fa2ff Compare August 15, 2024 17:51
@goetzrrGit
Copy link
Contributor Author

Unit test will be kinda hard as it is returning a fold range which will be hard to calculate on a treenode.

@duranb
Copy link
Collaborator

duranb commented Aug 15, 2024

I see. There's no way to manually create the tree given some test input code the way it's done in the editor?

Added custom folding for ground_block, ground_event, request, load, activate, metadata, models

You can now nest folding to collapse huge blocks of code
* Can now auto-complete request, activate, load, ground_event, and ground_blocks,
* Improve some minor bugs with autocomplete giving wrong suggestions when the user is typing a comment
We can expand on this for conditional and loops in the future.

We also need to probably expose this to the adaptation so missions can override this behavior.
@goetzrrGit goetzrrGit force-pushed the feature/improved-code-formatting branch from 7201da5 to 3c965bd Compare August 16, 2024 20:11
@goetzrrGit goetzrrGit force-pushed the feature/improved-code-formatting branch from 3c965bd to 78f3951 Compare August 16, 2024 20:55
Copy link
Collaborator

@duranb duranb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thank you!

src/utilities/codemirror/custom-folder.ts Outdated Show resolved Hide resolved
src/utilities/sequence-editor/sequence-completion.ts Outdated Show resolved Hide resolved
@goetzrrGit goetzrrGit force-pushed the feature/improved-code-formatting branch from 372d630 to 2b0313c Compare August 19, 2024 15:48
@goetzrrGit goetzrrGit force-pushed the feature/improved-code-formatting branch from 2b0313c to fbb48c8 Compare August 19, 2024 15:49
@goetzrrGit
Copy link
Contributor Author

goetzrrGit commented Aug 19, 2024

@duranb @cohansen Let me know if the PR is good to merge now. I took @cohansen suggestions am using the foldSteps method for Activte, Load, Commands, GroundBlock, and GroundEvent and removed foldCommand, foldLoadandActivate, and foldGround with this commit: fbb48c8

@cohansen
Copy link
Contributor

@duranb @cohansen Let me know if the PR is good to merge now. I took @cohansen suggestions am using the foldSteps method for Activte, Load, Commands, GroundBlock, and GroundEvent and removed foldCommand, foldLoadandActivate, and foldGround with this commit: fbb48c8

LGTM, thanks @goetzrrGit .

@duranb
Copy link
Collaborator

duranb commented Aug 19, 2024

@duranb @cohansen Let me know if the PR is good to merge now. I took @cohansen suggestions am using the foldSteps method for Activte, Load, Commands, GroundBlock, and GroundEvent and removed foldCommand, foldLoadandActivate, and foldGround with this commit: fbb48c8

LGTM, thanks @goetzrrGit .

Great catch! Merge away!

@goetzrrGit goetzrrGit merged commit 9526bea into develop Aug 19, 2024
5 checks passed
@goetzrrGit goetzrrGit deleted the feature/improved-code-formatting branch August 19, 2024 16:34
JosephVolosin pushed a commit that referenced this pull request Oct 21, 2024
* Added custom folding

Added custom folding for ground_block, ground_event, request, load, activate, metadata, models

You can now nest folding to collapse huge blocks of code

* Update auto-complete

* Can now auto-complete request, activate, load, ground_event, and ground_blocks,
* Improve some minor bugs with autocomplete giving wrong suggestions when the user is typing a comment

* Add auto-indent capabilities to the editor.

We can expand on this for conditional and loops in the future.

We also need to probably expose this to the adaptation so missions can override this behavior.

* add unit test for custom folding

* Update Custom Folding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sequencing Anything related to the sequencing domain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Phoenix: Add indenting and folding for requests
3 participants