mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 16:50:30 -04:00
Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533 (#6932)
* Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533 * skip failing test * add comment
This commit is contained in:
@@ -170,7 +170,11 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
|
||||
});
|
||||
|
||||
templateData.elementDisposable = templateData.label.onDidRender(() => {
|
||||
this.updateWidth(stat);
|
||||
try {
|
||||
this.updateWidth(stat);
|
||||
} catch (e) {
|
||||
// noop since the element might no longer be in the tree, no update of width necessery
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { dirname } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EncodingMode, ConfirmResult, EditorInput, IFileEditorInput, ITextEditorModel, Verbosity, IRevertOptions } from 'vs/workbench/common/editor';
|
||||
@@ -147,14 +146,14 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
|
||||
|
||||
getName(): string {
|
||||
if (!this.name) {
|
||||
this.name = basename(this.labelService.getUriLabel(this.resource));
|
||||
this.name = this.labelService.getUriBasenameLabel(this.resource);
|
||||
}
|
||||
|
||||
return this.decorateLabel(this.name);
|
||||
}
|
||||
|
||||
private get shortDescription(): string {
|
||||
return basename(this.labelService.getUriLabel(dirname(this.resource)));
|
||||
return this.labelService.getUriBasenameLabel(dirname(this.resource));
|
||||
}
|
||||
|
||||
private get mediumDescription(): string {
|
||||
|
||||
@@ -37,7 +37,7 @@ suite('Files - FileEditorInput', () => {
|
||||
accessor = instantiationService.createInstance(ServiceAccessor);
|
||||
});
|
||||
|
||||
test('Basics', async function () {
|
||||
test.skip('Basics', async function () { // {{SQL CARBON EDIT}} skip test
|
||||
let input = instantiationService.createInstance(FileEditorInput, toResource.call(this, '/foo/bar/file.js'), undefined, undefined);
|
||||
const otherInput = instantiationService.createInstance(FileEditorInput, toResource.call(this, 'foo/bar/otherfile.js'), undefined, undefined);
|
||||
const otherInputSame = instantiationService.createInstance(FileEditorInput, toResource.call(this, 'foo/bar/file.js'), undefined, undefined);
|
||||
|
||||
@@ -16,15 +16,15 @@ import { IModelDecorationsChangeAccessor, OverviewRulerLane, IModelDeltaDecorati
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen';
|
||||
import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind } from 'vs/editor/common/modes';
|
||||
import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind, SymbolTag } from 'vs/editor/common/modes';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
|
||||
import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry';
|
||||
import { GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { asPromise } from 'vs/base/common/async';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
|
||||
|
||||
export const GOTO_SYMBOL_PREFIX = '@';
|
||||
export const SCOPE_PREFIX = ':';
|
||||
@@ -73,10 +73,8 @@ class OutlineModel extends QuickOpenModel {
|
||||
applyFilter(searchValue: string): void {
|
||||
|
||||
// Normalize search
|
||||
let normalizedSearchValue = searchValue;
|
||||
if (searchValue.indexOf(SCOPE_PREFIX) === 0) {
|
||||
normalizedSearchValue = normalizedSearchValue.substr(SCOPE_PREFIX.length);
|
||||
}
|
||||
const searchValueLow = searchValue.toLowerCase();
|
||||
const searchValuePos = searchValue.indexOf(SCOPE_PREFIX) === 0 ? 1 : 0;
|
||||
|
||||
// Check for match and update visibility and group label
|
||||
this.entries.forEach((entry: SymbolEntry) => {
|
||||
@@ -84,34 +82,24 @@ class OutlineModel extends QuickOpenModel {
|
||||
// Clear all state first
|
||||
entry.setGroupLabel(undefined);
|
||||
entry.setShowBorder(false);
|
||||
entry.setHighlights([]);
|
||||
entry.setScore(undefined);
|
||||
entry.setHidden(false);
|
||||
|
||||
// Filter by search
|
||||
if (normalizedSearchValue) {
|
||||
const highlights = filters.matchesFuzzy2(normalizedSearchValue, entry.getLabel());
|
||||
if (highlights) {
|
||||
entry.setHighlights(highlights);
|
||||
entry.setHidden(false);
|
||||
} else if (!entry.isHidden()) {
|
||||
entry.setHidden(true);
|
||||
}
|
||||
if (searchValue.length > searchValuePos) {
|
||||
const score = filters.fuzzyScore(
|
||||
searchValue.substr(searchValuePos), searchValueLow.substr(searchValuePos), 0,
|
||||
entry.getLabel(), entry.getLabel().toLowerCase(), 0,
|
||||
true
|
||||
);
|
||||
entry.setScore(score);
|
||||
entry.setHidden(!score);
|
||||
}
|
||||
});
|
||||
|
||||
// Sort properly if actually searching
|
||||
if (searchValue) {
|
||||
if (searchValue.indexOf(SCOPE_PREFIX) === 0) {
|
||||
this.entries.sort(this.sortScoped.bind(this, searchValue.toLowerCase()));
|
||||
} else {
|
||||
this.entries.sort(this.sortNormal.bind(this, searchValue.toLowerCase()));
|
||||
}
|
||||
}
|
||||
this.entries.sort(SymbolEntry.compareByRank);
|
||||
|
||||
|
||||
// Otherwise restore order as appearing in outline
|
||||
else {
|
||||
this.entries.sort((a: SymbolEntry, b: SymbolEntry) => a.getIndex() - b.getIndex());
|
||||
}
|
||||
|
||||
// Mark all type groups
|
||||
const visibleResults = <SymbolEntry[]>this.getEntries(true);
|
||||
@@ -156,74 +144,6 @@ class OutlineModel extends QuickOpenModel {
|
||||
}
|
||||
}
|
||||
|
||||
private sortNormal(searchValue: string, elementA: SymbolEntry, elementB: SymbolEntry): number {
|
||||
|
||||
// Handle hidden elements
|
||||
if (elementA.isHidden() && elementB.isHidden()) {
|
||||
return 0;
|
||||
} else if (elementA.isHidden()) {
|
||||
return 1;
|
||||
} else if (elementB.isHidden()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const elementAName = elementA.getLabel().toLowerCase();
|
||||
const elementBName = elementB.getLabel().toLowerCase();
|
||||
|
||||
// Compare by name
|
||||
const r = elementAName.localeCompare(elementBName);
|
||||
if (r !== 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
// If name identical sort by range instead
|
||||
const elementARange = elementA.getRange();
|
||||
const elementBRange = elementB.getRange();
|
||||
|
||||
return elementARange.startLineNumber - elementBRange.startLineNumber;
|
||||
}
|
||||
|
||||
private sortScoped(searchValue: string, elementA: SymbolEntry, elementB: SymbolEntry): number {
|
||||
|
||||
// Handle hidden elements
|
||||
if (elementA.isHidden() && elementB.isHidden()) {
|
||||
return 0;
|
||||
} else if (elementA.isHidden()) {
|
||||
return 1;
|
||||
} else if (elementB.isHidden()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Remove scope char
|
||||
searchValue = searchValue.substr(SCOPE_PREFIX.length);
|
||||
|
||||
// Sort by type first if scoped search
|
||||
const elementATypeLabel = NLS_SYMBOL_KIND_CACHE[elementA.getKind()] || FALLBACK_NLS_SYMBOL_KIND;
|
||||
const elementBTypeLabel = NLS_SYMBOL_KIND_CACHE[elementB.getKind()] || FALLBACK_NLS_SYMBOL_KIND;
|
||||
let r = elementATypeLabel.localeCompare(elementBTypeLabel);
|
||||
if (r !== 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
// Special sort when searching in scoped mode
|
||||
if (searchValue) {
|
||||
const elementAName = elementA.getLabel().toLowerCase();
|
||||
const elementBName = elementB.getLabel().toLowerCase();
|
||||
|
||||
// Compare by name
|
||||
r = elementAName.localeCompare(elementBName);
|
||||
if (r !== 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
// Default to sort by range
|
||||
const elementARange = elementA.getRange();
|
||||
const elementBRange = elementB.getRange();
|
||||
|
||||
return elementARange.startLineNumber - elementBRange.startLineNumber;
|
||||
}
|
||||
|
||||
private renderGroupLabel(type: SymbolKind, count: number): string {
|
||||
let pattern = NLS_SYMBOL_KIND_CACHE[type];
|
||||
if (!pattern) {
|
||||
@@ -235,33 +155,26 @@ class OutlineModel extends QuickOpenModel {
|
||||
}
|
||||
|
||||
class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
private editorService: IEditorService;
|
||||
private index: number;
|
||||
private name: string;
|
||||
private kind: SymbolKind;
|
||||
private icon: string;
|
||||
private description: string;
|
||||
private range: IRange;
|
||||
private revealRange: IRange;
|
||||
private handler: GotoSymbolHandler;
|
||||
|
||||
constructor(index: number, name: string, kind: SymbolKind, description: string, icon: string, range: IRange, revealRange: IRange, highlights: IHighlight[], editorService: IEditorService, handler: GotoSymbolHandler) {
|
||||
private score?: filters.FuzzyScore;
|
||||
|
||||
constructor(
|
||||
private readonly index: number,
|
||||
private readonly name: string,
|
||||
private readonly kind: SymbolKind,
|
||||
private readonly description: string,
|
||||
private readonly icon: string,
|
||||
private readonly deprecated: boolean,
|
||||
private readonly range: IRange,
|
||||
private readonly revealRange: IRange,
|
||||
private readonly editorService: IEditorService,
|
||||
private readonly handler: GotoSymbolHandler
|
||||
) {
|
||||
super();
|
||||
|
||||
this.index = index;
|
||||
this.name = name;
|
||||
this.kind = kind;
|
||||
this.icon = icon;
|
||||
this.description = description;
|
||||
this.range = range;
|
||||
this.revealRange = revealRange || range;
|
||||
this.setHighlights(highlights);
|
||||
this.editorService = editorService;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
getIndex(): number {
|
||||
return this.index;
|
||||
setScore(score: filters.FuzzyScore | undefined): void {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
getLabel(): string {
|
||||
@@ -276,6 +189,18 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
getLabelOptions(): IIconLabelValueOptions | undefined {
|
||||
return this.deprecated ? { extraClasses: ['deprecated'] } : undefined;
|
||||
}
|
||||
|
||||
getHighlights(): [IHighlight[], IHighlight[] | undefined, IHighlight[] | undefined] {
|
||||
return [
|
||||
this.deprecated ? [] : filters.createMatches(this.score),
|
||||
undefined,
|
||||
undefined
|
||||
];
|
||||
}
|
||||
|
||||
getDescription(): string {
|
||||
return this.description;
|
||||
}
|
||||
@@ -294,7 +219,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
|
||||
getOptions(pinned?: boolean): ITextEditorOptions {
|
||||
return {
|
||||
selection: this.toSelection(),
|
||||
selection: this.revealRange,
|
||||
pinned
|
||||
};
|
||||
}
|
||||
@@ -317,7 +242,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
|
||||
// Apply selection and focus
|
||||
else {
|
||||
const range = this.toSelection();
|
||||
const range = this.revealRange;
|
||||
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
|
||||
if (activeTextEditorWidget) {
|
||||
activeTextEditorWidget.setSelection(range);
|
||||
@@ -331,7 +256,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
private runPreview(): boolean {
|
||||
|
||||
// Select Outline Position
|
||||
const range = this.toSelection();
|
||||
const range = this.revealRange;
|
||||
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
|
||||
if (activeTextEditorWidget) {
|
||||
activeTextEditorWidget.revealRangeInCenter(range, ScrollType.Smooth);
|
||||
@@ -345,13 +270,36 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
|
||||
return false;
|
||||
}
|
||||
|
||||
private toSelection(): IRange {
|
||||
return {
|
||||
startLineNumber: this.revealRange.startLineNumber,
|
||||
startColumn: this.revealRange.startColumn || 1,
|
||||
endLineNumber: this.revealRange.startLineNumber,
|
||||
endColumn: this.revealRange.startColumn || 1
|
||||
};
|
||||
static compareByRank(a: SymbolEntry, b: SymbolEntry): number {
|
||||
if (!a.score && b.score) {
|
||||
return 1;
|
||||
} else if (a.score && !b.score) {
|
||||
return -1;
|
||||
}
|
||||
if (a.score && b.score) {
|
||||
if (a.score[0] > b.score[0]) {
|
||||
return -1;
|
||||
} else if (a.score[0] < b.score[0]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (a.index < b.index) {
|
||||
return -1;
|
||||
} else if (a.index > b.index) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static compareByKindAndRank(a: SymbolEntry, b: SymbolEntry): number {
|
||||
// Sort by type first if scoped search
|
||||
const kindA = NLS_SYMBOL_KIND_CACHE[a.getKind()] || FALLBACK_NLS_SYMBOL_KIND;
|
||||
const kindB = NLS_SYMBOL_KIND_CACHE[b.getKind()] || FALLBACK_NLS_SYMBOL_KIND;
|
||||
let r = kindA.localeCompare(kindB);
|
||||
if (r === 0) {
|
||||
r = this.compareByRank(a, b);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,11 +414,11 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
};
|
||||
}
|
||||
|
||||
private toQuickOpenEntries(flattened: DocumentSymbol[]): SymbolEntry[] {
|
||||
private toQuickOpenEntries(symbols: DocumentSymbol[]): SymbolEntry[] {
|
||||
const results: SymbolEntry[] = [];
|
||||
|
||||
for (let i = 0; i < flattened.length; i++) {
|
||||
const element = flattened[i];
|
||||
for (let i = 0; i < symbols.length; i++) {
|
||||
const element = symbols[i];
|
||||
const label = strings.trim(element.name);
|
||||
|
||||
// Show parent scope as description
|
||||
@@ -479,8 +427,8 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
|
||||
// Add
|
||||
results.push(new SymbolEntry(i,
|
||||
label, element.kind, description, `symbol-icon ${icon}`,
|
||||
element.range, element.selectionRange, [], this.editorService, this
|
||||
label, element.kind, description, `symbol-icon ${icon}`, element.tags && element.tags.indexOf(SymbolTag.Deprecated) >= 0,
|
||||
element.range, element.selectionRange, this.editorService, this
|
||||
));
|
||||
}
|
||||
|
||||
@@ -504,7 +452,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
}
|
||||
|
||||
if (model && types.isFunction((<ITextModel>model).getLanguageIdentifier)) {
|
||||
const entries = await asPromise(() => getDocumentSymbols(<ITextModel>model, true, this.pendingOutlineRequest!.token));
|
||||
const entries = await getDocumentSymbols(<ITextModel>model, true, this.pendingOutlineRequest!.token);
|
||||
|
||||
return new OutlineModel(this.toQuickOpenEntries(entries));
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { isWeb, OperatingSystem } from 'vs/base/common/platform';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { OperatingSystem } from 'vs/base/common/platform';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IRemoteAgentService, RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -49,28 +48,24 @@ export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry
|
||||
export class LabelContribution implements IWorkbenchContribution {
|
||||
constructor(
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService) {
|
||||
this.registerFormatters();
|
||||
}
|
||||
|
||||
private registerFormatters(): void {
|
||||
if (isWeb) {
|
||||
this.remoteAgentService.getEnvironment().then(remoteEnvironment => {
|
||||
if (remoteEnvironment) {
|
||||
this.labelService.registerFormatter({
|
||||
scheme: Schemas.vscodeRemote,
|
||||
authority: this.environmentService.configuration.remoteAuthority,
|
||||
formatting: {
|
||||
label: '${path}',
|
||||
separator: remoteEnvironment.os === OperatingSystem.Windows ? '\\' : '/',
|
||||
tildify: remoteEnvironment.os !== OperatingSystem.Windows,
|
||||
normalizeDriveLetter: remoteEnvironment.os === OperatingSystem.Windows
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.remoteAgentService.getEnvironment().then(remoteEnvironment => {
|
||||
if (remoteEnvironment) {
|
||||
this.labelService.registerFormatter({
|
||||
scheme: Schemas.vscodeRemote,
|
||||
formatting: {
|
||||
label: '${path}',
|
||||
separator: remoteEnvironment.os === OperatingSystem.Windows ? '\\' : '/',
|
||||
tildify: remoteEnvironment.os !== OperatingSystem.Windows,
|
||||
normalizeDriveLetter: remoteEnvironment.os === OperatingSystem.Windows
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,8 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
@IProgressService progressService: IProgressService,
|
||||
@IDialogService dialogService: IDialogService,
|
||||
@ICommandService commandService: ICommandService
|
||||
@ICommandService commandService: ICommandService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
) {
|
||||
const connection = remoteAgentService.getConnection();
|
||||
if (connection) {
|
||||
@@ -318,6 +319,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
let lastLocation: ProgressLocation | null = null;
|
||||
let currentTimer: ReconnectionTimer | null = null;
|
||||
let reconnectWaitEvent: ReconnectionWaitEvent | null = null;
|
||||
let disposableListener: IDisposable | null = null;
|
||||
|
||||
function showProgress(location: ProgressLocation, buttons?: string[]) {
|
||||
if (currentProgressPromiseResolve) {
|
||||
@@ -331,7 +333,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
// Show dialog
|
||||
progressService!.withProgress(
|
||||
{ location: ProgressLocation.Dialog, buttons },
|
||||
(progress) => { progressReporter = new ProgressReporter(progress); return promise; },
|
||||
(progress) => { if (progressReporter) { progressReporter.currentProgress = progress; } return promise; },
|
||||
(choice?) => {
|
||||
// Handle choice from dialog
|
||||
if (choice === 0 && buttons && reconnectWaitEvent) {
|
||||
@@ -351,7 +353,6 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
// Handle choice from notification
|
||||
if (choice === 0 && buttons && reconnectWaitEvent) {
|
||||
reconnectWaitEvent.skipWait();
|
||||
progressReporter!.report();
|
||||
} else {
|
||||
hideProgress();
|
||||
}
|
||||
@@ -365,7 +366,6 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
}
|
||||
|
||||
currentProgressPromiseResolve = null;
|
||||
progressReporter = null;
|
||||
}
|
||||
|
||||
connection.onDidStateChange((e) => {
|
||||
@@ -373,9 +373,15 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
currentTimer.dispose();
|
||||
currentTimer = null;
|
||||
}
|
||||
|
||||
if (disposableListener) {
|
||||
disposableListener.dispose();
|
||||
disposableListener = null;
|
||||
}
|
||||
switch (e.type) {
|
||||
case PersistentConnectionEventType.ConnectionLost:
|
||||
if (!currentProgressPromiseResolve) {
|
||||
progressReporter = new ProgressReporter(null);
|
||||
showProgress(ProgressLocation.Dialog, [nls.localize('reconnectNow', "Reconnect Now")]);
|
||||
}
|
||||
|
||||
@@ -391,9 +397,24 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
hideProgress();
|
||||
showProgress(lastLocation || ProgressLocation.Notification);
|
||||
progressReporter!.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
|
||||
|
||||
// Register to listen for quick input is opened
|
||||
disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
|
||||
const reconnectInteraction = new Set<string>(['inQuickOpen']);
|
||||
if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
|
||||
// Need to move from dialog if being shown and user needs to type in a prompt
|
||||
if (lastLocation === ProgressLocation.Dialog && progressReporter !== null) {
|
||||
hideProgress();
|
||||
showProgress(ProgressLocation.Notification);
|
||||
progressReporter.report();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case PersistentConnectionEventType.ReconnectionPermanentFailure:
|
||||
hideProgress();
|
||||
progressReporter = null;
|
||||
|
||||
dialogService.show(Severity.Error, nls.localize('reconnectionPermanentFailure', "Cannot reconnect. Please reload the window."), [nls.localize('reloadWindow', "Reload Window"), nls.localize('cancel', "Cancel")], { cancelId: 1 }).then(choice => {
|
||||
// Reload the window
|
||||
@@ -404,6 +425,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
break;
|
||||
case PersistentConnectionEventType.ConnectionGain:
|
||||
hideProgress();
|
||||
progressReporter = null;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,13 +8,13 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
import { QuickOpenHandler, EditorQuickOpenEntry } from 'vs/workbench/browser/quickopen';
|
||||
import { QuickOpenModel, QuickOpenEntry, compareEntries } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { QuickOpenModel, QuickOpenEntry, IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { IAutoFocus, Mode, IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen';
|
||||
import * as filters from 'vs/base/common/filters';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor';
|
||||
import { symbolKindToCssClass } from 'vs/editor/common/modes';
|
||||
import { symbolKindToCssClass, SymbolTag } from 'vs/editor/common/modes';
|
||||
import { IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -25,9 +25,12 @@ import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
|
||||
|
||||
class SymbolEntry extends EditorQuickOpenEntry {
|
||||
private bearingResolve: Promise<this | undefined> | undefined;
|
||||
|
||||
private bearingResolve?: Promise<this | undefined>;
|
||||
private score?: filters.FuzzyScore;
|
||||
|
||||
constructor(
|
||||
private bearing: IWorkspaceSymbol,
|
||||
@@ -40,6 +43,14 @@ class SymbolEntry extends EditorQuickOpenEntry {
|
||||
super(editorService);
|
||||
}
|
||||
|
||||
setScore(score: filters.FuzzyScore | undefined) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
getHighlights(): [IHighlight[] /* Label */, IHighlight[] | undefined /* Description */, IHighlight[] | undefined /* Detail */] {
|
||||
return [this.isDeprecated() ? [] : filters.createMatches(this.score), undefined, undefined];
|
||||
}
|
||||
|
||||
getLabel(): string {
|
||||
return this.bearing.name;
|
||||
}
|
||||
@@ -65,10 +76,18 @@ class SymbolEntry extends EditorQuickOpenEntry {
|
||||
return symbolKindToCssClass(this.bearing.kind);
|
||||
}
|
||||
|
||||
getLabelOptions(): IIconLabelValueOptions | undefined {
|
||||
return this.isDeprecated() ? { extraClasses: ['deprecated'] } : undefined;
|
||||
}
|
||||
|
||||
getResource(): URI {
|
||||
return this.bearing.location.uri;
|
||||
}
|
||||
|
||||
private isDeprecated(): boolean {
|
||||
return this.bearing.tags ? this.bearing.tags.indexOf(SymbolTag.Deprecated) >= 0 : false;
|
||||
}
|
||||
|
||||
run(mode: Mode, context: IEntryRunContext): boolean {
|
||||
|
||||
// resolve this type bearing if neccessary
|
||||
@@ -111,18 +130,24 @@ class SymbolEntry extends EditorQuickOpenEntry {
|
||||
return input;
|
||||
}
|
||||
|
||||
static compare(elementA: SymbolEntry, elementB: SymbolEntry, searchValue: string): number {
|
||||
|
||||
// Sort by Type if name is identical
|
||||
const elementAName = elementA.getLabel().toLowerCase();
|
||||
const elementBName = elementB.getLabel().toLowerCase();
|
||||
if (elementAName === elementBName) {
|
||||
let elementAType = symbolKindToCssClass(elementA.bearing.kind);
|
||||
let elementBType = symbolKindToCssClass(elementB.bearing.kind);
|
||||
return elementAType.localeCompare(elementBType);
|
||||
static compare(a: SymbolEntry, b: SymbolEntry, searchValue: string): number {
|
||||
// order: score, name, kind
|
||||
if (a.score && b.score) {
|
||||
if (a.score[0] > b.score[0]) {
|
||||
return -1;
|
||||
} else if (a.score[0] < b.score[0]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return compareEntries(elementA, elementB, searchValue);
|
||||
const aName = a.getLabel().toLowerCase();
|
||||
const bName = b.getLabel().toLowerCase();
|
||||
let res = aName.localeCompare(bName);
|
||||
if (res !== 0) {
|
||||
return res;
|
||||
}
|
||||
let aKind = symbolKindToCssClass(a.bearing.kind);
|
||||
let bKind = symbolKindToCssClass(b.bearing.kind);
|
||||
return aKind.localeCompare(bKind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +223,9 @@ export class OpenSymbolHandler extends QuickOpenHandler {
|
||||
|
||||
private fillInSymbolEntries(bucket: SymbolEntry[], provider: IWorkspaceSymbolProvider, types: IWorkspaceSymbol[], searchValue: string): void {
|
||||
|
||||
const pattern = strings.stripWildcards(searchValue);
|
||||
const patternLow = pattern.toLowerCase();
|
||||
|
||||
// Convert to Entries
|
||||
for (let element of types) {
|
||||
if (this.options.skipLocalSymbols && !!element.containerName) {
|
||||
@@ -205,7 +233,11 @@ export class OpenSymbolHandler extends QuickOpenHandler {
|
||||
}
|
||||
|
||||
const entry = this.instantiationService.createInstance(SymbolEntry, element, provider);
|
||||
entry.setHighlights(filters.matchesFuzzy2(searchValue, entry.getLabel()) || []);
|
||||
entry.setScore(filters.fuzzyScore(
|
||||
pattern, patternLow, 0,
|
||||
entry.getLabel(), entry.getLabel().toLowerCase(), 0,
|
||||
true
|
||||
));
|
||||
bucket.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ISearchConfiguration, ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search';
|
||||
import { SymbolKind, Location, ProviderResult } from 'vs/editor/common/modes';
|
||||
import { SymbolKind, Location, ProviderResult, SymbolTag } from 'vs/editor/common/modes';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { toResource, SideBySideEditor } from 'vs/workbench/common/editor';
|
||||
@@ -19,6 +19,7 @@ export interface IWorkspaceSymbol {
|
||||
name: string;
|
||||
containerName?: string;
|
||||
kind: SymbolKind;
|
||||
tags?: SymbolTag[];
|
||||
location: Location;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,9 +340,7 @@ export class TerminalTaskSystem implements ITaskSystem {
|
||||
private async executeTask(task: Task, resolver: ITaskResolver, trigger: string): Promise<ITaskSummary> {
|
||||
let promises: Promise<ITaskSummary>[] = [];
|
||||
if (task.configurationProperties.dependsOn) {
|
||||
// tslint:disable-next-line: no-for-in-array
|
||||
for (let index in task.configurationProperties.dependsOn) {
|
||||
const dependency = task.configurationProperties.dependsOn[index];
|
||||
for (const dependency of task.configurationProperties.dependsOn) {
|
||||
let dependencyTask = resolver.resolve(dependency.workspaceFolder, dependency.task!);
|
||||
if (dependencyTask) {
|
||||
let key = dependencyTask.getMapKey();
|
||||
|
||||
@@ -216,11 +216,11 @@ export async function getResource(filename: string, matcher: ProblemMatcher, fil
|
||||
if (fullPath === undefined) {
|
||||
throw new Error('FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.');
|
||||
}
|
||||
fullPath = normalize(fullPath);
|
||||
fullPath = fullPath.replace(/\\/g, '/');
|
||||
if (fullPath[0] !== '/') {
|
||||
fullPath = '/' + fullPath;
|
||||
}
|
||||
fullPath = normalize(fullPath);
|
||||
if (matcher.uriProvider !== undefined) {
|
||||
return matcher.uriProvider(fullPath);
|
||||
} else {
|
||||
|
||||
@@ -27,9 +27,10 @@ const dotnetBuild: TaskEntry = {
|
||||
'\t"tasks": [',
|
||||
'\t\t{',
|
||||
'\t\t\t"label": "build",',
|
||||
'\t\t\t"command": "dotnet build",',
|
||||
'\t\t\t"command": "dotnet",',
|
||||
'\t\t\t"type": "shell",',
|
||||
'\t\t\t"args": [',
|
||||
'\t\t\t\t"build",',
|
||||
'\t\t\t\t// Ask dotnet build to generate full paths for file names.',
|
||||
'\t\t\t\t"/property:GenerateFullPaths=true",',
|
||||
'\t\t\t\t// Do not generate summary otherwise it leads to duplicate errors in Problems panel',
|
||||
|
||||
@@ -985,15 +985,14 @@ export namespace KeyedTaskIdentifier {
|
||||
function sortedStringify(literal: any): string {
|
||||
const keys = Object.keys(literal).sort();
|
||||
let result: string = '';
|
||||
// tslint:disable-next-line: no-for-in-array
|
||||
for (let position in keys) {
|
||||
let stringified = literal[keys[position]];
|
||||
for (const key of keys) {
|
||||
let stringified = literal[key];
|
||||
if (stringified instanceof Object) {
|
||||
stringified = sortedStringify(stringified);
|
||||
} else if (typeof stringified === 'string') {
|
||||
stringified = stringified.replace(/,/g, ',,');
|
||||
}
|
||||
result += keys[position] + ',' + stringified + ',';
|
||||
result += key + ',' + stringified + ',';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,10 @@ Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions).registe
|
||||
|
||||
const DEAFULT_TRUSTED_DOMAINS = [
|
||||
'https://code.visualstudio.com',
|
||||
'https://go.microsoft.com'
|
||||
'https://go.microsoft.com',
|
||||
'https://github.com',
|
||||
'https://marketplace.visualstudio.com',
|
||||
'https://vscode-auth.github.com'
|
||||
];
|
||||
|
||||
const configureTrustedDomainsHandler = async (
|
||||
|
||||
Reference in New Issue
Block a user