mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 0fde6619172c9f04c41f2e816479e432cc974b8b (#5199)
This commit is contained in:
@@ -9,7 +9,7 @@ import { isUndefinedOrNull, withUndefinedAsNull } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -17,6 +17,9 @@ import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ICompositeControl } from 'vs/workbench/common/composite';
|
||||
import { ActionRunner, IAction } from 'vs/base/common/actions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IPathData } from 'vs/platform/windows/common/windows';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
|
||||
export const ActiveEditorContext = new RawContextKey<string | null>('activeEditor', null);
|
||||
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
||||
@@ -198,15 +201,11 @@ export interface IEditorInputFactory {
|
||||
export interface IUntitledResourceInput extends IBaseResourceInput {
|
||||
|
||||
/**
|
||||
* Optional resource. If the resource is not provided a new untitled file is created.
|
||||
* Optional resource. If the resource is not provided a new untitled file is created (e.g. Untitled-1).
|
||||
* Otherwise the untitled editor will have an associated path and use that when saving.
|
||||
*/
|
||||
resource?: URI;
|
||||
|
||||
/**
|
||||
* Optional file path. Using the file resource will associate the file to the untitled resource.
|
||||
*/
|
||||
filePath?: string;
|
||||
|
||||
/**
|
||||
* Optional language of the untitled resource.
|
||||
*/
|
||||
@@ -1089,3 +1088,37 @@ export const Extensions = {
|
||||
};
|
||||
|
||||
Registry.add(Extensions.EditorInputFactories, new EditorInputFactoryRegistry());
|
||||
|
||||
export async function pathsToEditors(paths: IPathData[] | undefined, fileService: IFileService): Promise<(IResourceInput | IUntitledResourceInput)[]> {
|
||||
if (!paths || !paths.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const editors = await Promise.all(paths.map(async path => {
|
||||
const resource = URI.revive(path.fileUri);
|
||||
if (!resource || !fileService.canHandleResource(resource)) {
|
||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert after strictnullchecks
|
||||
}
|
||||
|
||||
const exists = (typeof path.exists === 'boolean') ? path.exists : await fileService.exists(resource);
|
||||
|
||||
const options: ITextEditorOptions = { pinned: true };
|
||||
if (exists && typeof path.lineNumber === 'number') {
|
||||
options.selection = {
|
||||
startLineNumber: path.lineNumber,
|
||||
startColumn: path.columnNumber || 1
|
||||
};
|
||||
}
|
||||
|
||||
let input: IResourceInput | IUntitledResourceInput;
|
||||
if (!exists) {
|
||||
input = { resource, options, forceUntitled: true };
|
||||
} else {
|
||||
input = { resource, options, forceFile: true };
|
||||
}
|
||||
|
||||
return input;
|
||||
}));
|
||||
|
||||
return coalesce(editors);
|
||||
}
|
||||
|
||||
@@ -310,15 +310,15 @@ export const STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND = registerColor('statusB
|
||||
}, nls.localize('statusBarProminentItemHoverBackground', "Status bar prominent items background color when hovering. Prominent items stand out from other status bar entries to indicate importance. Change mode `Toggle Tab Key Moves Focus` from command palette to see an example. The status bar is shown in the bottom of the window."));
|
||||
|
||||
export const STATUS_BAR_HOST_NAME_BACKGROUND = registerColor('statusBarItem.hostBackground', {
|
||||
dark: STATUS_BAR_PROMINENT_ITEM_BACKGROUND,
|
||||
light: STATUS_BAR_PROMINENT_ITEM_BACKGROUND,
|
||||
hc: STATUS_BAR_PROMINENT_ITEM_BACKGROUND
|
||||
dark: '#C40057',
|
||||
light: '#C40057',
|
||||
hc: '#C40057'
|
||||
}, nls.localize('statusBarItemHostBackground', "Background color for the host indicator on the status bar."));
|
||||
|
||||
export const STATUS_BAR_HOST_NAME_FOREGROUND = registerColor('statusBarItem.hostForeground', {
|
||||
dark: STATUS_BAR_PROMINENT_ITEM_FOREGROUND,
|
||||
light: STATUS_BAR_PROMINENT_ITEM_FOREGROUND,
|
||||
hc: STATUS_BAR_PROMINENT_ITEM_FOREGROUND
|
||||
dark: '#FFFFFF',
|
||||
light: '#FFFFFF',
|
||||
hc: '#FFFFFF'
|
||||
}, nls.localize('statusBarItemHostForeground', "Foreground color for the host indicator on the status bar."));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user