Skip to content

Commit

Permalink
feat: add config/keybinding edition panels
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Jun 7, 2023
1 parent ac7b925 commit 04d5d42
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
9 changes: 7 additions & 2 deletions rollup/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ const ALLOWED_WORKBENCH_CONTRIBUTIONS = new Set([
'ExplorerViewletViewsContribution',
'ViewsExtensionHandler',
'OutputContribution',
'TerminalMainContribution'
'TerminalMainContribution',
'PreferencesActionsContribution',
'PreferencesContribution'
])

function isCallPure (file: string, functionName: string, node: recast.types.namedTypes.CallExpression): boolean {
Expand Down Expand Up @@ -175,7 +177,10 @@ function isCallPure (file: string, functionName: string, node: recast.types.name
if (firstParamCode.includes('DEBUG_CONFIGURE_COMMAND_ID') ||
firstParamCode.includes('workbench.action.closePanel') ||
firstParamCode.includes('workbench.action.toggleMaximizedPanel') ||
firstParamCode.includes('OpenEditorsView')) {
firstParamCode.includes('OpenEditorsView') ||
firstParamCode.includes('openWorkspaceSettings') ||
firstParamCode.includes('openRemoteSettings') ||
firstParamCode.includes('openApplicationSettings')) {
return true
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/service-override/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standalone
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'
import { PreferencesService } from 'vs/workbench/services/preferences/browser/preferencesService'
import { IPreferencesSearchService } from 'vs/workbench/contrib/preferences/common/preferences'
import { PreferencesSearchService } from 'vs/workbench/contrib/preferences/browser/preferencesSearch'
import { IKeybindingEditingService, KeybindingsEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing'
import 'vs/workbench/contrib/preferences/browser/preferences.contribution'

export default function getServiceOverride (): IEditorOverrideServices {
return {
[IPreferencesService.toString()]: new SyncDescriptor(PreferencesService)
[IPreferencesService.toString()]: new SyncDescriptor(PreferencesService),
[IPreferencesSearchService.toString()]: new SyncDescriptor(PreferencesSearchService),
[IKeybindingEditingService.toString()]: new SyncDescriptor(KeybindingsEditingService)
}
}
3 changes: 3 additions & 0 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export { ILoggerService, LogLevel } from 'vs/platform/log/common/log'
export { ILogService } from 'vs/platform/log/common/log'
export { IViewsService } from 'vs/workbench/common/views'
export { ILayoutService } from 'vs/platform/layout/browser/layoutService'
export { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'
export { IPreferencesSearchService } from 'vs/workbench/contrib/preferences/common/preferences'
export { IKeybindingEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing'

// Export all Notification service parts
export {
Expand Down
49 changes: 49 additions & 0 deletions src/vscode-services/missing-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ import { ITerminalContributionService } from 'vs/workbench/contrib/terminal/comm
import { ITerminalLinkProviderService } from 'vs/workbench/contrib/terminalContrib/links/browser/links'
import { IEnvironmentVariableService } from 'vs/workbench/contrib/terminal/common/environmentVariable'
import { ITerminalQuickFixService } from 'vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix'
import { IPreferencesSearchService } from 'vs/workbench/contrib/preferences/common/preferences'
import { AccountStatus, IUserDataSyncWorkbenchService } from 'vs/workbench/services/userDataSync/common/userDataSync'
import { IUserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSync'
import { IKeybindingEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing'
import { unsupported } from '../tools'

class NullLoggerService extends AbstractLoggerService {
Expand Down Expand Up @@ -1399,3 +1403,48 @@ registerSingleton(IExtensionManagementService, class ExtensionManagementService
getTargetPlatform = unsupported
cleanUp = unsupported
}, InstantiationType.Delayed)

registerSingleton(IUserDataSyncWorkbenchService, class UserDataSyncWorkbenchService implements IUserDataSyncWorkbenchService {
_serviceBrand: undefined
enabled = false
authenticationProviders = []
all = []
current = undefined
accountStatus = AccountStatus.Uninitialized
onDidChangeAccountStatus = Event.None
turnOn = unsupported
turnoff = unsupported
signIn = unsupported
resetSyncedData = unsupported
showSyncActivity = unsupported
syncNow = unsupported
synchroniseUserDataSyncStoreType = unsupported
showConflicts = unsupported
accept = unsupported
}, InstantiationType.Delayed)

registerSingleton(IUserDataSyncEnablementService, class UserDataSyncEnablementService implements IUserDataSyncEnablementService {
_serviceBrand: undefined
onDidChangeEnablement = Event.None
isEnabled = () => false
canToggleEnablement = () => false
setEnablement = unsupported
onDidChangeResourceEnablement = Event.None
isResourceEnabled = () => false
setResourceEnablement = unsupported
getResourceSyncStateVersion = () => undefined
}, InstantiationType.Delayed)

registerSingleton(IKeybindingEditingService, class KeybindingEditingService implements IKeybindingEditingService {
_serviceBrand: undefined
addKeybinding = unsupported
editKeybinding = unsupported
removeKeybinding = unsupported
resetKeybinding = unsupported
}, InstantiationType.Delayed)

registerSingleton(IPreferencesSearchService, class PreferencesSearchService implements IPreferencesSearchService {
_serviceBrand: undefined
getLocalSearchProvider = unsupported
getRemoteSearchProvider = unsupported
}, InstantiationType.Delayed)

0 comments on commit 04d5d42

Please sign in to comment.