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

Programming exercises: Refactor online editor to use native ACE file sessions #7393

Closed
b-fein opened this issue Oct 16, 2023 · 2 comments
Closed

Comments

@b-fein
Copy link
Contributor

b-fein commented Oct 16, 2023

Is your feature request related to a problem?

When switching files in the online editor the editor remains on the position scrolled to in the previous file (e.g. file A line 0, switch to file B, scroll to line 70, switch back to file A; now that has scrolled as well).

The current implementation uses a custom file session to implement multiple sessions on top of the editor:

export type FileSession = { [fileName: string]: { code: string; cursor: { column: number; row: number }; loadingError: boolean } };

With this only the file content and the cursor position is saved and later manually restored when switching files by overwriting the current content of the session.

This also leads to somewhat fragile behaviour of the inline annotations (e.g., bug #7033).

Describe the solution you'd like

Use the native file sessions provided by the ACE library (https://ace.c9.io/#nav=howto section ‘One Editor, Multiple Sessions’) to handle the sessions.

Open questions

  • The editor probably keeps some additional references in memory besides the code to enable saving the cursor position, scrolling position, … This might have a performance impact when opening many files.
  • How are annotations handled in the sessions? What happens in case of many inline feedback annotations in multiple files? Are they unloaded properly on file change, or does this result in problems when combined with the Angular change detection?
@krusche
Copy link
Member

krusche commented Oct 21, 2023

Another alternative might be to change the online editor to monaco or code-mirror. Both have several advantages:

  • More features
  • Active development
  • Modern architectures
  • More customization options

I think @daniels98it has already integrated monaco in #6706 for a different use case, but we could decide to completely switch to it.

However, this would be a rather large refactoring and would require some effort.

@b-fein
Copy link
Contributor Author

b-fein commented Aug 25, 2024

Superseded by #8402 since the editor has been replaced with Monaco since.

@b-fein b-fein closed this as completed Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants