Skip to content

Commit

Permalink
fix: use same paths as vscode for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
CompuIves committed Nov 8, 2023
1 parent 3b81576 commit aa5bc47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ diagnostics.set(modelRef.object.textEditorModel!.uri, [{
code: 42
}])

const settingsModelReference = await createModelReference(monaco.Uri.from({ scheme: 'user', path: '/settings.json' }), `{
const settingsModelReference = await createModelReference(monaco.Uri.from({ scheme: 'user-store', path: '/User/settings.json' }), `{
"workbench.colorTheme": "Default Dark+",
"workbench.iconTheme": "vs-seti",
"editor.autoClosingBrackets": "languageDefined",
Expand Down Expand Up @@ -134,7 +134,7 @@ settingEditor.addAction({
contextMenuGroupId: 'custom'
})

const keybindingsModelReference = await createModelReference(monaco.Uri.from({ scheme: 'user', path: '/keybindings.json' }), `[
const keybindingsModelReference = await createModelReference(monaco.Uri.from({ scheme: 'user-store', path: '/User/keybindings.json' }), `[
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
Expand Down
19 changes: 7 additions & 12 deletions src/missing-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { IPreferencesService } from 'vs/workbench/services/preferences/common/pr
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'
import { StandaloneServices } from 'vs/editor/standalone/browser/standaloneServices'
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'
import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'
import { IUserDataProfile, IUserDataProfilesService, toUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile'
import { IPolicyService } from 'vs/platform/policy/common/policy'
import { IUserDataProfileImportExportService, IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'
import { UserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfileService'
Expand Down Expand Up @@ -172,6 +172,8 @@ import { BrowserHostService } from 'vs/workbench/services/host/browser/browserHo
import { IBannerService } from 'vs/workbench/services/banner/browser/bannerService'
import { ITitleService } from 'vs/workbench/services/title/common/titleService'
import { IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents'
import { Schemas } from 'vs/base/common/network'
import { joinPath } from 'vs/base/common/resources'
import { unsupported } from './tools'
import { getBuiltInExtensionTranslationsUris } from './l10n'

Expand Down Expand Up @@ -534,18 +536,11 @@ registerSingleton(ITextMateTokenizationService, class NullTextMateService implem
createTokenizer = unsupported
}, InstantiationType.Eager)

const userRoamingDataHome = URI.from({ scheme: Schemas.vscodeUserData, path: '/User' })
const defaultProfile = toUserDataProfile('__default__profile__', 'Default', userRoamingDataHome, joinPath(userRoamingDataHome, 'caches', 'CachedProfilesData'))
const profile: IUserDataProfile = {
id: 'default',
isDefault: true,
name: 'default',
location: URI.from({ scheme: 'user', path: '/profile.json' }),
globalStorageHome: URI.from({ scheme: 'user', path: '/globalStorage' }),
settingsResource: URI.from({ scheme: 'user', path: '/settings.json' }),
keybindingsResource: URI.from({ scheme: 'user', path: '/keybindings.json' }),
tasksResource: URI.from({ scheme: 'user', path: '/tasks.json' }),
snippetsHome: URI.from({ scheme: 'user', path: '/snippets' }),
extensionsResource: URI.from({ scheme: 'user', path: '/extensions.json' }),
cacheHome: URI.from({ scheme: 'cache', path: '/' })
...defaultProfile,
isDefault: true
}

registerSingleton(IUserDataProfilesService, class UserDataProfilesService implements IUserDataProfilesService {
Expand Down
2 changes: 0 additions & 2 deletions src/service-override/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,7 @@ fileSystemProvider.register(0, new MkdirpOnWriteInMemoryFileSystemProvider())
const extensionFileSystemProvider = new RegisteredFileSystemProvider(true)

const providers: Record<string, IFileSystemProvider> = {
user: new InMemoryFileSystemProvider(),
extension: extensionFileSystemProvider,
cache: new InMemoryFileSystemProvider(),
logs: new InMemoryFileSystemProvider(),
[Schemas.vscodeUserData]: new InMemoryFileSystemProvider(),
[Schemas.tmp]: new InMemoryFileSystemProvider(),
Expand Down

0 comments on commit aa5bc47

Please sign in to comment.