mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
* Squash merge commits for 1.26 (#1) (#2323) * Polish tag search as per feedback (#55269) * Polish tag search as per feedback * Updated regex * Allow users to opt-out of features that send online requests in the background (#55097) * settings sweep #54690 * Minor css tweaks to enable eoverflow elipsis in more places (#55277) * fix an issue with titlebarheight when not scaling with zoom * Settings descriptions update #54690 * fixes #55209 * Settings editor - many padding fixes * More space above level 2 label * Fixing Cannot debug npm script using Yarn #55103 * Settings editor - show ellipsis when description overflows * Settings editor - ... fix measuring around links, relayout * Setting descriptions * Settings editor - fix ... for some short lines, fix select container width * Settings editor - overlay trees so scrollable shadow is full width * Fix #54133 - missing extension settings after reload * Settings color token description tweak * Settings editor - disable overflow indicator temporarily, needs to be faster * Added command to Run the selected npm script * fixes #54452 * fixes #54929 * fixes #55248 * prefix command with extension name * Contribute run selected to the context menu * node-debug@1.26.6 * Allow terminal rendererType to be swapped out at runtime Part of #53274 Fixes #55344 * Settings editor - fix not focusing search when restoring editor setInput must be actually async. Will be fixed naturally when we aren't using winJS promises... * Settings editor - TOC should only expand the section with a selected item * Bump node-debug2 * Settings editor - Tree focus outlines * Settings editor - don't blink the scrollbar when toc selection changes And hide TOC correctly when the editor is narrow * Settings editor - header rows should not be selectable * fixes #54877 * change debug assignee to isi * Settings sweep (#54690) * workaround for #55051 * Settings sweep (#54690) * settings sweep #54690 * Don't try closing tags when you type > after another > * Describe what implementation code lens does Fixes #55370 * fix javadoc formatter setting description * fixes #55325 * update to officical TS version * Settings editor - Even more padding, use semibold instead of bold * Fix #55357 - fix TOC twistie * fixes #55288 * explorer: refresh on di change file system provider registration fixes #53256 * Disable push to Linux repo to test standalone publisher * New env var to notify log level to extensions #54001 * Disable snippets in extension search (when not in suggest dropdown) (#55281) * Disable snippits in extension search (when not in suggest dropdown) * Add monaco input contributions * Fix bug preventing snippetSuggestions from taking effect in sub-editors * Latest emmet helper to fix #52366 * Fix comment updates for threads within same file * Allow extensions to log telemetry to log files #54001 * Pull latest css grammar * files.exclude control - use same style for "add" vs "edit" * files.exclude control - focus/keyboard behavior * don't show menubar too early * files.exclude - better styling * Place cursor at end of extensions search box on autofill (#55254) * Place cursor at end of extensions search box on autofill * Use position instead of selection * fix linux build issue (empty if block) * Settings editor - fix extension category prefixes * Settings editor - add simple ellipsis for first line that overflows, doesn't cover case when first line does not overflow but there is more text, TODO * File/Text search provider docs * Fixes #52655 * Include epoch (#55008) * Fixes #53385 * Fixes #49480 * VS Code Insiders (Users) not opening Fixes #55353 * Better handling of the case when the extension host fails to start * Fixes #53966 * Remove confusing Start from wordPartLeft commands ID * vscode-xterm@3.6.0-beta12 Fixes #55488 * Initial size is set to infinity!! Fixes #55461 * Polish embeddedEditorBackground * configuration service misses event * Fix #55224 - fix duplicate results in multiroot workspace from splitting the diskseach query * Select all not working in issue reporter on mac, fixes #55424 * Disable fuzzy matching for extensions autosuggest (#55498) * Fix clipping of extensions search border in some third party themes (#55504) * fixes #55538 * Fix bug causing an aria alert to not be shown the third time (and odd numbers thereafter) * Settings editor - work around rendering glitch with webkit-line-clamp * Settings editor - revert earlier '...' changes * Settings editor - move enumDescription to its own div, because it disturbs -webkit-line-clamp for some reason * Settings editor - better overflow indicator * Don't show existing filters in autocomplete (#55495) * Dont show existing filters in autocomplete * Simplify * Settings Editor: Add aria labels for input elements Fixes: #54836 (#55543) * fixes #55223 * Update vscode-css-languageservice to 3.0.10-next.1 * Fix #55509 - settings navigation * Fix #55519 * Fix #55520 * FIx #55524 * Fix #55556 - include wordSeparators in all search queries, so findTextInFiles can respect isWordMatch correctly * oss updates for endgame * Fix unit tests * fixes #55522 * Avoid missing manifest error from bubbling up #54757 * Settings format crawl * Search provider - Fix FileSearchProvider to return array, not progress * Fix #55598 * Settings editor - fix NPE rendering settings with no description * dont render inden guides in search box (#55600) * fixes #55454 * More settings crawl * Another change for #55598 - maxResults applies to FileSearch and TextSearch but not FileIndex * Fix FileSearchProvider unit tests for progress change * fixes #55561 * Settings description update for #54690 * Update setting descriptions for online services * Minor edits * fixes #55513 * fixes #55451 * Fix #55612 - fix findTextInFiles cancellation * fixes #55539 * More setting description tweaks * Setting to disable online experiments #54354 * fixes #55507 * fixes #55515 * Show online services action only in Insiders for now * Settings editor - change toc behavior default to 'filter' * Settings editor - nicer filter count style during search * Fix #55617 - search viewlet icons * Settings editor - better styling for element count indicator * SearchProvider - fix NPE when searching extraFileResources * Allow extends to work without json suffix Fixes #16905 * Remove accessability options logic entirely Follow up on #55451 * use latest version of DAP * fixes #55490 * fixes #55122 * fixes #52332 * Avoid assumptions about git: URIs (fixes #36236) * relative path for descriptions * resourece: get rid of isFile context key fixes #48275 * Register previous ids for compatibility (#53497) * more tuning for #48275 * no need to always re-read "files explorer" fixes #52003 * read out active composites properly fixes #51967 * Update link colors for hc theme to meet color contrast ratio, fixes #55651 Also updated link color for `textLinkActiveForeground` to be the same as `textLinkForeground` as it wasn't properly updated * detect 'winpty-agent.exe'; fixes #55672 * node-debug@1.26.7 * reset counter on new label * Settings editor - fix multiple setting links in one description * Settings editor - color code blocks in setting descriptions, fix #55532 * Settings editor - hover color in TOC * Settings editor - fix navigation NPE * Settings editor - fix text control width * Settings editor - maybe fix #55684 * Fix bug causing cursor to not move on paste * fixes #53582 * Use ctrlCmd instead of ctrl for go down from search box * fixes #55264 * fixes #55456 * filter for spcaes before triggering search (#55611) * Fix #55698 - don't lose filtered TOC counts when refreshing TOC * fixes #55421 * fixes #28979 * fixes #55576 * only add check for updates to windows/linux help * readonly files: append decoration to label fixes #53022 * debug: do not show toolbar while initialising fixes #55026 * Opening launch.json should not activate debug extensions fixes #55029 * fixes #55435 * fixes #55434 * fixes #55439 * trigger menu only on altkey up * Fix #50555 - fix settings editor memory leak * Fix #55712 - no need to focus 'a' anymore when restoring control focus after tree render * fixes #55335 * proper fix for readonly model fixes #53022 * improve FoldingRangeKind spec (for #55686) * Use class with static fields (fixes #55494) * Fixes #53671 * fixes #54630 * [html] should disable ionic suggestions by default. Currently forces deprecated Ionic v1 suggestions in .html files while typing. Fixes #53324 * cleanup deps * debug issues back to andre * update electron for smoketest * Fix #55757 - prevent settings tabs from overflowing * Fix #53897 - revert setting menu defaults to old editor * Add enum descriptions to `typescript.preferences.importModuleSpecifier` * Fix #55767 - leaking style elements from settings editor * Fix #55521 - prevent flashing when clicking in exclude control * Update Git modified color for contrast ratio, fixes #53140 * Revert "Merge branch 'master' of github.com:Microsoft/vscode" This reverts commit bf46b6bfbae0cab99c2863e1244a916181fa9fbc, reversing changes made to e275a424483dfb4ed33b428c97d5e2c441d6b917. * Revert "Revert "Merge branch 'master' of github.com:Microsoft/vscode"" This reverts commit 53949d963f39e40757557c6526332354a31d9154. * don't ask to install an incomplete menu * Fix NPE in terminal AccessibilityManager Fixes #55744 * don't display fallback menu unless we've closed the last window * fixes #55547 * Fix smoke tests for extension search box * Update OSSREADME.json for Electron 2.0.5 * Update distro Includes Chromium license changes * fix #55455 * fix #55865 * fixes #55893 * Fix bug causing workspace recommendations to go away upon ignoring a recommendation (#55805) * Fix bug causing workspace recommendations to go away upon ignoring a recommendation * ONly show on @recommended or @recommended:workspace * Make more consistant * Fix #55911 * Understand json activity (#55926) * Understand json file activity * Refactoring * adding composer.json * Distro update for experiments * use terminal.processId for auto-attach; fixes #55918 * Reject invalid URI with vscode.openFolder (for #55891) * improve win32 setup system vs user detection fixes #55840 fixes #55840 delay winreg import related to #55840 show notification earlier related to #55840 fix #55840 update inno setup message related to #55840 * Fix #55593 - this code only operates on local paths, so use fsPath and Uri.file instead * Bring back the old menu due to electron 2.0 issues (#55913) * add the old menu back for native menus * make menu labels match * `vscode.openFolder`: treat missing URI schema gracefully (for #55891) * delay EH reattach; fixes #55955 * Mark all json files under appSettingsHome as settings * Use localized strings for telemetry opt-out * Exception when saving file editor opened from remote file provider (fixes #55051) * Remove terminal menu from stable Fixes 56003 * VSCode Insiders crashes on open with TypeError: Cannot read property 'lastIndexOf' of undefined. Fixes #54933 * improve fix for #55891 * fix #55916 * Improve #55891 * increase EH debugging restart delay; fixes #55955 * Revert "Don't include non-resource entries in history quick pick" This reverts commit 37209a838e9f7e9abe6dc53ed73cdf1e03b72060. * Diff editor: horizontal scrollbar height is smaller (fixes #56062) * improve openFolder uri fix (correctly treat backslashes) * fixes #56116 repair ipc for native menubar keybindings * Fix #56240 - Open the JSON settings editor instead of the UI editor * Fix #55536 * uriDisplay: if no formatter is registered fall back to getPathlabel fixes #56104 * VSCode hangs when opening python file. Fixes #56377 * VS Code Hangs When Opening Specific PowerShell File. Fixes #56430 * Fix #56433 - search extraFileResources even when no folders open * Workaround #55649 * Fix in master #56371 * Fix tests #56371 * Fix in master #56317 * increase version to 1.26.1 * Fixes #56387: Handle SIGPIPE in extension host * fixes #56185 * Fix merge issues (part 1) * Fix build breaks (part 1) * Build breaks (part 2) * Build breaks (part 3) * More build breaks (part 4) * Fix build breaks (part 5) * WIP * Fix menus * Render query result and message panels (#2363) * Put back query editor hot exit changes * Fix grid changes that broke profiler (#2365) * Update APIs for saving query editor state * Fix restore view state for profiler and edit data * Updating custom default themes to support 4.5:1 contrast ratio * Test updates * Fix Extension Manager and Windows Setup * Update license headers * Add appveyor and travis files back * Fix hidden modal dropdown issue
896 lines
32 KiB
TypeScript
896 lines
32 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
'use strict';
|
|
|
|
import 'vs/css!./media/referencesWidget';
|
|
import * as nls from 'vs/nls';
|
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
|
import { Event, Emitter } from 'vs/base/common/event';
|
|
import { IDisposable, dispose, IReference } from 'vs/base/common/lifecycle';
|
|
import { Schemas } from 'vs/base/common/network';
|
|
import * as strings from 'vs/base/common/strings';
|
|
import { TPromise } from 'vs/base/common/winjs.base';
|
|
import { Color } from 'vs/base/common/color';
|
|
import { $, Builder } from 'vs/base/browser/builder';
|
|
import * as dom from 'vs/base/browser/dom';
|
|
import { Sash, ISashEvent, IVerticalSashLayoutProvider } from 'vs/base/browser/ui/sash/sash';
|
|
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
|
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
|
import { GestureEvent } from 'vs/base/browser/touch';
|
|
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
|
import { FileLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
|
|
import * as tree from 'vs/base/parts/tree/browser/tree';
|
|
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation';
|
|
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
|
import { Range, IRange } from 'vs/editor/common/core/range';
|
|
import * as editorCommon from 'vs/editor/common/editorCommon';
|
|
import { TextModel, ModelDecorationOptions } from 'vs/editor/common/model/textModel';
|
|
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
|
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
|
|
import { PeekViewWidget } from './peekViewWidget';
|
|
import { FileReferences, OneReference, ReferencesModel } from './referencesModel';
|
|
import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService';
|
|
import { registerColor, activeContrastBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
|
import { registerThemingParticipant, ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
|
import { attachBadgeStyler } from 'vs/platform/theme/common/styler';
|
|
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
|
import URI from 'vs/base/common/uri';
|
|
import { TrackedRangeStickiness, IModelDeltaDecoration } from 'vs/editor/common/model';
|
|
import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser/listService';
|
|
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
|
import { Location } from 'vs/editor/common/modes';
|
|
import { ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults';
|
|
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
|
|
import { dirname, basenameOrAuthority } from 'vs/base/common/resources';
|
|
|
|
|
|
class DecorationsManager implements IDisposable {
|
|
|
|
private static readonly DecorationOptions = ModelDecorationOptions.register({
|
|
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
className: 'reference-decoration'
|
|
});
|
|
|
|
private _decorations = new Map<string, OneReference>();
|
|
private _decorationIgnoreSet = new Set<string>();
|
|
private _callOnDispose: IDisposable[] = [];
|
|
private _callOnModelChange: IDisposable[] = [];
|
|
|
|
constructor(private _editor: ICodeEditor, private _model: ReferencesModel) {
|
|
this._callOnDispose.push(this._editor.onDidChangeModel(() => this._onModelChanged()));
|
|
this._onModelChanged();
|
|
}
|
|
|
|
public dispose(): void {
|
|
this._callOnModelChange = dispose(this._callOnModelChange);
|
|
this._callOnDispose = dispose(this._callOnDispose);
|
|
this.removeDecorations();
|
|
}
|
|
|
|
private _onModelChanged(): void {
|
|
this._callOnModelChange = dispose(this._callOnModelChange);
|
|
const model = this._editor.getModel();
|
|
if (model) {
|
|
for (const ref of this._model.groups) {
|
|
if (ref.uri.toString() === model.uri.toString()) {
|
|
this._addDecorations(ref);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private _addDecorations(reference: FileReferences): void {
|
|
this._callOnModelChange.push(this._editor.getModel().onDidChangeDecorations((event) => this._onDecorationChanged()));
|
|
|
|
const newDecorations: IModelDeltaDecoration[] = [];
|
|
const newDecorationsActualIndex: number[] = [];
|
|
|
|
for (let i = 0, len = reference.children.length; i < len; i++) {
|
|
let oneReference = reference.children[i];
|
|
if (this._decorationIgnoreSet.has(oneReference.id)) {
|
|
continue;
|
|
}
|
|
newDecorations.push({
|
|
range: oneReference.range,
|
|
options: DecorationsManager.DecorationOptions
|
|
});
|
|
newDecorationsActualIndex.push(i);
|
|
}
|
|
|
|
const decorations = this._editor.deltaDecorations([], newDecorations);
|
|
for (let i = 0; i < decorations.length; i++) {
|
|
this._decorations.set(decorations[i], reference.children[newDecorationsActualIndex[i]]);
|
|
}
|
|
}
|
|
|
|
private _onDecorationChanged(): void {
|
|
const toRemove: string[] = [];
|
|
|
|
this._decorations.forEach((reference, decorationId) => {
|
|
const newRange = this._editor.getModel().getDecorationRange(decorationId);
|
|
|
|
if (!newRange) {
|
|
return;
|
|
}
|
|
|
|
let ignore = false;
|
|
|
|
if (Range.equalsRange(newRange, reference.range)) {
|
|
return;
|
|
|
|
} else if (Range.spansMultipleLines(newRange)) {
|
|
ignore = true;
|
|
|
|
} else {
|
|
const lineLength = reference.range.endColumn - reference.range.startColumn;
|
|
const newLineLength = newRange.endColumn - newRange.startColumn;
|
|
|
|
if (lineLength !== newLineLength) {
|
|
ignore = true;
|
|
}
|
|
}
|
|
|
|
if (ignore) {
|
|
this._decorationIgnoreSet.add(reference.id);
|
|
toRemove.push(decorationId);
|
|
} else {
|
|
reference.range = newRange;
|
|
}
|
|
});
|
|
|
|
for (let i = 0, len = toRemove.length; i < len; i++) {
|
|
this._decorations.delete(toRemove[i]);
|
|
}
|
|
this._editor.deltaDecorations(toRemove, []);
|
|
}
|
|
|
|
public removeDecorations(): void {
|
|
let toRemove: string[] = [];
|
|
this._decorations.forEach((value, key) => {
|
|
toRemove.push(key);
|
|
});
|
|
this._editor.deltaDecorations(toRemove, []);
|
|
this._decorations.clear();
|
|
}
|
|
}
|
|
|
|
class DataSource implements tree.IDataSource {
|
|
|
|
constructor(
|
|
@ITextModelService private readonly _textModelResolverService: ITextModelService
|
|
) {
|
|
//
|
|
}
|
|
|
|
public getId(tree: tree.ITree, element: any): string {
|
|
if (element instanceof ReferencesModel) {
|
|
return 'root';
|
|
} else if (element instanceof FileReferences) {
|
|
return (<FileReferences>element).id;
|
|
} else if (element instanceof OneReference) {
|
|
return (<OneReference>element).id;
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
public hasChildren(tree: tree.ITree, element: any): boolean {
|
|
if (element instanceof ReferencesModel) {
|
|
return true;
|
|
}
|
|
if (element instanceof FileReferences && !(<FileReferences>element).failure) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public getChildren(tree: tree.ITree, element: ReferencesModel | FileReferences): TPromise<any[]> {
|
|
if (element instanceof ReferencesModel) {
|
|
return TPromise.as(element.groups);
|
|
} else if (element instanceof FileReferences) {
|
|
return element.resolve(this._textModelResolverService).then(val => {
|
|
if (element.failure) {
|
|
// refresh the element on failure so that
|
|
// we can update its rendering
|
|
return tree.refresh(element).then(() => val.children);
|
|
}
|
|
return val.children;
|
|
});
|
|
} else {
|
|
return TPromise.as([]);
|
|
}
|
|
}
|
|
|
|
public getParent(tree: tree.ITree, element: any): TPromise<any> {
|
|
let result: any = null;
|
|
if (element instanceof FileReferences) {
|
|
result = (<FileReferences>element).parent;
|
|
} else if (element instanceof OneReference) {
|
|
result = (<OneReference>element).parent;
|
|
}
|
|
return TPromise.as(result);
|
|
}
|
|
}
|
|
|
|
class Controller extends WorkbenchTreeController {
|
|
|
|
private _onDidFocus = new Emitter<any>();
|
|
readonly onDidFocus: Event<any> = this._onDidFocus.event;
|
|
|
|
private _onDidSelect = new Emitter<any>();
|
|
readonly onDidSelect: Event<any> = this._onDidSelect.event;
|
|
|
|
private _onDidOpenToSide = new Emitter<any>();
|
|
readonly onDidOpenToSide: Event<any> = this._onDidOpenToSide.event;
|
|
|
|
public onTap(tree: tree.ITree, element: any, event: GestureEvent): boolean {
|
|
if (element instanceof FileReferences) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
return this._expandCollapse(tree, element);
|
|
}
|
|
|
|
let result = super.onTap(tree, element, event);
|
|
|
|
this._onDidFocus.fire(element);
|
|
return result;
|
|
}
|
|
|
|
public onMouseDown(tree: tree.ITree, element: any, event: IMouseEvent): boolean {
|
|
let isDoubleClick = event.detail === 2;
|
|
if (event.leftButton) {
|
|
if (element instanceof FileReferences) {
|
|
if (this.openOnSingleClick || isDoubleClick || this.isClickOnTwistie(event)) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
return this._expandCollapse(tree, element);
|
|
}
|
|
}
|
|
|
|
let result = super.onClick(tree, element, event);
|
|
let openToSide = event.ctrlKey || event.metaKey || event.altKey;
|
|
if (openToSide && (isDoubleClick || this.openOnSingleClick)) {
|
|
this._onDidOpenToSide.fire(element);
|
|
} else if (isDoubleClick) {
|
|
this._onDidSelect.fire(element);
|
|
} else if (this.openOnSingleClick) {
|
|
this._onDidFocus.fire(element);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public onClick(tree: tree.ITree, element: any, event: IMouseEvent): boolean {
|
|
if (event.leftButton) {
|
|
return false; // Already handled by onMouseDown
|
|
}
|
|
|
|
return super.onClick(tree, element, event);
|
|
}
|
|
|
|
private _expandCollapse(tree: tree.ITree, element: any): boolean {
|
|
|
|
if (tree.isExpanded(element)) {
|
|
tree.collapse(element).done(null, onUnexpectedError);
|
|
} else {
|
|
tree.expand(element).done(null, onUnexpectedError);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public onEscape(tree: tree.ITree, event: IKeyboardEvent): boolean {
|
|
return false;
|
|
}
|
|
|
|
dispose(): void {
|
|
this._onDidFocus.dispose();
|
|
this._onDidSelect.dispose();
|
|
this._onDidOpenToSide.dispose();
|
|
}
|
|
}
|
|
|
|
class FileReferencesTemplate {
|
|
|
|
readonly file: FileLabel;
|
|
readonly badge: CountBadge;
|
|
readonly dispose: () => void;
|
|
|
|
constructor(
|
|
container: HTMLElement,
|
|
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
|
|
@optional(IEnvironmentService) private _environmentService: IEnvironmentService,
|
|
@IThemeService themeService: IThemeService,
|
|
) {
|
|
const parent = document.createElement('div');
|
|
dom.addClass(parent, 'reference-file');
|
|
container.appendChild(parent);
|
|
this.file = new FileLabel(parent, URI.parse('no:file'), this._contextService, this._environmentService);
|
|
|
|
this.badge = new CountBadge($('.count').appendTo(parent).getHTMLElement());
|
|
const styler = attachBadgeStyler(this.badge, themeService);
|
|
|
|
this.dispose = () => {
|
|
this.file.dispose();
|
|
styler.dispose();
|
|
};
|
|
}
|
|
|
|
set(element: FileReferences) {
|
|
this.file.setFile(element.uri, this._contextService, this._environmentService);
|
|
const len = element.children.length;
|
|
this.badge.setCount(len);
|
|
if (element.failure) {
|
|
this.badge.setTitleFormat(nls.localize('referencesFailre', "Failed to resolve file."));
|
|
} else if (len > 1) {
|
|
this.badge.setTitleFormat(nls.localize('referencesCount', "{0} references", len));
|
|
} else {
|
|
this.badge.setTitleFormat(nls.localize('referenceCount', "{0} reference", len));
|
|
}
|
|
}
|
|
}
|
|
|
|
class OneReferenceTemplate {
|
|
|
|
readonly before: HTMLSpanElement;
|
|
readonly inside: HTMLSpanElement;
|
|
readonly after: HTMLSpanElement;
|
|
|
|
constructor(container: HTMLElement) {
|
|
const parent = document.createElement('div');
|
|
this.before = document.createElement('span');
|
|
this.inside = document.createElement('span');
|
|
this.after = document.createElement('span');
|
|
dom.addClass(this.inside, 'referenceMatch');
|
|
dom.addClass(parent, 'reference');
|
|
parent.appendChild(this.before);
|
|
parent.appendChild(this.inside);
|
|
parent.appendChild(this.after);
|
|
container.appendChild(parent);
|
|
}
|
|
|
|
set(element: OneReference): void {
|
|
const { before, inside, after } = element.parent.preview.preview(element.range);
|
|
this.before.innerHTML = strings.escape(before);
|
|
this.inside.innerHTML = strings.escape(inside);
|
|
this.after.innerHTML = strings.escape(after);
|
|
}
|
|
}
|
|
|
|
class Renderer implements tree.IRenderer {
|
|
|
|
private static readonly _ids = {
|
|
FileReferences: 'FileReferences',
|
|
OneReference: 'OneReference'
|
|
};
|
|
|
|
constructor(
|
|
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
|
|
@IThemeService private readonly _themeService: IThemeService,
|
|
@optional(IEnvironmentService) private _environmentService: IEnvironmentService,
|
|
) {
|
|
//
|
|
}
|
|
|
|
getHeight(tree: tree.ITree, element: FileReferences | OneReference): number {
|
|
return 23;
|
|
}
|
|
|
|
getTemplateId(tree: tree.ITree, element: FileReferences | OneReference): string {
|
|
if (element instanceof FileReferences) {
|
|
return Renderer._ids.FileReferences;
|
|
} else if (element instanceof OneReference) {
|
|
return Renderer._ids.OneReference;
|
|
}
|
|
throw element;
|
|
}
|
|
|
|
renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement) {
|
|
if (templateId === Renderer._ids.FileReferences) {
|
|
return new FileReferencesTemplate(container, this._contextService, this._environmentService, this._themeService);
|
|
} else if (templateId === Renderer._ids.OneReference) {
|
|
return new OneReferenceTemplate(container);
|
|
}
|
|
throw templateId;
|
|
}
|
|
|
|
renderElement(tree: tree.ITree, element: FileReferences | OneReference, templateId: string, templateData: any): void {
|
|
if (element instanceof FileReferences) {
|
|
(<FileReferencesTemplate>templateData).set(element);
|
|
} else if (element instanceof OneReference) {
|
|
(<OneReferenceTemplate>templateData).set(element);
|
|
} else {
|
|
throw templateId;
|
|
}
|
|
}
|
|
|
|
disposeTemplate(tree: tree.ITree, templateId: string, templateData: FileReferencesTemplate | OneReferenceTemplate): void {
|
|
if (templateData instanceof FileReferencesTemplate) {
|
|
templateData.dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
class AriaProvider implements tree.IAccessibilityProvider {
|
|
|
|
getAriaLabel(tree: tree.ITree, element: FileReferences | OneReference): string {
|
|
if (element instanceof FileReferences) {
|
|
return element.getAriaMessage();
|
|
} else if (element instanceof OneReference) {
|
|
return element.getAriaMessage();
|
|
} else {
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
|
|
class VSash {
|
|
|
|
private _disposables: IDisposable[] = [];
|
|
private _sash: Sash;
|
|
private _ratio: number;
|
|
private _height: number;
|
|
private _width: number;
|
|
private _onDidChangePercentages = new Emitter<VSash>();
|
|
|
|
constructor(container: HTMLElement, ratio: number) {
|
|
this._ratio = ratio;
|
|
this._sash = new Sash(container, <IVerticalSashLayoutProvider>{
|
|
getVerticalSashLeft: () => this._width * this._ratio,
|
|
getVerticalSashHeight: () => this._height
|
|
});
|
|
|
|
// compute the current widget clientX postion since
|
|
// the sash works with clientX when dragging
|
|
let clientX: number;
|
|
this._disposables.push(this._sash.onDidStart((e: ISashEvent) => {
|
|
clientX = e.startX - (this._width * this.ratio);
|
|
}));
|
|
|
|
this._disposables.push(this._sash.onDidChange((e: ISashEvent) => {
|
|
// compute the new position of the sash and from that
|
|
// compute the new ratio that we are using
|
|
let newLeft = e.currentX - clientX;
|
|
if (newLeft > 20 && newLeft + 20 < this._width) {
|
|
this._ratio = newLeft / this._width;
|
|
this._sash.layout();
|
|
this._onDidChangePercentages.fire(this);
|
|
}
|
|
}));
|
|
}
|
|
|
|
dispose() {
|
|
this._sash.dispose();
|
|
this._onDidChangePercentages.dispose();
|
|
dispose(this._disposables);
|
|
}
|
|
|
|
get onDidChangePercentages() {
|
|
return this._onDidChangePercentages.event;
|
|
}
|
|
|
|
set width(value: number) {
|
|
this._width = value;
|
|
this._sash.layout();
|
|
}
|
|
|
|
set height(value: number) {
|
|
this._height = value;
|
|
this._sash.layout();
|
|
}
|
|
|
|
get percentages() {
|
|
let left = 100 * this._ratio;
|
|
let right = 100 - left;
|
|
return [`${left}%`, `${right}%`];
|
|
}
|
|
|
|
get ratio() {
|
|
return this._ratio;
|
|
}
|
|
}
|
|
|
|
export interface LayoutData {
|
|
ratio: number;
|
|
heightInLines: number;
|
|
}
|
|
|
|
export interface SelectionEvent {
|
|
kind: 'goto' | 'show' | 'side' | 'open';
|
|
source: 'editor' | 'tree' | 'title';
|
|
element: Location;
|
|
}
|
|
|
|
export const ctxReferenceWidgetSearchTreeFocused = new RawContextKey<boolean>('referenceSearchTreeFocused', true);
|
|
|
|
/**
|
|
* ZoneWidget that is shown inside the editor
|
|
*/
|
|
export class ReferenceWidget extends PeekViewWidget {
|
|
|
|
private _model: ReferencesModel;
|
|
private _decorationsManager: DecorationsManager;
|
|
|
|
private _disposeOnNewModel: IDisposable[] = [];
|
|
private _callOnDispose: IDisposable[] = [];
|
|
private _onDidSelectReference = new Emitter<SelectionEvent>();
|
|
|
|
private _tree: WorkbenchTree;
|
|
private _treeContainer: Builder;
|
|
private _sash: VSash;
|
|
private _preview: ICodeEditor;
|
|
private _previewModelReference: IReference<ITextEditorModel>;
|
|
private _previewNotAvailableMessage: TextModel;
|
|
private _previewContainer: Builder;
|
|
private _messageContainer: Builder;
|
|
|
|
constructor(
|
|
editor: ICodeEditor,
|
|
private _defaultTreeKeyboardSupport: boolean,
|
|
public layoutData: LayoutData,
|
|
@IThemeService themeService: IThemeService,
|
|
@ITextModelService private _textModelResolverService: ITextModelService,
|
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
|
@IUriDisplayService private _uriDisplay: IUriDisplayService
|
|
) {
|
|
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true });
|
|
|
|
this._applyTheme(themeService.getTheme());
|
|
this._callOnDispose.push(themeService.onThemeChange(this._applyTheme.bind(this)));
|
|
this.create();
|
|
}
|
|
|
|
private _applyTheme(theme: ITheme) {
|
|
let borderColor = theme.getColor(peekViewBorder) || Color.transparent;
|
|
this.style({
|
|
arrowColor: borderColor,
|
|
frameColor: borderColor,
|
|
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
|
|
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
|
|
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
|
|
});
|
|
}
|
|
|
|
public dispose(): void {
|
|
this.setModel(null);
|
|
this._callOnDispose = dispose(this._callOnDispose);
|
|
dispose<IDisposable>(this._preview, this._previewNotAvailableMessage, this._tree, this._sash, this._previewModelReference);
|
|
super.dispose();
|
|
}
|
|
|
|
get onDidSelectReference(): Event<SelectionEvent> {
|
|
return this._onDidSelectReference.event;
|
|
}
|
|
|
|
show(where: IRange) {
|
|
this.editor.revealRangeInCenterIfOutsideViewport(where, editorCommon.ScrollType.Smooth);
|
|
super.show(where, this.layoutData.heightInLines || 18);
|
|
}
|
|
|
|
focus(): void {
|
|
this._tree.domFocus();
|
|
}
|
|
|
|
protected _onTitleClick(e: MouseEvent): void {
|
|
if (this._preview && this._preview.getModel()) {
|
|
this._onDidSelectReference.fire({
|
|
element: this._getFocusedReference(),
|
|
kind: e.ctrlKey || e.metaKey || e.altKey ? 'side' : 'open',
|
|
source: 'title'
|
|
});
|
|
}
|
|
}
|
|
|
|
protected _fillBody(containerElement: HTMLElement): void {
|
|
let container = $(containerElement);
|
|
|
|
this.setCssClass('reference-zone-widget');
|
|
|
|
// message pane
|
|
container.div({ 'class': 'messages' }, div => {
|
|
this._messageContainer = div.hide();
|
|
});
|
|
|
|
// editor
|
|
container.div({ 'class': 'preview inline' }, (div: Builder) => {
|
|
|
|
let options: IEditorOptions = {
|
|
scrollBeyondLastLine: false,
|
|
scrollbar: {
|
|
verticalScrollbarSize: 14,
|
|
horizontal: 'auto',
|
|
useShadows: true,
|
|
verticalHasArrows: false,
|
|
horizontalHasArrows: false
|
|
},
|
|
overviewRulerLanes: 2,
|
|
fixedOverflowWidgets: true,
|
|
minimap: {
|
|
enabled: false
|
|
}
|
|
};
|
|
|
|
this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, div.getHTMLElement(), options, this.editor);
|
|
this._previewContainer = div.hide();
|
|
this._previewNotAvailableMessage = TextModel.createFromString(nls.localize('missingPreviewMessage', "no preview available"));
|
|
});
|
|
|
|
// sash
|
|
this._sash = new VSash(containerElement, this.layoutData.ratio || .8);
|
|
this._sash.onDidChangePercentages(() => {
|
|
let [left, right] = this._sash.percentages;
|
|
this._previewContainer.style({ width: left });
|
|
this._treeContainer.style({ width: right });
|
|
this._preview.layout();
|
|
this._tree.layout();
|
|
this.layoutData.ratio = this._sash.ratio;
|
|
});
|
|
|
|
// tree
|
|
container.div({ 'class': 'ref-tree inline' }, (div: Builder) => {
|
|
let controller = this._instantiationService.createInstance(Controller, { keyboardSupport: this._defaultTreeKeyboardSupport, clickBehavior: ClickBehavior.ON_MOUSE_UP /* our controller already deals with this */ });
|
|
this._callOnDispose.push(controller);
|
|
|
|
let config = <tree.ITreeConfiguration>{
|
|
dataSource: this._instantiationService.createInstance(DataSource),
|
|
renderer: this._instantiationService.createInstance(Renderer),
|
|
controller,
|
|
accessibilityProvider: new AriaProvider()
|
|
};
|
|
|
|
let options: tree.ITreeOptions = {
|
|
twistiePixels: 20,
|
|
ariaLabel: nls.localize('treeAriaLabel', "References")
|
|
};
|
|
|
|
this._tree = this._instantiationService.createInstance(WorkbenchTree, div.getHTMLElement(), config, options);
|
|
|
|
ctxReferenceWidgetSearchTreeFocused.bindTo(this._tree.contextKeyService);
|
|
|
|
// listen on selection and focus
|
|
let onEvent = (element: any, kind: 'show' | 'goto' | 'side') => {
|
|
if (element instanceof OneReference) {
|
|
if (kind === 'show') {
|
|
this._revealReference(element, false);
|
|
}
|
|
this._onDidSelectReference.fire({ element, kind, source: 'tree' });
|
|
}
|
|
};
|
|
this._disposables.push(this._tree.onDidChangeFocus(event => {
|
|
if (event && event.payload && event.payload.origin === 'keyboard') {
|
|
onEvent(event.focus, 'show'); // only handle events from keyboard, mouse/touch is handled by other listeners below
|
|
}
|
|
}));
|
|
this._disposables.push(this._tree.onDidChangeSelection(event => {
|
|
if (event && event.payload && event.payload.origin === 'keyboard') {
|
|
onEvent(event.selection[0], 'goto'); // only handle events from keyboard, mouse/touch is handled by other listeners below
|
|
}
|
|
}));
|
|
this._disposables.push(controller.onDidFocus(element => onEvent(element, 'show')));
|
|
this._disposables.push(controller.onDidSelect(element => onEvent(element, 'goto')));
|
|
this._disposables.push(controller.onDidOpenToSide(element => onEvent(element, 'side')));
|
|
|
|
this._treeContainer = div.hide();
|
|
});
|
|
}
|
|
|
|
protected _doLayoutBody(heightInPixel: number, widthInPixel: number): void {
|
|
super._doLayoutBody(heightInPixel, widthInPixel);
|
|
|
|
const height = heightInPixel + 'px';
|
|
this._sash.height = heightInPixel;
|
|
this._sash.width = widthInPixel;
|
|
|
|
// set height/width
|
|
const [left, right] = this._sash.percentages;
|
|
this._previewContainer.style({ height, width: left });
|
|
this._treeContainer.style({ height, width: right });
|
|
|
|
// forward
|
|
this._tree.layout(heightInPixel);
|
|
this._preview.layout();
|
|
|
|
// store layout data
|
|
this.layoutData = {
|
|
heightInLines: this._viewZone.heightInLines,
|
|
ratio: this._sash.ratio
|
|
};
|
|
}
|
|
|
|
public _onWidth(widthInPixel: number): void {
|
|
this._sash.width = widthInPixel;
|
|
this._preview.layout();
|
|
}
|
|
|
|
public setSelection(selection: OneReference): Promise<any> {
|
|
return this._revealReference(selection, true).then(() => {
|
|
|
|
// show in tree
|
|
this._tree.setSelection([selection]);
|
|
this._tree.setFocus(selection);
|
|
});
|
|
}
|
|
|
|
public setModel(newModel: ReferencesModel): TPromise<any> {
|
|
// clean up
|
|
this._disposeOnNewModel = dispose(this._disposeOnNewModel);
|
|
this._model = newModel;
|
|
if (this._model) {
|
|
return this._onNewModel();
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
private _onNewModel(): TPromise<any> {
|
|
|
|
if (this._model.empty) {
|
|
this.setTitle('');
|
|
this._messageContainer.innerHtml(nls.localize('noResults', "No results")).show();
|
|
return TPromise.as(void 0);
|
|
}
|
|
|
|
this._messageContainer.hide();
|
|
this._decorationsManager = new DecorationsManager(this._preview, this._model);
|
|
this._disposeOnNewModel.push(this._decorationsManager);
|
|
|
|
// listen on model changes
|
|
this._disposeOnNewModel.push(this._model.onDidChangeReferenceRange(reference => this._tree.refresh(reference)));
|
|
|
|
// listen on editor
|
|
this._disposeOnNewModel.push(this._preview.onMouseDown(e => {
|
|
const { event, target } = e;
|
|
if (event.detail === 2) {
|
|
this._onDidSelectReference.fire({
|
|
element: { uri: this._getFocusedReference().uri, range: target.range },
|
|
kind: (event.ctrlKey || event.metaKey || event.altKey) ? 'side' : 'open',
|
|
source: 'editor'
|
|
});
|
|
}
|
|
}));
|
|
|
|
// make sure things are rendered
|
|
dom.addClass(this.container, 'results-loaded');
|
|
this._treeContainer.show();
|
|
this._previewContainer.show();
|
|
this._preview.layout();
|
|
this._tree.layout();
|
|
this.focus();
|
|
|
|
// pick input and a reference to begin with
|
|
const input = this._model.groups.length === 1 ? this._model.groups[0] : this._model;
|
|
return this._tree.setInput(input);
|
|
}
|
|
|
|
private _getFocusedReference(): OneReference {
|
|
const element = this._tree.getFocus();
|
|
if (element instanceof OneReference) {
|
|
return element;
|
|
} else if (element instanceof FileReferences) {
|
|
if (element.children.length > 0) {
|
|
return element.children[0];
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
private async _revealReference(reference: OneReference, revealParent: boolean): Promise<void> {
|
|
|
|
// Update widget header
|
|
if (reference.uri.scheme !== Schemas.inMemory) {
|
|
this.setTitle(basenameOrAuthority(reference.uri), this._uriDisplay.getLabel(dirname(reference.uri), false));
|
|
} else {
|
|
this.setTitle(nls.localize('peekView.alternateTitle', "References"));
|
|
}
|
|
|
|
const promise = this._textModelResolverService.createModelReference(reference.uri);
|
|
|
|
if (revealParent) {
|
|
await this._tree.reveal(reference.parent);
|
|
}
|
|
|
|
return TPromise.join([promise, this._tree.reveal(reference)]).then(values => {
|
|
const ref = values[0];
|
|
|
|
if (!this._model) {
|
|
ref.dispose();
|
|
// disposed
|
|
return;
|
|
}
|
|
|
|
dispose(this._previewModelReference);
|
|
|
|
// show in editor
|
|
const model = ref.object;
|
|
if (model) {
|
|
this._previewModelReference = ref;
|
|
let isSameModel = (this._preview.getModel() === model.textEditorModel);
|
|
this._preview.setModel(model.textEditorModel);
|
|
let sel = Range.lift(reference.range).collapseToStart();
|
|
this._preview.setSelection(sel);
|
|
this._preview.revealRangeInCenter(sel, isSameModel ? editorCommon.ScrollType.Smooth : editorCommon.ScrollType.Immediate);
|
|
} else {
|
|
this._preview.setModel(this._previewNotAvailableMessage);
|
|
ref.dispose();
|
|
}
|
|
}, onUnexpectedError);
|
|
}
|
|
}
|
|
|
|
// theming
|
|
|
|
export const peekViewTitleBackground = registerColor('peekViewTitle.background', { dark: '#1E1E1E', light: '#FFFFFF', hc: '#0C141F' }, nls.localize('peekViewTitleBackground', 'Background color of the peek view title area.'));
|
|
export const peekViewTitleForeground = registerColor('peekViewTitleLabel.foreground', { dark: '#FFFFFF', light: '#333333', hc: '#FFFFFF' }, nls.localize('peekViewTitleForeground', 'Color of the peek view title.'));
|
|
export const peekViewTitleInfoForeground = registerColor('peekViewTitleDescription.foreground', { dark: '#ccccccb3', light: '#6c6c6cb3', hc: '#FFFFFF99' }, nls.localize('peekViewTitleInfoForeground', 'Color of the peek view title info.'));
|
|
export const peekViewBorder = registerColor('peekView.border', { dark: '#007acc', light: '#007acc', hc: contrastBorder }, nls.localize('peekViewBorder', 'Color of the peek view borders and arrow.'));
|
|
|
|
export const peekViewResultsBackground = registerColor('peekViewResult.background', { dark: '#252526', light: '#F3F3F3', hc: Color.black }, nls.localize('peekViewResultsBackground', 'Background color of the peek view result list.'));
|
|
export const peekViewResultsMatchForeground = registerColor('peekViewResult.lineForeground', { dark: '#bbbbbb', light: '#646465', hc: Color.white }, nls.localize('peekViewResultsMatchForeground', 'Foreground color for line nodes in the peek view result list.'));
|
|
export const peekViewResultsFileForeground = registerColor('peekViewResult.fileForeground', { dark: Color.white, light: '#1E1E1E', hc: Color.white }, nls.localize('peekViewResultsFileForeground', 'Foreground color for file nodes in the peek view result list.'));
|
|
export const peekViewResultsSelectionBackground = registerColor('peekViewResult.selectionBackground', { dark: '#3399ff33', light: '#3399ff33', hc: null }, nls.localize('peekViewResultsSelectionBackground', 'Background color of the selected entry in the peek view result list.'));
|
|
export const peekViewResultsSelectionForeground = registerColor('peekViewResult.selectionForeground', { dark: Color.white, light: '#6C6C6C', hc: Color.white }, nls.localize('peekViewResultsSelectionForeground', 'Foreground color of the selected entry in the peek view result list.'));
|
|
export const peekViewEditorBackground = registerColor('peekViewEditor.background', { dark: '#001F33', light: '#F2F8FC', hc: Color.black }, nls.localize('peekViewEditorBackground', 'Background color of the peek view editor.'));
|
|
export const peekViewEditorGutterBackground = registerColor('peekViewEditorGutter.background', { dark: peekViewEditorBackground, light: peekViewEditorBackground, hc: peekViewEditorBackground }, nls.localize('peekViewEditorGutterBackground', 'Background color of the gutter in the peek view editor.'));
|
|
|
|
export const peekViewResultsMatchHighlight = registerColor('peekViewResult.matchHighlightBackground', { dark: '#ea5c004d', light: '#ea5c004d', hc: null }, nls.localize('peekViewResultsMatchHighlight', 'Match highlight color in the peek view result list.'));
|
|
export const peekViewEditorMatchHighlight = registerColor('peekViewEditor.matchHighlightBackground', { dark: '#ff8f0099', light: '#f5d802de', hc: null }, nls.localize('peekViewEditorMatchHighlight', 'Match highlight color in the peek view editor.'));
|
|
export const peekViewEditorMatchHighlightBorder = registerColor('peekViewEditor.matchHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('peekViewEditorMatchHighlightBorder', 'Match highlight border in the peek view editor.'));
|
|
|
|
|
|
registerThemingParticipant((theme, collector) => {
|
|
let findMatchHighlightColor = theme.getColor(peekViewResultsMatchHighlight);
|
|
if (findMatchHighlightColor) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree .referenceMatch { background-color: ${findMatchHighlightColor}; }`);
|
|
}
|
|
let referenceHighlightColor = theme.getColor(peekViewEditorMatchHighlight);
|
|
if (referenceHighlightColor) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .preview .reference-decoration { background-color: ${referenceHighlightColor}; }`);
|
|
}
|
|
let referenceHighlightBorder = theme.getColor(peekViewEditorMatchHighlightBorder);
|
|
if (referenceHighlightBorder) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .preview .reference-decoration { border: 2px solid ${referenceHighlightBorder}; box-sizing: border-box; }`);
|
|
}
|
|
let hcOutline = theme.getColor(activeContrastBorder);
|
|
if (hcOutline) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree .referenceMatch { border: 1px dotted ${hcOutline}; box-sizing: border-box; }`);
|
|
}
|
|
let resultsBackground = theme.getColor(peekViewResultsBackground);
|
|
if (resultsBackground) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree { background-color: ${resultsBackground}; }`);
|
|
}
|
|
let resultsMatchForeground = theme.getColor(peekViewResultsMatchForeground);
|
|
if (resultsMatchForeground) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree { color: ${resultsMatchForeground}; }`);
|
|
}
|
|
let resultsFileForeground = theme.getColor(peekViewResultsFileForeground);
|
|
if (resultsFileForeground) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree .reference-file { color: ${resultsFileForeground}; }`);
|
|
}
|
|
let resultsSelectedBackground = theme.getColor(peekViewResultsSelectionBackground);
|
|
if (resultsSelectedBackground) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree .monaco-tree.focused .monaco-tree-rows > .monaco-tree-row.selected:not(.highlighted) { background-color: ${resultsSelectedBackground}; }`);
|
|
}
|
|
let resultsSelectedForeground = theme.getColor(peekViewResultsSelectionForeground);
|
|
if (resultsSelectedForeground) {
|
|
collector.addRule(`.monaco-editor .reference-zone-widget .ref-tree .monaco-tree.focused .monaco-tree-rows > .monaco-tree-row.selected:not(.highlighted) { color: ${resultsSelectedForeground} !important; }`);
|
|
}
|
|
let editorBackground = theme.getColor(peekViewEditorBackground);
|
|
if (editorBackground) {
|
|
collector.addRule(
|
|
`.monaco-editor .reference-zone-widget .preview .monaco-editor .monaco-editor-background,` +
|
|
`.monaco-editor .reference-zone-widget .preview .monaco-editor .inputarea.ime-input {` +
|
|
` background-color: ${editorBackground};` +
|
|
`}`);
|
|
}
|
|
let editorGutterBackground = theme.getColor(peekViewEditorGutterBackground);
|
|
if (editorGutterBackground) {
|
|
collector.addRule(
|
|
`.monaco-editor .reference-zone-widget .preview .monaco-editor .margin {` +
|
|
` background-color: ${editorGutterBackground};` +
|
|
`}`);
|
|
}
|
|
});
|