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

feat: allow specifying editor restoration #243

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

CompuIves
Copy link
Collaborator

This allows us to configure whether the editor should restore its view state from the last load, by reading from the StorageService.

@CGNonofr CGNonofr self-requested a review November 14, 2023 18:17
Copy link
Contributor

@CGNonofr CGNonofr left a comment

Choose a reason for hiding this comment

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

Looks good

@CGNonofr CGNonofr merged commit f079eb2 into CodinGame:main Nov 14, 2023
1 check passed
@CGNonofr
Copy link
Contributor

CGNonofr commented Nov 14, 2023

Why am I not able to test it in the demo? it seems to do nothing with the BrowserStorageService. I was able to have something mocking the storage service though, but it only keep the editor grid and not the open editors

@CompuIves
Copy link
Collaborator Author

In the demo, I believe we generate a new id for every time we refresh. Because of this, it uses a new IndexedDB entry for every time we reload (this code).

To work around this, I pass the full workspace identifier to the configuration service:

  const workspaceIdentifier = {
    uri: monaco.Uri.from({
      scheme: "file",
      path: latestMonacoConfig.pitcher.workspacePath,
    }),
    id: latestMonacoConfig.pitcher.instanceId,
  };

  ...

  ...getConfigurationServiceOverride(workspaceIdentifier),

And I also created a new BrowserStorageService that does not dynamically generate its workspace but use the same thing:

export class InjectedBrowserStorageService extends BrowserStorageService {
  constructor(
    workspaceIdentifier: IAnyWorkspaceIdentifier,
    @IUserDataProfileService userDataProfileService: IUserDataProfileService,
    @ILogService logService: ILogService
  ) {
    super(workspaceIdentifier, userDataProfileService, logService);
  }
}

...

{
    [IStorageService.toString()]: new SyncDescriptor(
      InjectedBrowserStorageService,
      [workspaceIdentifier],
      true
    ),
}

@CompuIves
Copy link
Collaborator Author

Oh... Actually I missed something. We filter out registerEditorSerializer contributions, so the editors are not serialized. Let me try again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants