|
| 1 | +Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts |
| 2 | +=================================================================== |
| 3 | +--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts |
| 4 | ++++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts |
| 5 | +@@ -17,6 +17,7 @@ export const serverOptions: OptionDescri |
| 6 | + 'disable-update-check': { type: 'boolean' }, |
| 7 | + 'auth': { type: 'string' }, |
| 8 | + 'disable-file-downloads': { type: 'boolean' }, |
| 9 | ++ 'disable-show-local': { type: 'boolean' }, |
| 10 | + 'locale': { type: 'string' }, |
| 11 | + 'disable-getting-started-override': { type: 'boolean' }, |
| 12 | + |
| 13 | +@@ -101,6 +102,7 @@ export interface ServerParsedArgs { |
| 14 | + 'disable-update-check'?: boolean; |
| 15 | + 'auth'?: string |
| 16 | + 'disable-file-downloads'?: boolean; |
| 17 | ++ 'disable-show-local'?: boolean; |
| 18 | + 'locale'?: string |
| 19 | + 'disable-getting-started-override'?: boolean, |
| 20 | + |
| 21 | +Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts |
| 22 | +=================================================================== |
| 23 | +--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts |
| 24 | ++++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts |
| 25 | +@@ -335,6 +335,7 @@ export class WebClientServer { |
| 26 | + webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', |
| 27 | + userDataPath: this._environmentService.userDataPath, |
| 28 | + isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], |
| 29 | ++ isEnabledShowLocal: !this._environmentService.args['disable-show-local'], |
| 30 | + isEnabledCoderGettingStarted: !this._environmentService.args['disable-getting-started-override'], |
| 31 | + _wrapWebWorkerExtHostInIframe, |
| 32 | + developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, |
| 33 | +Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts |
| 34 | +=================================================================== |
| 35 | +--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts |
| 36 | ++++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts |
| 37 | +@@ -287,6 +287,11 @@ export interface IWorkbenchConstructionO |
| 38 | + readonly isEnabledFileDownloads?: boolean |
| 39 | + |
| 40 | + /** |
| 41 | ++ * Whether the "Show local" button is enabled. |
| 42 | ++ */ |
| 43 | ++ readonly isEnabledShowLocal?: boolean |
| 44 | ++ |
| 45 | ++ /** |
| 46 | + * Whether to use Coder's custom Getting Started text. |
| 47 | + */ |
| 48 | + readonly isEnabledCoderGettingStarted?: boolean |
| 49 | +Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 50 | +=================================================================== |
| 51 | +--- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 52 | ++++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 53 | +@@ -39,6 +39,11 @@ export interface IBrowserWorkbenchEnviro |
| 54 | + readonly isEnabledFileDownloads?: boolean; |
| 55 | + |
| 56 | + /** |
| 57 | ++ * Enable Show Local button on File Dialogs. |
| 58 | ++ */ |
| 59 | ++ readonly isEnabledShowLocal?: boolean; |
| 60 | ++ |
| 61 | ++ /** |
| 62 | + * Enable Coder's custom getting started text. |
| 63 | + */ |
| 64 | + readonly isEnabledCoderGettingStarted?: boolean; |
| 65 | +@@ -128,6 +133,13 @@ export class BrowserWorkbenchEnvironment |
| 66 | + return this.options.isEnabledFileDownloads; |
| 67 | + } |
| 68 | + |
| 69 | ++ get isEnabledShowLocal(): boolean { |
| 70 | ++ if (typeof this.options.isEnabledShowLocal === "undefined") { |
| 71 | ++ throw new Error('isEnabledShowLocal was not provided to the browser'); |
| 72 | ++ } |
| 73 | ++ return this.options.isEnabledShowLocal; |
| 74 | ++ } |
| 75 | ++ |
| 76 | + get isEnabledCoderGettingStarted(): boolean { |
| 77 | + if (typeof this.options.isEnabledCoderGettingStarted === "undefined") { |
| 78 | + throw new Error('isEnabledCoderGettingStarted was not provided to the browser'); |
| 79 | +Index: code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts |
| 80 | +=================================================================== |
| 81 | +--- code-server.orig/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts |
| 82 | ++++ code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts |
| 83 | +@@ -18,7 +18,7 @@ import { IModelService } from 'vs/editor |
| 84 | + import { ILanguageService } from 'vs/editor/common/languages/language'; |
| 85 | + import { getIconClasses } from 'vs/editor/common/services/getIconClasses'; |
| 86 | + import { Schemas } from 'vs/base/common/network'; |
| 87 | +-import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; |
| 88 | ++import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; |
| 89 | + import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; |
| 90 | + import { IContextKeyService, IContextKey, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; |
| 91 | + import { equalsIgnoreCase, format, startsWithIgnoreCase } from 'vs/base/common/strings'; |
| 92 | +@@ -142,7 +142,7 @@ export class SimpleFileDialog implements |
| 93 | + @IFileDialogService private readonly fileDialogService: IFileDialogService, |
| 94 | + @IModelService private readonly modelService: IModelService, |
| 95 | + @ILanguageService private readonly languageService: ILanguageService, |
| 96 | +- @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, |
| 97 | ++ @IBrowserWorkbenchEnvironmentService protected readonly environmentService: IBrowserWorkbenchEnvironmentService, |
| 98 | + @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, |
| 99 | + @IPathService protected readonly pathService: IPathService, |
| 100 | + @IKeybindingService private readonly keybindingService: IKeybindingService, |
| 101 | +@@ -286,20 +286,22 @@ export class SimpleFileDialog implements |
| 102 | + this.filePickBox.autoFocusOnList = false; |
| 103 | + this.filePickBox.ignoreFocusOut = true; |
| 104 | + this.filePickBox.ok = true; |
| 105 | +- if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { |
| 106 | +- this.filePickBox.customButton = true; |
| 107 | +- this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local'); |
| 108 | +- let action; |
| 109 | +- if (isSave) { |
| 110 | +- action = SaveLocalFileCommand; |
| 111 | +- } else { |
| 112 | +- action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand; |
| 113 | +- } |
| 114 | +- const keybinding = this.keybindingService.lookupKeybinding(action.ID); |
| 115 | +- if (keybinding) { |
| 116 | +- const label = keybinding.getLabel(); |
| 117 | +- if (label) { |
| 118 | +- this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label); |
| 119 | ++ if ((this.environmentService.isEnabledFileDownloads || !isSave) && this.environmentService.isEnabledShowLocal) { |
| 120 | ++ if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { |
| 121 | ++ this.filePickBox.customButton = true; |
| 122 | ++ this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local'); |
| 123 | ++ let action; |
| 124 | ++ if (isSave) { |
| 125 | ++ action = SaveLocalFileCommand; |
| 126 | ++ } else { |
| 127 | ++ action = this.allowFileSelection ? (this.allowFolderSelection ? OpenLocalFileFolderCommand : OpenLocalFileCommand) : OpenLocalFolderCommand; |
| 128 | ++ } |
| 129 | ++ const keybinding = this.keybindingService.lookupKeybinding(action.ID); |
| 130 | ++ if (keybinding) { |
| 131 | ++ const label = keybinding.getLabel(); |
| 132 | ++ if (label) { |
| 133 | ++ this.filePickBox.customHover = format('{0} ({1})', action.LABEL, label); |
| 134 | ++ } |
| 135 | + } |
| 136 | + } |
| 137 | + } |
0 commit comments