mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 02:58:31 -05:00
Merge from vscode f5d3ffa6a0d655c87e1eb0e1e90773df58f7ff25 (#7929)
* Merge from vscode f5d3ffa6a0d655c87e1eb0e1e90773df58f7ff25 * fix launch script * add missing files
This commit is contained in:
@@ -153,7 +153,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
||||
|
||||
for (const handler of this.openEditorHandlers) {
|
||||
const result = handler(event.editor, event.options, group);
|
||||
const override = result ? result.override : undefined;
|
||||
const override = result?.override;
|
||||
if (override) {
|
||||
event.prevent((() => override.then(editor => withNullAsUndefined(editor))));
|
||||
break;
|
||||
@@ -162,9 +162,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
||||
}
|
||||
|
||||
get activeControl(): IVisibleEditor | undefined {
|
||||
const activeGroup = this.editorGroupService.activeGroup;
|
||||
|
||||
return activeGroup ? activeGroup.activeControl : undefined;
|
||||
return this.editorGroupService.activeGroup?.activeControl;
|
||||
}
|
||||
|
||||
get activeTextEditorWidget(): ICodeEditor | IDiffEditor | undefined {
|
||||
|
||||
@@ -91,6 +91,7 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
this.keyboardLayoutResource = joinPath(this.userRoamingDataHome, 'keyboardLayout.json');
|
||||
this.argvResource = joinPath(this.userRoamingDataHome, 'argv.json');
|
||||
this.backupHome = joinPath(this.userRoamingDataHome, BACKUPS);
|
||||
this.untitledWorkspacesHome = joinPath(this.userRoamingDataHome, 'Workspaces');
|
||||
this.configuration.backupWorkspaceResource = joinPath(this.backupHome, options.workspaceId);
|
||||
this.configuration.connectionToken = options.connectionToken || getCookieValue('vscode-tkn');
|
||||
|
||||
@@ -99,8 +100,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
break: false
|
||||
};
|
||||
|
||||
this.untitledWorkspacesHome = URI.from({ scheme: Schemas.untitled, path: 'Workspaces' });
|
||||
|
||||
// Fill in selected extra environmental properties
|
||||
if (options.workspaceProvider && Array.isArray(options.workspaceProvider.payload)) {
|
||||
const environment = serializableToMap(options.workspaceProvider.payload);
|
||||
@@ -207,7 +206,7 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
get webviewExternalEndpoint(): string {
|
||||
// TODO: get fallback from product.json
|
||||
return (this.options.webviewEndpoint || 'https://{{uuid}}.vscode-webview-test.com/{{commit}}')
|
||||
.replace('{{commit}}', product.commit || '211fa02efe8c041fd7baa8ec3dce199d5185aa44');
|
||||
.replace('{{commit}}', product.commit || 'c58aaab8a1cc22a7139b761166a0d4f37d41e998');
|
||||
}
|
||||
|
||||
get webviewResourceRoot(): string {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class WorkbenchEnvironmentService extends EnvironmentService implements I
|
||||
|
||||
get webviewExternalEndpoint(): string {
|
||||
const baseEndpoint = 'https://{{uuid}}.vscode-webview-test.com/{{commit}}';
|
||||
return baseEndpoint.replace('{{commit}}', product.commit || '211fa02efe8c041fd7baa8ec3dce199d5185aa44');
|
||||
return baseEndpoint.replace('{{commit}}', product.commit || 'c58aaab8a1cc22a7139b761166a0d4f37d41e998');
|
||||
}
|
||||
|
||||
readonly webviewResourceRoot = 'vscode-resource://{{resource}}';
|
||||
|
||||
@@ -142,7 +142,7 @@ class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler {
|
||||
}
|
||||
|
||||
if (showConfirm) {
|
||||
let uriString = uri.toString();
|
||||
let uriString = uri.toString(false);
|
||||
|
||||
// {{SQL CARBON EDIT}} - Begin
|
||||
// Dialog service starts truncating words longer than 80 characters and adds ellipses to it.
|
||||
|
||||
@@ -7,7 +7,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IEditor } from 'vs/editor/common/editorCommon';
|
||||
import { ITextEditorOptions, IResourceInput, ITextEditorSelection } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorInput, IEditor as IBaseEditor, Extensions as EditorExtensions, EditorInput, IEditorCloseEvent, IEditorInputFactoryRegistry, toResource, Extensions as EditorInputExtensions, IFileInputFactory, IEditorIdentifier } from 'vs/workbench/common/editor';
|
||||
import { IEditorInput, IEditor as IBaseEditor, Extensions as EditorExtensions, EditorInput, IEditorCloseEvent, IEditorInputFactoryRegistry, toResource, IEditorIdentifier } from 'vs/workbench/common/editor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IHistoryService } from 'vs/workbench/services/history/common/history';
|
||||
import { FileChangesEvent, IFileService, FileChangeType, FILES_EXCLUDE_CONFIG } from 'vs/platform/files/common/files';
|
||||
@@ -125,8 +125,6 @@ export class HistoryService extends Disposable implements IHistoryService {
|
||||
private loaded: boolean;
|
||||
private resourceFilter: ResourceGlobMatcher;
|
||||
|
||||
private fileInputFactory: IFileInputFactory;
|
||||
|
||||
private canNavigateBackContextKey: IContextKey<boolean>;
|
||||
private canNavigateForwardContextKey: IContextKey<boolean>;
|
||||
private canNavigateToLastEditLocationContextKey: IContextKey<boolean>;
|
||||
@@ -149,8 +147,6 @@ export class HistoryService extends Disposable implements IHistoryService {
|
||||
this.canNavigateForwardContextKey = (new RawContextKey<boolean>('canNavigateForward', false)).bindTo(this.contextKeyService);
|
||||
this.canNavigateToLastEditLocationContextKey = (new RawContextKey<boolean>('canNavigateToLastEditLocation', false)).bindTo(this.contextKeyService);
|
||||
|
||||
this.fileInputFactory = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).getFileInputFactory();
|
||||
|
||||
this.index = -1;
|
||||
this.lastIndex = -1;
|
||||
this.stack = [];
|
||||
@@ -486,7 +482,7 @@ export class HistoryService extends Disposable implements IHistoryService {
|
||||
}
|
||||
|
||||
private handleEditorEventInHistory(editor?: IBaseEditor): void {
|
||||
const input = editor ? editor.input : undefined;
|
||||
const input = editor?.input;
|
||||
|
||||
// Ensure we have at least a name to show and not configured to exclude input
|
||||
if (!input || !input.getName() || !this.include(input)) {
|
||||
@@ -738,8 +734,9 @@ export class HistoryService extends Disposable implements IHistoryService {
|
||||
}
|
||||
|
||||
private preferResourceInput(input: IEditorInput): IEditorInput | IResourceInput {
|
||||
if (this.fileInputFactory.isFileInput(input)) {
|
||||
return { resource: input.getResource() };
|
||||
const resource = input.getResource();
|
||||
if (resource && this.fileService.canHandleResource(resource)) {
|
||||
return { resource: resource };
|
||||
}
|
||||
|
||||
return input;
|
||||
|
||||
@@ -13,7 +13,6 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { isEqual, basenameOrAuthority, isEqualOrParent, basename, joinPath, dirname } from 'vs/base/common/resources';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { tildify, getPathLabel } from 'vs/base/common/labels';
|
||||
import { ltrim, endsWith } from 'vs/base/common/strings';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, WORKSPACE_EXTENSION, toWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
@@ -71,7 +70,7 @@ const sepRegexp = /\//g;
|
||||
const labelMatchingRegexp = /\$\{(scheme|authority|path|(query)\.(.+?))\}/g;
|
||||
|
||||
function hasDriveLetter(path: string): boolean {
|
||||
return !!(isWindows && path && path[2] === ':');
|
||||
return !!(path && path[2] === ':');
|
||||
}
|
||||
|
||||
class ResourceLabelFormattersHandler implements IWorkbenchContribution {
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.monaco-workbench .progress-badge > .badge-content {
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMiAyIDE0IDE0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDIgMiAxNCAxNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTkgMTZjLTMuODYgMC03LTMuMTQtNy03czMuMTQtNyA3LTdjMy44NTkgMCA3IDMuMTQxIDcgN3MtMy4xNDEgNy03IDd6bTAtMTIuNmMtMy4wODggMC01LjYgMi41MTMtNS42IDUuNnMyLjUxMiA1LjYgNS42IDUuNiA1LjYtMi41MTIgNS42LTUuNi0yLjUxMi01LjYtNS42LTUuNnptMy44NiA3LjFsLTMuMTYtMS44OTZ2LTMuODA0aC0xLjR2NC41OTZsMy44NCAyLjMwNS43Mi0xLjIwMXoiLz48L3N2Zz4=");
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
.monaco-workbench .progress-badge > .badge-content::before {
|
||||
-webkit-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMiAyIDE0IDE0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDIgMiAxNCAxNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTkgMTZjLTMuODYgMC03LTMuMTQtNy03czMuMTQtNyA3LTdjMy44NTkgMCA3IDMuMTQxIDcgN3MtMy4xNDEgNy03IDd6bTAtMTIuNmMtMy4wODggMC01LjYgMi41MTMtNS42IDUuNnMyLjUxMiA1LjYgNS42IDUuNiA1LjYtMi41MTIgNS42LTUuNi0yLjUxMi01LjYtNS42LTUuNnptMy44NiA3LjFsLTMuMTYtMS44OTZ2LTMuODA0aC0xLjR2NC41OTZsMy44NCAyLjMwNS43Mi0xLjIwMXoiLz48L3N2Zz4=");
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
background-color: currentColor;
|
||||
content: '';
|
||||
}
|
||||
|
||||
15
src/vs/workbench/services/workspaces/browser/workspaces.ts
Normal file
15
src/vs/workbench/services/workspaces/browser/workspaces.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
|
||||
export function getWorkspaceIdentifier(workspacePath: URI): IWorkspaceIdentifier {
|
||||
return {
|
||||
id: hash(workspacePath.toString()).toString(16),
|
||||
configPath: workspacePath
|
||||
};
|
||||
}
|
||||
@@ -4,13 +4,19 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IWorkspacesService, IWorkspaceFolderCreationData, IWorkspaceIdentifier, IEnterWorkspaceResult, IRecentlyOpened, restoreRecentlyOpened, IRecent, isRecentFile, isRecentFolder, toStoreData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspacesService, IWorkspaceFolderCreationData, IWorkspaceIdentifier, IEnterWorkspaceResult, IRecentlyOpened, restoreRecentlyOpened, IRecent, isRecentFile, isRecentFolder, toStoreData, IStoredWorkspaceFolder, getStoredWorkspaceFolder, WORKSPACE_EXTENSION, IStoredWorkspace } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
|
||||
export class BrowserWorkspacesService extends Disposable implements IWorkspacesService {
|
||||
|
||||
@@ -25,6 +31,9 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -113,20 +122,41 @@ export class BrowserWorkspacesService extends Disposable implements IWorkspacesS
|
||||
|
||||
//#region Workspace Management
|
||||
|
||||
enterWorkspace(path: URI): Promise<IEnterWorkspaceResult | null> {
|
||||
throw new Error('Untitled workspaces are currently unsupported in Web');
|
||||
async enterWorkspace(path: URI): Promise<IEnterWorkspaceResult | null> {
|
||||
|
||||
// Open workspace in same window
|
||||
await this.hostService.openWindow([{ workspaceUri: path }], { forceReuseWindow: true });
|
||||
|
||||
return {
|
||||
workspace: await this.getWorkspaceIdentifier(path)
|
||||
};
|
||||
}
|
||||
|
||||
createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[], remoteAuthority?: string): Promise<IWorkspaceIdentifier> {
|
||||
throw new Error('Untitled workspaces are currently unsupported in Web');
|
||||
async createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[], remoteAuthority?: string): Promise<IWorkspaceIdentifier> {
|
||||
const randomId = (Date.now() + Math.round(Math.random() * 1000)).toString();
|
||||
const newUntitledWorkspacePath = joinPath(this.environmentService.untitledWorkspacesHome, `${randomId}.${WORKSPACE_EXTENSION}`);
|
||||
|
||||
// Build array of workspace folders to store
|
||||
const storedWorkspaceFolder: IStoredWorkspaceFolder[] = [];
|
||||
if (folders) {
|
||||
for (const folder of folders) {
|
||||
storedWorkspaceFolder.push(getStoredWorkspaceFolder(folder.uri, folder.name, this.environmentService.untitledWorkspacesHome));
|
||||
}
|
||||
}
|
||||
|
||||
// Store at untitled workspaces location
|
||||
const storedWorkspace: IStoredWorkspace = { folders: storedWorkspaceFolder, remoteAuthority };
|
||||
await this.fileService.writeFile(newUntitledWorkspacePath, VSBuffer.fromString(JSON.stringify(storedWorkspace, null, '\t')));
|
||||
|
||||
return this.getWorkspaceIdentifier(newUntitledWorkspacePath);
|
||||
}
|
||||
|
||||
deleteUntitledWorkspace(workspace: IWorkspaceIdentifier): Promise<void> {
|
||||
throw new Error('Untitled workspaces are currently unsupported in Web');
|
||||
return this.fileService.del(workspace.configPath);
|
||||
}
|
||||
|
||||
getWorkspaceIdentifier(workspacePath: URI): Promise<IWorkspaceIdentifier> {
|
||||
throw new Error('Untitled workspaces are currently unsupported in Web');
|
||||
async getWorkspaceIdentifier(workspacePath: URI): Promise<IWorkspaceIdentifier> {
|
||||
return getWorkspaceIdentifier(workspacePath);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user