mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
This reverts commit 6bd0a17d3c.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
"icon": "media/icon.png",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"engines": {
|
||||
"vscode": "^1.5.0"
|
||||
},
|
||||
@@ -77,7 +77,6 @@
|
||||
"title": "%command.next%",
|
||||
"original": "Next Conflict",
|
||||
"command": "merge-conflict.next",
|
||||
"enablement": "!isMergeEditor",
|
||||
"icon": "$(arrow-down)"
|
||||
},
|
||||
{
|
||||
@@ -85,7 +84,6 @@
|
||||
"title": "%command.previous%",
|
||||
"original": "Previous Conflict",
|
||||
"command": "merge-conflict.previous",
|
||||
"enablement": "!isMergeEditor",
|
||||
"icon": "$(arrow-up)"
|
||||
},
|
||||
{
|
||||
@@ -112,12 +110,12 @@
|
||||
{
|
||||
"command": "merge-conflict.previous",
|
||||
"group": "navigation@1",
|
||||
"when": "!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"
|
||||
"when": "mergeConflictsCount && mergeConflictsCount != 0"
|
||||
},
|
||||
{
|
||||
"command": "merge-conflict.next",
|
||||
"group": "navigation@2",
|
||||
"when": "!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"
|
||||
"when": "mergeConflictsCount && mergeConflictsCount != 0"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class MergeConflictCodeLensProvider implements vscode.CodeLensPro
|
||||
return null;
|
||||
}
|
||||
|
||||
const conflicts = await this.tracker.getConflicts(document);
|
||||
let conflicts = await this.tracker.getConflicts(document);
|
||||
const conflictsCount = conflicts?.length ?? 0;
|
||||
vscode.commands.executeCommand('setContext', 'mergeConflictsCount', conflictsCount);
|
||||
|
||||
@@ -60,28 +60,28 @@ export default class MergeConflictCodeLensProvider implements vscode.CodeLensPro
|
||||
return null;
|
||||
}
|
||||
|
||||
const items: vscode.CodeLens[] = [];
|
||||
let items: vscode.CodeLens[] = [];
|
||||
|
||||
conflicts.forEach(conflict => {
|
||||
const acceptCurrentCommand: vscode.Command = {
|
||||
let acceptCurrentCommand: vscode.Command = {
|
||||
command: 'merge-conflict.accept.current',
|
||||
title: localize('acceptCurrentChange', 'Accept Current Change'),
|
||||
arguments: ['known-conflict', conflict]
|
||||
};
|
||||
|
||||
const acceptIncomingCommand: vscode.Command = {
|
||||
let acceptIncomingCommand: vscode.Command = {
|
||||
command: 'merge-conflict.accept.incoming',
|
||||
title: localize('acceptIncomingChange', 'Accept Incoming Change'),
|
||||
arguments: ['known-conflict', conflict]
|
||||
};
|
||||
|
||||
const acceptBothCommand: vscode.Command = {
|
||||
let acceptBothCommand: vscode.Command = {
|
||||
command: 'merge-conflict.accept.both',
|
||||
title: localize('acceptBothChanges', 'Accept Both Changes'),
|
||||
arguments: ['known-conflict', conflict]
|
||||
};
|
||||
|
||||
const diffCommand: vscode.Command = {
|
||||
let diffCommand: vscode.Command = {
|
||||
command: 'merge-conflict.compare',
|
||||
title: localize('compareChanges', 'Compare Changes'),
|
||||
arguments: [conflict]
|
||||
|
||||
@@ -107,8 +107,8 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
|
||||
const scheme = editor.document.uri.scheme;
|
||||
let range = conflict.current.content;
|
||||
const leftRanges = conflicts.map(conflict => [conflict.current.content, conflict.range]);
|
||||
const rightRanges = conflicts.map(conflict => [conflict.incoming.content, conflict.range]);
|
||||
let leftRanges = conflicts.map(conflict => [conflict.current.content, conflict.range]);
|
||||
let rightRanges = conflicts.map(conflict => [conflict.incoming.content, conflict.range]);
|
||||
|
||||
const leftUri = editor.document.uri.with({
|
||||
scheme: ContentProvider.scheme,
|
||||
@@ -120,7 +120,7 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
const rightUri = leftUri.with({ query: JSON.stringify({ scheme, ranges: rightRanges }) });
|
||||
|
||||
let mergeConflictLineOffsets = 0;
|
||||
for (const nextconflict of conflicts) {
|
||||
for (let nextconflict of conflicts) {
|
||||
if (nextconflict.range.isEqual(conflict.range)) {
|
||||
break;
|
||||
} else {
|
||||
@@ -158,7 +158,7 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
}
|
||||
|
||||
async acceptSelection(editor: vscode.TextEditor): Promise<void> {
|
||||
const conflict = await this.findConflictContainingSelection(editor);
|
||||
let conflict = await this.findConflictContainingSelection(editor);
|
||||
|
||||
if (!conflict) {
|
||||
vscode.window.showWarningMessage(localize('cursorNotInConflict', 'Editor cursor is not within a merge conflict'));
|
||||
@@ -202,7 +202,7 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
}
|
||||
|
||||
private async navigate(editor: vscode.TextEditor, direction: NavigationDirection): Promise<void> {
|
||||
const navigationResult = await this.findConflictForNavigation(editor, direction);
|
||||
let navigationResult = await this.findConflictForNavigation(editor, direction);
|
||||
|
||||
if (!navigationResult) {
|
||||
// Check for autoNavigateNextConflict, if it's enabled(which indicating no conflict remain), then do not show warning
|
||||
@@ -258,7 +258,7 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
}
|
||||
|
||||
private async acceptAll(type: interfaces.CommitType, editor: vscode.TextEditor): Promise<void> {
|
||||
const conflicts = await this.tracker.getConflicts(editor.document);
|
||||
let conflicts = await this.tracker.getConflicts(editor.document);
|
||||
|
||||
if (!conflicts || conflicts.length === 0) {
|
||||
vscode.window.showWarningMessage(localize('noConflicts', 'No merge conflicts found in this file'));
|
||||
@@ -323,7 +323,7 @@ export default class CommandHandler implements vscode.Disposable {
|
||||
return null;
|
||||
}
|
||||
|
||||
const selection = editor.selection.active;
|
||||
let selection = editor.selection.active;
|
||||
if (conflicts.length === 1) {
|
||||
if (conflicts[0].range.contains(selection)) {
|
||||
return {
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class MergeConflictContentProvider implements vscode.TextDocument
|
||||
let lastPosition = new vscode.Position(0, 0);
|
||||
|
||||
ranges.forEach(rangeObj => {
|
||||
const [conflictRange, fullRange] = rangeObj;
|
||||
let [conflictRange, fullRange] = rangeObj;
|
||||
const [start, end] = conflictRange;
|
||||
const [fullStart, fullEnd] = fullRange;
|
||||
|
||||
@@ -41,7 +41,7 @@ export default class MergeConflictContentProvider implements vscode.TextDocument
|
||||
lastPosition = new vscode.Position(fullEnd.line, fullEnd.character);
|
||||
});
|
||||
|
||||
const documentEnd = document.lineAt(document.lineCount - 1).range.end;
|
||||
let documentEnd = document.lineAt(document.lineCount - 1).range.end;
|
||||
text += document.getText(new vscode.Range(lastPosition.line, lastPosition.character, documentEnd.line, documentEnd.character));
|
||||
|
||||
return text;
|
||||
|
||||
@@ -35,7 +35,7 @@ export class Delayer<T> {
|
||||
}).then(() => {
|
||||
this.completionPromise = null;
|
||||
this.onSuccess = null;
|
||||
const result = this.task!();
|
||||
let result = this.task!();
|
||||
this.task = null;
|
||||
return result;
|
||||
});
|
||||
@@ -56,7 +56,7 @@ export class Delayer<T> {
|
||||
return null;
|
||||
}
|
||||
this.cancelTimeout();
|
||||
const result = this.completionPromise;
|
||||
let result = this.completionPromise;
|
||||
this.onSuccess!(undefined);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ export class DocumentMergeConflict implements interfaces.IDocumentMergeConflict
|
||||
// ]
|
||||
if (type === interfaces.CommitType.Current) {
|
||||
// Replace [ Conflict Range ] with [ Current Content ]
|
||||
const content = document.getText(this.current.content);
|
||||
let content = document.getText(this.current.content);
|
||||
this.replaceRangeWithContent(content, edit);
|
||||
}
|
||||
else if (type === interfaces.CommitType.Incoming) {
|
||||
const content = document.getText(this.incoming.content);
|
||||
let content = document.getText(this.incoming.content);
|
||||
this.replaceRangeWithContent(content, edit);
|
||||
}
|
||||
else if (type === interfaces.CommitType.Both) {
|
||||
|
||||
@@ -50,7 +50,7 @@ export default class DocumentMergeConflictTracker implements vscode.Disposable,
|
||||
getConflicts(document: vscode.TextDocument, origin: string): PromiseLike<interfaces.IDocumentMergeConflict[]> {
|
||||
// Attempt from cache
|
||||
|
||||
const key = this.getCacheKey(document);
|
||||
let key = this.getCacheKey(document);
|
||||
|
||||
if (!key) {
|
||||
// Document doesn't have a uri, can't cache it, so return
|
||||
@@ -67,9 +67,11 @@ export default class DocumentMergeConflictTracker implements vscode.Disposable,
|
||||
}
|
||||
|
||||
return cacheItem.delayTask.trigger(() => {
|
||||
const conflicts = this.getConflictsOrEmpty(document, Array.from(cacheItem!.origins));
|
||||
let conflicts = this.getConflictsOrEmpty(document, Array.from(cacheItem!.origins));
|
||||
|
||||
this.cache?.delete(key!);
|
||||
if (this.cache) {
|
||||
this.cache.delete(key!);
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
});
|
||||
@@ -80,7 +82,7 @@ export default class DocumentMergeConflictTracker implements vscode.Disposable,
|
||||
return false;
|
||||
}
|
||||
|
||||
const key = this.getCacheKey(document);
|
||||
let key = this.getCacheKey(document);
|
||||
if (!key) {
|
||||
return false;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ export default class DocumentMergeConflictTracker implements vscode.Disposable,
|
||||
}
|
||||
|
||||
forget(document: vscode.TextDocument) {
|
||||
const key = this.getCacheKey(document);
|
||||
let key = this.getCacheKey(document);
|
||||
|
||||
if (key) {
|
||||
this.cache.delete(key);
|
||||
|
||||
@@ -67,7 +67,7 @@ export class MergeConflictParser {
|
||||
|
||||
// Create a full descriptor from the lines that we matched. This can return
|
||||
// null if the descriptor could not be completed.
|
||||
const completeDescriptor = MergeConflictParser.scanItemTolMergeConflictDescriptor(document, currentConflict);
|
||||
let completeDescriptor = MergeConflictParser.scanItemTolMergeConflictDescriptor(document, currentConflict);
|
||||
|
||||
if (completeDescriptor !== null) {
|
||||
conflictDescriptors.push(completeDescriptor);
|
||||
@@ -90,7 +90,7 @@ export class MergeConflictParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
const tokenAfterCurrentBlock: vscode.TextLine = scanned.commonAncestors[0] || scanned.splitter;
|
||||
let tokenAfterCurrentBlock: vscode.TextLine = scanned.commonAncestors[0] || scanned.splitter;
|
||||
|
||||
// Assume that descriptor.current.header, descriptor.incoming.header and descriptor.splitter
|
||||
// have valid ranges, fill in content and total ranges from these parts.
|
||||
@@ -110,7 +110,7 @@ export class MergeConflictParser {
|
||||
name: scanned.startHeader.text.substring(startHeaderMarker.length + 1)
|
||||
},
|
||||
commonAncestors: scanned.commonAncestors.map((currentTokenLine, index, commonAncestors) => {
|
||||
const nextTokenLine = commonAncestors[index + 1] || scanned.splitter;
|
||||
let nextTokenLine = commonAncestors[index + 1] || scanned.splitter;
|
||||
return {
|
||||
header: currentTokenLine.range,
|
||||
decoratorContent: new vscode.Range(
|
||||
@@ -146,7 +146,7 @@ export class MergeConflictParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
const text = document.getText();
|
||||
let text = document.getText();
|
||||
return text.includes(startHeaderMarker) && text.includes(endFooterMarker);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
|
||||
private generateBlockRenderOptions(backgroundColor: string, overviewRulerColor: string, config: interfaces.IExtensionConfiguration): vscode.DecorationRenderOptions {
|
||||
|
||||
const renderOptions: vscode.DecorationRenderOptions = {};
|
||||
let renderOptions: vscode.DecorationRenderOptions = {};
|
||||
|
||||
if (config.enableDecorations) {
|
||||
renderOptions.backgroundColor = new vscode.ThemeColor(backgroundColor);
|
||||
@@ -176,7 +176,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
try {
|
||||
this.updating.set(editor, true);
|
||||
|
||||
const conflicts = await this.tracker.getConflicts(editor.document);
|
||||
let conflicts = await this.tracker.getConflicts(editor.document);
|
||||
if (vscode.window.visibleTextEditors.indexOf(editor) === -1) {
|
||||
return;
|
||||
}
|
||||
@@ -188,9 +188,9 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
|
||||
// Store decorations keyed by the type of decoration, set decoration wants a "style"
|
||||
// to go with it, which will match this key (see constructor);
|
||||
const matchDecorations: { [key: string]: vscode.Range[] } = {};
|
||||
let matchDecorations: { [key: string]: vscode.Range[] } = {};
|
||||
|
||||
const pushDecoration = (key: string, d: vscode.Range) => {
|
||||
let pushDecoration = (key: string, d: vscode.Range) => {
|
||||
matchDecorations[key] = matchDecorations[key] || [];
|
||||
matchDecorations[key].push(d);
|
||||
};
|
||||
@@ -224,7 +224,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
// For each match we've generated, apply the generated decoration with the matching decoration type to the
|
||||
// editor instance. Keys in both matches and decorations should match.
|
||||
Object.keys(matchDecorations).forEach(decorationKey => {
|
||||
const decorationType = this.decorations[decorationKey];
|
||||
let decorationType = this.decorations[decorationKey];
|
||||
|
||||
if (decorationType) {
|
||||
editor.setDecorations(decorationType, matchDecorations[decorationKey]);
|
||||
@@ -242,7 +242,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
|
||||
// Race condition, while editing the settings, it's possible to
|
||||
// generate regions before the configuration has been refreshed
|
||||
const decorationType = this.decorations[decorationKey];
|
||||
let decorationType = this.decorations[decorationKey];
|
||||
|
||||
if (decorationType) {
|
||||
editor.setDecorations(decorationType, []);
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class ServiceWrapper implements vscode.Disposable {
|
||||
|
||||
begin() {
|
||||
|
||||
const configuration = this.createExtensionConfiguration();
|
||||
let configuration = this.createExtensionConfiguration();
|
||||
const documentTracker = new DocumentTracker();
|
||||
|
||||
this.services.push(
|
||||
@@ -48,19 +48,6 @@ export default class ServiceWrapper implements vscode.Disposable {
|
||||
}
|
||||
|
||||
createExtensionConfiguration(): interfaces.IExtensionConfiguration {
|
||||
|
||||
// PRAGMATIC way to avoid conflicting with the new merge editor: when git opts into
|
||||
// using the merge editor we disable this extension - for the merge editor but also
|
||||
// for "other" editors
|
||||
const gitConfig = vscode.workspace.getConfiguration('git');
|
||||
if (gitConfig.get<boolean>('mergeEditor')) {
|
||||
return {
|
||||
enableCodeLens: false,
|
||||
enableDecorations: false,
|
||||
enableEditorOverview: false
|
||||
};
|
||||
}
|
||||
|
||||
const workspaceConfiguration = vscode.workspace.getConfiguration(ConfigurationSectionName);
|
||||
const codeLensEnabled: boolean = workspaceConfiguration.get('codeLens.enabled', true);
|
||||
const decoratorsEnabled: boolean = workspaceConfiguration.get('decorators.enabled', true);
|
||||
@@ -77,3 +64,4 @@ export default class ServiceWrapper implements vscode.Disposable {
|
||||
this.services = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user