diff --git a/packages/code-service/src/code-service.contribution.ts b/packages/code-service/src/code-service.contribution.ts index f291bebd..90b61167 100644 --- a/packages/code-service/src/code-service.contribution.ts +++ b/packages/code-service/src/code-service.contribution.ts @@ -4,6 +4,7 @@ import { CODE_ROOT, IDB_ROOT, IServerApp, + isPathMounted, LaunchContribution, RootFS, RuntimeConfig, @@ -221,6 +222,10 @@ export class CodeContribution this._unmount?.(); + if (isPathMounted(rootFS, workspaceDir)) { + rootFS.umount(workspaceDir); + } + rootFS.mount(workspaceDir, overlayFileSystem); // 将只读文件系统挂载到 /code 上 rootFS.mount(CODE_ROOT, codeFileSystem); diff --git a/packages/startup/src/startup/index.tsx b/packages/startup/src/startup/index.tsx index 35675cb8..60e6c500 100644 --- a/packages/startup/src/startup/index.tsx +++ b/packages/startup/src/startup/index.tsx @@ -187,7 +187,12 @@ const App = () => ( }} runtimeConfig={{ scmFileTree: true, - scenario: 'ALEX_TEST', + scenario: 'startup', + workspace: { + filesystem: { + fs: 'InMemory' + } + }, aiNative: { enable: true, providerEditorInlineChat(): IEditorInlineChat[] { diff --git a/packages/sumi-core/src/server/core/app.ts b/packages/sumi-core/src/server/core/app.ts index ce10f4d4..50f1aaaf 100644 --- a/packages/sumi-core/src/server/core/app.ts +++ b/packages/sumi-core/src/server/core/app.ts @@ -5,8 +5,8 @@ import { RawMessageIO } from '@opensumi/ide-connection/lib/common/rpc/message-io import { rawSerializer } from '@opensumi/ide-connection/lib/common/serializer/raw'; import { BaseCommonChannelHandler, - RPCServiceChannelPath, CommonChannelPathHandler, + RPCServiceChannelPath, } from '@opensumi/ide-connection/lib/common/server-handler'; import { AppConfig, BrowserModule } from '@opensumi/ide-core-browser'; import { diff --git a/packages/sumi-core/src/server/core/fs-launch.contribution.ts b/packages/sumi-core/src/server/core/fs-launch.contribution.ts index df5446be..8615d635 100644 --- a/packages/sumi-core/src/server/core/fs-launch.contribution.ts +++ b/packages/sumi-core/src/server/core/fs-launch.contribution.ts @@ -2,7 +2,7 @@ import { Autowired } from '@opensumi/di'; import { ContributionProvider, Disposable, Domain, localize } from '@opensumi/ide-core-common'; import { IMessageService } from '@opensumi/ide-overlay'; import { AppConfig, IServerApp, RootFS, RuntimeConfig } from '../../common/types'; -import { BrowserFS } from '../node'; +import { BrowserFS, isPathMounted } from '../node'; import { LaunchContribution } from './app'; import { FileSystemContribution } from './base'; @@ -39,8 +39,7 @@ export class FileSystemConfigContribution extends Disposable implements FileSyst const fsConfig = this.runtimeConfig.workspace?.filesystem; if (!fsConfig) return; const { workspaceDir } = this.appConfig; - // @ts-ignore - if (rootFS && rootFS.mountList.includes(workspaceDir)) { + if (isPathMounted(rootFS, workspaceDir)) { return; } try { diff --git a/packages/sumi-core/src/server/node/bfs/index.ts b/packages/sumi-core/src/server/node/bfs/index.ts index a444fb02..2fc49172 100644 --- a/packages/sumi-core/src/server/node/bfs/index.ts +++ b/packages/sumi-core/src/server/node/bfs/index.ts @@ -18,7 +18,7 @@ import MountableFileSystem, { } from '@codeblitzjs/ide-browserfs/lib/backend/MountableFileSystem'; import OverlayFS, { deletionLogPath, OverlayFSOptions } from '@codeblitzjs/ide-browserfs/lib/backend/OverlayFS'; import ZipFS, { ZipFSOptions } from '@codeblitzjs/ide-browserfs/lib/backend/ZipFS'; -import { WORKSPACE_IDB_NAME } from '../../../common'; +import { RootFS, WORKSPACE_IDB_NAME } from '../../../common'; import { Editor, EditorOptions } from './Editor'; import { FileIndexSystem, FileIndexSystemOptions } from './FileIndex'; @@ -179,3 +179,12 @@ type InstanceType = T extends { Create(options: object, cb: BFSCallback = InstanceType<(typeof Backends)[T]>; + +export function isPathMounted(fs: RootFS, path: string): boolean { + // @ts-ignore + if (fs && fs.mountList.includes(path)) { + return true; + } + + return false; +}