How is persistent state handled in split mode?

In a split-mode plugin, I have

AFAIK the folding, the FoldingBuilder should be in the frontend.
But how and where are the folding settings stored?

My implementation CodeFoldingOptionsProvider is currently in the backend, but I’m not sure if that’s correct. My thinking is that the settings should be stored with the project files on the backend.

The service (implementing PersistentStateComponent) is in the shared module to allow the backend to store the settings and the frontend to read them.

Is this a wrong approach or are the persistent settings somehow synced between backend and frontend?
If it’s wrong, do I have to add RPC-enabled services for all of the settings services? That would be a lot of work and complexity :frowning:

I probably don’t understand the architecture yet.

Thank you!

1 Like

Hi @jansorg,

Ideally, everything should be on the frontend side — the folder builder, options provider, and the settings service as well.
Note that frontend settings in Remote Development are shared with Monolith settings on the client machine. So it makes sense to store application-level settings (such as most of the folding settings) on the frontend.

If you really need these settings to be accessible on both the frontend and backend, you can synchronize your settings using RemoteSettingInfoProvider. But please, avoid it unless it’s really necessary. Always prefer to store application settings on frontend only.

Thanks! That’s helpful.

Some of my application settings refer to paths on the backend, e.g. for a linter executed on the backend.
I suppose that this would be a good candidate to store on the backend?
I’ll try to split application settings into frontend-only and backend.

Would it be correct to assume that project-level settings are usually stored on the backend?

@Vyacheslav.Moklev I moved the folding options settings and options provider to the frontend. But not the settings are not displayed anymore in the settings UI.

Is this a bug or limitation in the platform?