Skip to content

Multi workspace setup#32

Open
JeroenReumkens wants to merge 12 commits intoesm-dev:mainfrom
frontendfyi:feat/multi-workspace
Open

Multi workspace setup#32
JeroenReumkens wants to merge 12 commits intoesm-dev:mainfrom
frontendfyi:feat/multi-workspace

Conversation

@JeroenReumkens
Copy link

I believe this PR solves #23, adding support for multiple workspaces on a single page.

As per the comments in that issue I went ahead and added the functionality to either pass workspace or workspaces to the init functions. When initialising Monaco, it then takes the workspace attribute into account to connect to the proper workspace.

I'm definitely not used to any Monaco related code, so many things were new for me. So just let me know if there's any weird implementations and I try to improve it.

I've temporarily published this to NPM (give it a slightly different name to not pop up in npm search ;) ) as well, as I'm working hard on getting this merged asap as I'd love to use Modern Monaco in my platform. So far I didn't encounter any additional issues with this setup.

Please let me know your thoughts, and don't hesitate to tell me if some things aren't the way you'd like to solve them.

import { cache } from "../cache.js";

let monaco: typeof Monaco;
const monacoAPI = {
Copy link
Author

Choose a reason for hiding this comment

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

Had to move the monaco variable to MonacoEnvironment so we can the same instance across all workers. That unfortunately meant I had to replace quite a few monaco. instances.

Copy link
Member

Choose a reason for hiding this comment

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

nice!

};

/** init the monaco namespace. */
export function init(monacoNS: typeof Monaco): void {
Copy link
Author

Choose a reason for hiding this comment

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

No need for this init function anymore, as we now set the monaco instance on the MonacoEnvironment (in core.ts)

};

/** Multi-workspace file system router */
export class MultiWorkspaceFileSystem {
Copy link
Author

Choose a reason for hiding this comment

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

This class serves as a proxy to each individual workspace

Copy link
Member

Choose a reason for hiding this comment

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

love this idea!

@ije
Copy link
Member

ije commented Sep 26, 2025

wow! This is so good 👍

@ije
Copy link
Member

ije commented Sep 26, 2025

@JeroenReumkens please ensure that the getFileSystemProvider method in worker-base.ts works properly. The FileSystemProvider for language services gives the cap of import completion:

  • html href and src completion
  • js/ts import completion
  • css @import completion
Screenshot 2025-09-26 at 21 07 09

this 👇

Screenshot 2025-09-26 at 21 12 41

This was referenced Sep 26, 2025
@JeroenReumkens
Copy link
Author

Amazing. Thanks for your comment @ije. I will fix it asap (probably next week though, I'm traveling a lot for a conference this week).

Feel free to work in my branch too if you feel like it. Otherwise I'll check back in asap.

@ije
Copy link
Member

ije commented Oct 3, 2025

no worries @JeroenReumkens, i will fix it! you have did a great job! thanks you a lot!

@jadedevin13
Copy link

any updates on this? @ije i can help but i'm not sure how.

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.

3 participants