mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
Merge from vscode dbe62be3266ffb6772a7f3db0bf61d63f4aa7f65 (#9337)
This commit is contained in:
@@ -564,17 +564,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
||||
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
||||
},
|
||||
registerWebviewTextEditorProvider: (viewType: string, provider: vscode.WebviewTextEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
||||
registerCustomEditorProvider: (viewType: string, provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWebviews.registerWebviewTextEditorProvider(extension, viewType, provider, options);
|
||||
},
|
||||
registerWebviewCustomEditorProvider: (viewType: string, provider: vscode.WebviewCustomEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWebviews.registerWebviewCustomEditorProvider(extension, viewType, provider, options);
|
||||
},
|
||||
createWebviewEditorCustomDocument: <UserDataType>(viewType: string, resource: vscode.Uri, userData: UserDataType, capabilities: vscode.WebviewCustomEditorCapabilities) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostWebviews.createWebviewEditorCustomDocument<UserDataType>(viewType, resource, userData, capabilities);
|
||||
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options);
|
||||
},
|
||||
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
||||
checkProposedApiEnabled(extension);
|
||||
|
||||
@@ -127,12 +127,17 @@ export namespace DiagnosticTag {
|
||||
|
||||
export namespace Diagnostic {
|
||||
export function from(value: vscode.Diagnostic): IMarkerData {
|
||||
let code: string | { value: string; target: URI } | undefined = isString(value.code) || isNumber(value.code) ? String(value.code) : undefined;
|
||||
if (value.code2) {
|
||||
code = {
|
||||
value: String(value.code2.value),
|
||||
target: value.code2.target
|
||||
};
|
||||
let code: string | { value: string; target: URI } | undefined;
|
||||
|
||||
if (value.code) {
|
||||
if (isString(value.code) || isNumber(value.code)) {
|
||||
code = String(value.code);
|
||||
} else {
|
||||
code = {
|
||||
value: String(value.code.value),
|
||||
target: value.code.target,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -247,22 +247,30 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa
|
||||
|
||||
type EditType = unknown;
|
||||
|
||||
class WebviewEditorCustomDocument extends Disposable implements vscode.WebviewEditorCustomDocument {
|
||||
class WebviewEditorCustomDocument extends Disposable implements vscode.CustomDocument {
|
||||
private _currentEditIndex: number = -1;
|
||||
private _savePoint: number = -1;
|
||||
private readonly _edits: Array<EditType> = [];
|
||||
|
||||
public userData: unknown;
|
||||
|
||||
public _capabilities?: vscode.CustomEditorCapabilities = undefined;
|
||||
|
||||
constructor(
|
||||
private readonly _proxy: MainThreadWebviewsShape,
|
||||
public readonly viewType: string,
|
||||
public readonly uri: vscode.Uri,
|
||||
public readonly userData: unknown,
|
||||
public readonly _capabilities: vscode.WebviewCustomEditorCapabilities,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
// Hook up events
|
||||
_capabilities.editing?.onDidEdit(edit => {
|
||||
_setCapabilities(capabilities: vscode.CustomEditorCapabilities) {
|
||||
if (this._capabilities) {
|
||||
throw new Error('Capabilities already provided');
|
||||
}
|
||||
|
||||
this._capabilities = capabilities;
|
||||
capabilities.editing?.onDidEdit(edit => {
|
||||
this.pushEdit(edit, this);
|
||||
});
|
||||
}
|
||||
@@ -356,12 +364,12 @@ class WebviewEditorCustomDocument extends Disposable implements vscode.WebviewEd
|
||||
return this.getEditingCapability().saveAs(target);
|
||||
}
|
||||
|
||||
backup(cancellation: CancellationToken): boolean | PromiseLike<boolean> {
|
||||
throw new Error('Method not implemented.');
|
||||
backup(cancellation: CancellationToken) {
|
||||
return this.getEditingCapability().backup(cancellation);
|
||||
}
|
||||
|
||||
private getEditingCapability(): vscode.WebviewCustomEditorEditingCapability {
|
||||
if (!this._capabilities.editing) {
|
||||
private getEditingCapability(): vscode.CustomEditorEditingCapability {
|
||||
if (!this._capabilities?.editing) {
|
||||
throw new Error('Document is not editable');
|
||||
}
|
||||
return this._capabilities.editing;
|
||||
@@ -401,21 +409,21 @@ const enum WebviewEditorType {
|
||||
type ProviderEntry = {
|
||||
readonly extension: IExtensionDescription;
|
||||
readonly type: WebviewEditorType.Text;
|
||||
readonly provider: vscode.WebviewTextEditorProvider;
|
||||
readonly provider: vscode.CustomTextEditorProvider;
|
||||
} | {
|
||||
readonly extension: IExtensionDescription;
|
||||
readonly type: WebviewEditorType.Custom;
|
||||
readonly provider: vscode.WebviewCustomEditorProvider;
|
||||
readonly provider: vscode.CustomEditorProvider;
|
||||
};
|
||||
|
||||
class EditorProviderStore {
|
||||
private readonly _providers = new Map<string, ProviderEntry>();
|
||||
|
||||
public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.WebviewTextEditorProvider): vscode.Disposable {
|
||||
public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider): vscode.Disposable {
|
||||
return this.add(WebviewEditorType.Text, viewType, extension, provider);
|
||||
}
|
||||
|
||||
public addCustomProvider(viewType: string, extension: IExtensionDescription, provider: vscode.WebviewCustomEditorProvider): vscode.Disposable {
|
||||
public addCustomProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomEditorProvider): vscode.Disposable {
|
||||
return this.add(WebviewEditorType.Custom, viewType, extension, provider);
|
||||
}
|
||||
|
||||
@@ -423,7 +431,7 @@ class EditorProviderStore {
|
||||
return this._providers.get(viewType);
|
||||
}
|
||||
|
||||
private add(type: WebviewEditorType, viewType: string, extension: IExtensionDescription, provider: vscode.WebviewTextEditorProvider | vscode.WebviewCustomEditorProvider): vscode.Disposable {
|
||||
private add(type: WebviewEditorType, viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider | vscode.CustomEditorProvider): vscode.Disposable {
|
||||
if (this._providers.has(viewType)) {
|
||||
throw new Error(`Provider for viewType:${viewType} already registered`);
|
||||
}
|
||||
@@ -501,43 +509,26 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
});
|
||||
}
|
||||
|
||||
public registerWebviewTextEditorProvider(
|
||||
public registerCustomEditorProvider(
|
||||
extension: IExtensionDescription,
|
||||
viewType: string,
|
||||
provider: vscode.WebviewTextEditorProvider,
|
||||
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
||||
options: vscode.WebviewPanelOptions | undefined = {}
|
||||
): vscode.Disposable {
|
||||
const unregisterProvider = this._editorProviders.addTextProvider(viewType, extension, provider);
|
||||
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
||||
let disposable: vscode.Disposable;
|
||||
if ('resolveCustomTextEditor' in provider) {
|
||||
disposable = this._editorProviders.addTextProvider(viewType, extension, provider);
|
||||
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
||||
} else {
|
||||
disposable = this._editorProviders.addCustomProvider(viewType, extension, provider);
|
||||
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
||||
}
|
||||
|
||||
return new VSCodeDisposable(() => {
|
||||
unregisterProvider.dispose();
|
||||
this._proxy.$unregisterEditorProvider(viewType);
|
||||
});
|
||||
}
|
||||
|
||||
public registerWebviewCustomEditorProvider(
|
||||
extension: IExtensionDescription,
|
||||
viewType: string,
|
||||
provider: vscode.WebviewCustomEditorProvider,
|
||||
options: vscode.WebviewPanelOptions | undefined = {},
|
||||
): vscode.Disposable {
|
||||
const unregisterProvider = this._editorProviders.addCustomProvider(viewType, extension, provider);
|
||||
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
||||
|
||||
return new VSCodeDisposable(() => {
|
||||
unregisterProvider.dispose();
|
||||
this._proxy.$unregisterEditorProvider(viewType);
|
||||
});
|
||||
}
|
||||
|
||||
public createWebviewEditorCustomDocument<UserDataType>(
|
||||
viewType: string,
|
||||
resource: vscode.Uri,
|
||||
userData: UserDataType,
|
||||
capabilities: vscode.WebviewCustomEditorCapabilities,
|
||||
): vscode.WebviewEditorCustomDocument<UserDataType> {
|
||||
return Object.seal(new WebviewEditorCustomDocument(this._proxy, viewType, resource, userData, capabilities) as vscode.WebviewEditorCustomDocument<UserDataType>);
|
||||
return VSCodeDisposable.from(
|
||||
disposable,
|
||||
new VSCodeDisposable(() => {
|
||||
this._proxy.$unregisterEditorProvider(viewType);
|
||||
}));
|
||||
}
|
||||
|
||||
public $onMessage(
|
||||
@@ -631,10 +622,12 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
}
|
||||
|
||||
const revivedResource = URI.revive(resource);
|
||||
const document = await entry.provider.provideWebviewCustomEditorDocument(revivedResource) as WebviewEditorCustomDocument;
|
||||
const document = Object.seal(new WebviewEditorCustomDocument(this._proxy, viewType, revivedResource));
|
||||
const capabilities = await entry.provider.resolveCustomDocument(document);
|
||||
document._setCapabilities(capabilities);
|
||||
this._documents.add(document);
|
||||
return {
|
||||
editable: !!document._capabilities.editing
|
||||
editable: !!capabilities.editing
|
||||
};
|
||||
}
|
||||
|
||||
@@ -677,13 +670,13 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
case WebviewEditorType.Custom:
|
||||
{
|
||||
const document = this.getDocument(viewType, revivedResource);
|
||||
return entry.provider.resolveWebviewCustomEditor(document, revivedPanel);
|
||||
return entry.provider.resolveCustomEditor(document, revivedPanel);
|
||||
}
|
||||
case WebviewEditorType.Text:
|
||||
{
|
||||
await this._extHostDocuments.ensureDocumentData(revivedResource);
|
||||
const document = this._extHostDocuments.getDocument(revivedResource);
|
||||
return entry.provider.resolveWebviewTextEditor(document, revivedPanel);
|
||||
return entry.provider.resolveCustomTextEditor(document, revivedPanel);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
@@ -69,8 +69,8 @@ export class JSONValidationExtensionPoint {
|
||||
} catch (e) {
|
||||
collector.error(nls.localize('invalid.url.fileschema', "'configuration.jsonValidation.url' is an invalid relative URL: {0}", e.message));
|
||||
}
|
||||
} else if (!strings.startsWith(uri, 'https:/') && strings.startsWith(uri, 'https:/')) {
|
||||
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension"));
|
||||
} else if (!/^[^:/?#]+:\/\//.test(uri)) {
|
||||
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must be an absolute URL or start with './' to reference schemas located in the extension."));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -642,14 +642,13 @@ export abstract class BaseCloseAllAction extends Action {
|
||||
return;
|
||||
}
|
||||
|
||||
let saveOrRevert: boolean;
|
||||
if (confirm === ConfirmResult.DONT_SAVE) {
|
||||
saveOrRevert = await this.editorService.revertAll({ soft: true, includeUntitled: true });
|
||||
await this.editorService.revertAll({ soft: true, includeUntitled: true });
|
||||
} else {
|
||||
saveOrRevert = await this.editorService.saveAll({ reason: SaveReason.EXPLICIT, includeUntitled: true });
|
||||
await this.editorService.saveAll({ reason: SaveReason.EXPLICIT, includeUntitled: true });
|
||||
}
|
||||
|
||||
if (saveOrRevert) {
|
||||
if (!this.workingCopyService.hasDirty) {
|
||||
return this.doCloseAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/comm
|
||||
import { IEditorCommandsContext } from 'vs/workbench/common/editor';
|
||||
import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput';
|
||||
import { defaultEditorId } from 'vs/workbench/contrib/customEditor/browser/customEditors';
|
||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_CUSTOM_EDITORS, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import type { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
@@ -80,7 +80,7 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
||||
title: REOPEN_WITH_TITLE,
|
||||
category: viewCategory,
|
||||
},
|
||||
when: CONTEXT_HAS_CUSTOM_EDITORS,
|
||||
when: CONTEXT_CUSTOM_EDITORS.notEqualsTo(''),
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
@@ -89,9 +89,9 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
title: REOPEN_WITH_TITLE,
|
||||
category: viewCategory,
|
||||
},
|
||||
group: '3_open',
|
||||
group: '6_reopen',
|
||||
order: 20,
|
||||
when: CONTEXT_HAS_CUSTOM_EDITORS,
|
||||
when: CONTEXT_CUSTOM_EDITORS.notEqualsTo(''),
|
||||
});
|
||||
|
||||
// #endregion
|
||||
@@ -155,7 +155,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||
constructor() {
|
||||
super({
|
||||
id: ToggleCustomEditorCommand.ID,
|
||||
precondition: CONTEXT_HAS_CUSTOM_EDITORS,
|
||||
precondition: CONTEXT_CUSTOM_EDITORS,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { EditorInput, EditorOptions, IEditor, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
import { webviewEditorsExtensionPoint } from 'vs/workbench/contrib/customEditor/browser/extensionPoint';
|
||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, CustomEditorSelector, ICustomEditor, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_CUSTOM_EDITORS, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, CustomEditorSelector, ICustomEditor, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
||||
import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
@@ -98,7 +98,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||
|
||||
private readonly _models: CustomEditorModelManager;
|
||||
|
||||
private readonly _hasCustomEditor: IContextKey<boolean>;
|
||||
private readonly _customEditorContextKey: IContextKey<string>;
|
||||
private readonly _focusedCustomEditorIsEditable: IContextKey<boolean>;
|
||||
private readonly _webviewHasOwnEditFunctions: IContextKey<boolean>;
|
||||
|
||||
@@ -118,7 +118,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||
|
||||
this._models = new CustomEditorModelManager(workingCopyService, labelService);
|
||||
|
||||
this._hasCustomEditor = CONTEXT_HAS_CUSTOM_EDITORS.bindTo(contextKeyService);
|
||||
this._customEditorContextKey = CONTEXT_CUSTOM_EDITORS.bindTo(contextKeyService);
|
||||
this._focusedCustomEditorIsEditable = CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE.bindTo(contextKeyService);
|
||||
this._webviewHasOwnEditFunctions = webviewHasOwnEditFunctionsContext.bindTo(contextKeyService);
|
||||
|
||||
@@ -310,7 +310,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||
const activeControl = this.editorService.activeControl;
|
||||
const resource = activeControl?.input.resource;
|
||||
if (!resource) {
|
||||
this._hasCustomEditor.reset();
|
||||
this._customEditorContextKey.reset();
|
||||
this._focusedCustomEditorIsEditable.reset();
|
||||
this._webviewHasOwnEditFunctions.reset();
|
||||
return;
|
||||
@@ -320,7 +320,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||
...this.getContributedCustomEditors(resource).allEditors,
|
||||
...this.getUserConfiguredCustomEditors(resource).allEditors,
|
||||
];
|
||||
this._hasCustomEditor.set(possibleEditors.length > 0);
|
||||
this._customEditorContextKey.set(possibleEditors.map(x => x.id).join(','));
|
||||
this._focusedCustomEditorIsEditable.set(activeControl?.input instanceof CustomEditorInput);
|
||||
this._webviewHasOwnEditFunctions.set(possibleEditors.length > 0);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ interface IWebviewEditorsExtensionPoint {
|
||||
}
|
||||
|
||||
const webviewEditorsContribution: IJSONSchema = {
|
||||
description: nls.localize('contributes.webviewEditors', 'Contributes webview editors.'),
|
||||
description: nls.localize('contributes.customEditors', 'Contributed custom editors.'),
|
||||
type: 'array',
|
||||
defaultSnippets: [{ body: [{ viewType: '', displayName: '' }] }],
|
||||
items: {
|
||||
@@ -76,7 +76,7 @@ const webviewEditorsContribution: IJSONSchema = {
|
||||
};
|
||||
|
||||
export const webviewEditorsExtensionPoint = ExtensionsRegistry.registerExtensionPoint<IWebviewEditorsExtensionPoint[]>({
|
||||
extensionPoint: 'webviewEditors',
|
||||
extensionPoint: 'customEditors',
|
||||
deps: [languagesExtPoint],
|
||||
jsonSchema: webviewEditorsContribution
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import { IWorkingCopy } from 'vs/workbench/services/workingCopy/common/workingCo
|
||||
|
||||
export const ICustomEditorService = createDecorator<ICustomEditorService>('customEditorService');
|
||||
|
||||
export const CONTEXT_HAS_CUSTOM_EDITORS = new RawContextKey<boolean>('hasCustomEditors', false);
|
||||
export const CONTEXT_CUSTOM_EDITORS = new RawContextKey<string>('customEditors', '');
|
||||
export const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = new RawContextKey<boolean>('focusedCustomEditorIsEditable', false);
|
||||
|
||||
export interface ICustomEditor {
|
||||
|
||||
@@ -1082,7 +1082,7 @@ export class ExtensionEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
private renderCustomEditors(container: HTMLElement, manifest: IExtensionManifest, onDetailsToggle: Function): boolean {
|
||||
const webviewEditors = manifest.contributes?.webviewEditors || [];
|
||||
const webviewEditors = manifest.contributes?.customEditors || [];
|
||||
if (!webviewEditors.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -621,8 +621,6 @@ export class RepositoryPane extends ViewPane {
|
||||
protected contextKeyService: IContextKeyService;
|
||||
private commitTemplate = '';
|
||||
|
||||
shouldShowWelcome() { return true; }
|
||||
|
||||
constructor(
|
||||
readonly repository: ISCMRepository,
|
||||
options: IViewPaneOptions,
|
||||
|
||||
@@ -141,6 +141,15 @@ export class Match {
|
||||
return thisMatchPreviewLines.join('\n');
|
||||
}
|
||||
|
||||
rangeInPreview() {
|
||||
// convert to editor's base 1 positions.
|
||||
return {
|
||||
...this._fullPreviewRange,
|
||||
startColumn: this._fullPreviewRange.startColumn + 1,
|
||||
endColumn: this._fullPreviewRange.endColumn + 1
|
||||
};
|
||||
}
|
||||
|
||||
fullPreviewLines(): string[] {
|
||||
return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber, this._fullPreviewRange.endLineNumber + 1);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export const ToggleSearchEditorWholeWordCommandId = 'toggleSearchEditorWholeWord
|
||||
export const ToggleSearchEditorRegexCommandId = 'toggleSearchEditorRegex';
|
||||
export const ToggleSearchEditorContextLinesCommandId = 'toggleSearchEditorContextLines';
|
||||
export const RerunSearchEditorSearchCommandId = 'rerunSearchEditorSearch';
|
||||
export const CleanSearchEditorStateCommandId = 'cleanSearchEditorState';
|
||||
export const SelectAllSearchEditorMatchesCommandId = 'selectAllSearchEditorMatches';
|
||||
|
||||
export const InSearchEditor = new RawContextKey<boolean>('inSearchEditor', false);
|
||||
|
||||
@@ -162,6 +162,15 @@ CommandsRegistry.registerCommand(
|
||||
activeControl.triggerSearch({ resetCursor: false });
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand(
|
||||
SearchEditorConstants.CleanSearchEditorStateCommandId,
|
||||
(accessor: ServicesAccessor) => {
|
||||
const activeControl = accessor.get(IEditorService).activeControl;
|
||||
if (activeControl instanceof SearchEditor) {
|
||||
activeControl.cleanState();
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region Actions
|
||||
|
||||
@@ -297,6 +297,10 @@ export class SearchEditor extends BaseTextEditor {
|
||||
this.toggleIncludesExcludes();
|
||||
}
|
||||
|
||||
cleanState() {
|
||||
this.getInput()?.setDirty(false);
|
||||
}
|
||||
|
||||
private get searchConfig(): ISearchConfigurationProperties {
|
||||
return this.configurationService.getValue<ISearchConfigurationProperties>('search');
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ const matchToSearchResultFormat = (match: Match): { line: string, ranges: Range[
|
||||
|
||||
const rangeOnThisLine = ({ start, end }: { start?: number; end?: number; }) => new Range(1, (start ?? 1) + prefixOffset, 1, (end ?? sourceLine.length + 1) + prefixOffset);
|
||||
|
||||
const matchRange = match.range();
|
||||
const matchRange = match.rangeInPreview();
|
||||
const matchIsSingleLine = matchRange.startLineNumber === matchRange.endLineNumber;
|
||||
|
||||
let lineRange;
|
||||
@@ -211,9 +211,12 @@ export const serializeSearchResultForEditor =
|
||||
? contentPatternToSearchResultHeader(searchResult.query, rawIncludePattern, rawExcludePattern, contextLines)
|
||||
: [];
|
||||
|
||||
const filecount = searchResult.fileCount() > 1 ? localize('numFiles', "{0} files", searchResult.fileCount()) : localize('oneFile', "1 file");
|
||||
const resultcount = searchResult.count() > 1 ? localize('numResults', "{0} results", searchResult.count()) : localize('oneResult', "1 result");
|
||||
|
||||
const info = [
|
||||
searchResult.count()
|
||||
? localize('resultCount', "{0} results in {1} files", searchResult.count(), searchResult.fileCount())
|
||||
? `${filecount} - ${resultcount}`
|
||||
: localize('noResults', "No Results"),
|
||||
''];
|
||||
|
||||
|
||||
@@ -602,8 +602,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
// Respect chords if the allowChords setting is set and it's not Escape. Escape is
|
||||
// handled specially for Zen Mode's Escape, Escape chord, plus it's important in
|
||||
// terminals generally
|
||||
const allowChords = resolveResult && resolveResult.enterChord && this._configHelper.config.allowChords && event.key !== 'Escape';
|
||||
if (allowChords || resolveResult && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) {
|
||||
const allowChords = resolveResult?.enterChord && this._configHelper.config.allowChords && event.key !== 'Escape';
|
||||
if (this._keybindingService.inChordMode || allowChords || resolveResult && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ import { MenuItemAction, IMenuService, MenuId } from 'vs/platform/actions/common
|
||||
import { fromNow } from 'vs/base/common/date';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
// TODO[ECA]: Localize all the strings
|
||||
|
||||
const InitialPageSize = 20;
|
||||
const SubsequentPageSize = 40;
|
||||
|
||||
@@ -240,7 +238,7 @@ export class TimelinePane extends ViewPane {
|
||||
|
||||
// TODO[ECA]: Are these the right the list of schemes to exclude? Is there a better way?
|
||||
if (this._uri && (this._uri.scheme === 'vscode-settings' || this._uri.scheme === 'webview-panel' || this._uri.scheme === 'walkThrough')) {
|
||||
this.message = 'The active editor cannot provide timeline information.';
|
||||
this.message = localize('timeline.editorCannotProvideTimeline', 'The active editor cannot provide timeline information.');
|
||||
this._tree.setChildren(null, undefined);
|
||||
|
||||
return;
|
||||
@@ -253,7 +251,7 @@ export class TimelinePane extends ViewPane {
|
||||
}
|
||||
|
||||
this._tree.setChildren(null, undefined);
|
||||
this.message = `Loading timeline for ${basename(uri.fsPath)}...`;
|
||||
this.message = localize('timeline.loading', 'Loading timeline for ${0}...', basename(uri.fsPath));
|
||||
}, 500, this._uri);
|
||||
}
|
||||
}
|
||||
@@ -410,7 +408,7 @@ export class TimelinePane extends ViewPane {
|
||||
this._items.push({
|
||||
element: {
|
||||
handle: 'vscode-command:loadMore',
|
||||
label: 'Load more',
|
||||
label: localize('timeline.loadMore', 'Load more'),
|
||||
timestamp: 0
|
||||
} as CommandItem
|
||||
});
|
||||
@@ -512,7 +510,7 @@ export class TimelinePane extends ViewPane {
|
||||
}
|
||||
|
||||
if (this._items.length === 0) {
|
||||
this.message = 'No timeline information was provided.';
|
||||
this.message = localize('timeline.noTimelineInfo', 'No timeline information was provided.');
|
||||
} else {
|
||||
this.message = undefined;
|
||||
}
|
||||
@@ -556,7 +554,7 @@ export class TimelinePane extends ViewPane {
|
||||
this._messageElement = DOM.append(this._container, DOM.$('.message'));
|
||||
DOM.addClass(this._messageElement, 'timeline-subtle');
|
||||
|
||||
this.message = 'The active editor cannot provide timeline information.';
|
||||
this.message = localize('timeline.editorCannotProvideTimeline', 'The active editor cannot provide timeline information.');
|
||||
|
||||
this._treeElement = document.createElement('div');
|
||||
DOM.addClasses(this._treeElement, 'customview-tree', 'file-icon-themable-tree', 'hide-arrows');
|
||||
|
||||
@@ -3,50 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { UserDataSyncWorkbenchContribution } from 'vs/workbench/contrib/userDataSync/browser/userDataSync';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IUserDataSyncEnablementService, getUserDataSyncStore } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
class UserDataSyncSettingsMigrationContribution implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IProductService productService: IProductService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IUserDataSyncEnablementService userDataSyncEnablementService: IUserDataSyncEnablementService,
|
||||
) {
|
||||
if (getUserDataSyncStore(productService, configurationService)) {
|
||||
if (!configurationService.getValue('sync.enableSettings')) {
|
||||
userDataSyncEnablementService.setResourceEnablement('settings', false);
|
||||
}
|
||||
if (!configurationService.getValue('sync.enableKeybindings')) {
|
||||
userDataSyncEnablementService.setResourceEnablement('keybindings', false);
|
||||
}
|
||||
if (!configurationService.getValue('sync.enableUIState')) {
|
||||
userDataSyncEnablementService.setResourceEnablement('globalState', false);
|
||||
}
|
||||
if (!configurationService.getValue('sync.enableExtensions')) {
|
||||
userDataSyncEnablementService.setResourceEnablement('extensions', false);
|
||||
}
|
||||
if (configurationService.getValue('sync.enable')) {
|
||||
userDataSyncEnablementService.setEnablement(true);
|
||||
}
|
||||
this.removeFromConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private async removeFromConfiguration(): Promise<void> {
|
||||
await this.configurationService.updateValue('sync.enable', undefined, {}, ConfigurationTarget.USER, true);
|
||||
await this.configurationService.updateValue('sync.enableSettings', undefined, {}, ConfigurationTarget.USER, true);
|
||||
await this.configurationService.updateValue('sync.enableKeybindings', undefined, {}, ConfigurationTarget.USER, true);
|
||||
await this.configurationService.updateValue('sync.enableUIState', undefined, {}, ConfigurationTarget.USER, true);
|
||||
await this.configurationService.updateValue('sync.enableExtensions', undefined, {}, ConfigurationTarget.USER, true);
|
||||
}
|
||||
}
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(UserDataSyncWorkbenchContribution, LifecyclePhase.Ready);
|
||||
workbenchRegistry.registerWorkbenchContribution(UserDataSyncSettingsMigrationContribution, LifecyclePhase.Ready);
|
||||
|
||||
Reference in New Issue
Block a user