提交 6f5033a7 编写于 作者: S Sandeep Somavarapu

#7247 show marker source information

上级 09a5e7f8
...@@ -35,17 +35,6 @@ ...@@ -35,17 +35,6 @@
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
justify-content: flex-start;
}
.vs-dark .monaco-inputbox > .wrapper {
background-color: var(--input-bgcolor);
}
.monaco-inputbox > .wrapper .icon {
width: 16px;
height: 22px;
} }
.monaco-inputbox > .wrapper > .input { .monaco-inputbox > .wrapper > .input {
......
...@@ -27,7 +27,6 @@ export interface IInputOptions { ...@@ -27,7 +27,6 @@ export interface IInputOptions {
validationOptions?: IInputValidationOptions; validationOptions?: IInputValidationOptions;
flexibleHeight?: boolean; flexibleHeight?: boolean;
actions?: IAction[]; actions?: IAction[];
iconClass?: string;
} }
export interface IInputValidator { export interface IInputValidator {
...@@ -97,9 +96,6 @@ export class InputBox extends Widget { ...@@ -97,9 +96,6 @@ export class InputBox extends Widget {
let tagName = this.options.flexibleHeight ? 'textarea' : 'input'; let tagName = this.options.flexibleHeight ? 'textarea' : 'input';
let wrapper = dom.append(this.element, $('.wrapper')); let wrapper = dom.append(this.element, $('.wrapper'));
if (this.options.iconClass) {
dom.append(wrapper, $('span.icon.' + this.options.iconClass));
}
this.input = <HTMLInputElement>dom.append(wrapper, $(tagName + '.input')); this.input = <HTMLInputElement>dom.append(wrapper, $(tagName + '.input'));
this.input.setAttribute('autocorrect', 'off'); this.input.setAttribute('autocorrect', 'off');
this.input.setAttribute('autocapitalize', 'off'); this.input.setAttribute('autocapitalize', 'off');
......
...@@ -37,8 +37,7 @@ export class FilterInputBoxActionItem extends BaseActionItem { ...@@ -37,8 +37,7 @@ export class FilterInputBoxActionItem extends BaseActionItem {
DOM.addClass(container, 'markers-panel-action-filter'); DOM.addClass(container, 'markers-panel-action-filter');
var filterInputBox = new InputBox(container, this.contextViewService, { var filterInputBox = new InputBox(container, this.contextViewService, {
placeholder: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER, placeholder: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER,
ariaLabel: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER, ariaLabel: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER
iconClass: 'filterIcon'
}); });
filterInputBox.value= this.markersPanel.markersModel.filterOptions.completeFilter; filterInputBox.value= this.markersPanel.markersModel.filterOptions.completeFilter;
this.toDispose.push(filterInputBox.onDidChange((filter: string) => { this.toDispose.push(filterInputBox.onDidChange((filter: string) => {
......
...@@ -27,8 +27,9 @@ interface IResourceTemplateData { ...@@ -27,8 +27,9 @@ interface IResourceTemplateData {
interface IMarkerTemplateData { interface IMarkerTemplateData {
icon: HTMLElement; icon: HTMLElement;
line: HTMLElement;
description: HighlightedLabel; description: HighlightedLabel;
lnCol: HTMLElement;
source: HighlightedLabel;
} }
export class DataSource implements IDataSource { export class DataSource implements IDataSource {
...@@ -115,8 +116,9 @@ export class Renderer implements IRenderer { ...@@ -115,8 +116,9 @@ export class Renderer implements IRenderer {
private renderMarkerTemplate(container: HTMLElement): IMarkerTemplateData { private renderMarkerTemplate(container: HTMLElement): IMarkerTemplateData {
var data: IMarkerTemplateData = Object.create(null); var data: IMarkerTemplateData = Object.create(null);
data.icon = dom.append(container, dom.emmet('.marker-icon')); data.icon = dom.append(container, dom.emmet('.marker-icon'));
data.line = dom.append(container, dom.emmet('span.marker-line'));
data.description = new HighlightedLabel(dom.append(container, dom.emmet('.marker-description'))); data.description = new HighlightedLabel(dom.append(container, dom.emmet('.marker-description')));
data.lnCol = dom.append(container, dom.emmet('span.marker-line'));
data.source = new HighlightedLabel(dom.append(container, dom.emmet('.marker-source')));
return data; return data;
} }
...@@ -138,8 +140,19 @@ export class Renderer implements IRenderer { ...@@ -138,8 +140,19 @@ export class Renderer implements IRenderer {
private renderMarkerElement(tree: ITree, element: Marker, templateData: IMarkerTemplateData) { private renderMarkerElement(tree: ITree, element: Marker, templateData: IMarkerTemplateData) {
let marker= element.marker; let marker= element.marker;
templateData.icon.className = 'icon ' + Renderer.iconClassNameFor(marker); templateData.icon.className = 'icon ' + Renderer.iconClassNameFor(marker);
templateData.line.textContent= Messages.MARKERS_PANEL_AT_LINE_NUMBER(marker.startLineNumber);
templateData.description.set(marker.message, element.labelMatches); templateData.description.set(marker.message, element.labelMatches);
templateData.lnCol.textContent= Messages.MARKERS_PANEL_AT_LINE_COL_NUMBER(marker.startLineNumber, marker.startColumn);
let title= Messages.MARKERS_PANEL_TITLE_AT_LINE_COL_NUMBER(marker.startLineNumber, marker.startColumn);
templateData.lnCol.title= title;
templateData.lnCol.setAttribute('aria-label', title);
if (marker.source) {
templateData.source.set(marker.source, element.sourceMatches);
let title= Messages.MARKERS_PANEL_TITLE_SOURCE(marker.source);
templateData.source.element.title= title;
templateData.source.element.setAttribute('aria-label', title);
}
} }
private static iconClassNameFor(element: IMarker): string { private static iconClassNameFor(element: IMarker): string {
......
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><style type="text/css">.icon-canvas-transparent{opacity:0;fill:#F6F6F6;} .icon-vs-out{fill:#F6F6F6;} .icon-vs-bg{fill:#424242;}</style><path class="icon-canvas-transparent" d="M16 16h-16v-16h16v16z" id="canvas"/><path class="icon-vs-out" d="M6 16v-5.955l-5.992-8.045h15.983l-5.991 8.045v5.955h-4z" id="outline"/><path class="icon-vs-bg" d="M14 3l-5 6.714v5.286h-2v-5.286l-5-6.714h12z" id="iconBg"/></svg>
\ No newline at end of file
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
} }
.markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry { .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry {
display: flex;
line-height: 22px; line-height: 22px;
} }
...@@ -57,16 +58,24 @@ ...@@ -57,16 +58,24 @@
} }
.markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-description { .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-description {
margin-left: 3px; width: 90%;
} }
.markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .resource-label-container .highlight, .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-line,
.markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-description .highlight { .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-source {
opacity: 0.6;
font-size: 85%;
margin-right: 5px;
width: 10em;
overflow: hidden;
text-overflow: ellipsis
}
.markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .highlight {
background-color: rgba(234, 92, 0, 0.3); background-color: rgba(234, 92, 0, 0.3);
} }
.hc-black .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .resource-label-container .highlight, .hc-black .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .highlight {
.hc-black .markers-panel .markers-panel-container .tree-container .markers-panel-tree-entry .marker-description .highlight {
background: none !important; background: none !important;
border: 1px dotted #f38518; border: 1px dotted #f38518;
} }
...@@ -84,8 +93,6 @@ ...@@ -84,8 +93,6 @@
background: url('status-warning.svg') center center no-repeat; background: url('status-warning.svg') center center no-repeat;
} }
.markers-panel-action-toggle-errors-on,
.markers-panel-action-toggle-errors-off,
.markers-panel .icon.error { .markers-panel .icon.error {
background: url('status-error.svg') center center no-repeat; background: url('status-error.svg') center center no-repeat;
} }
...@@ -98,8 +105,6 @@ ...@@ -98,8 +105,6 @@
background: url('status-warning-inverse.svg') center center no-repeat; background: url('status-warning-inverse.svg') center center no-repeat;
} }
.vs-dark .markers-panel-action-toggle-errors-on,
.vs-dark .markers-panel-action-toggle-errors-off,
.vs-dark .markers-panel .icon.error { .vs-dark .markers-panel .icon.error {
background: url('status-error-inverse.svg') center center no-repeat; background: url('status-error-inverse.svg') center center no-repeat;
} }
......
...@@ -12,7 +12,7 @@ import Severity from 'vs/base/common/severity'; ...@@ -12,7 +12,7 @@ import Severity from 'vs/base/common/severity';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { IMarker, MarkerStatistics } from 'vs/platform/markers/common/markers'; import { IMarker, MarkerStatistics } from 'vs/platform/markers/common/markers';
import {IFilter, IMatch, or, matchesContiguousSubString, matchesPrefix} from 'vs/base/common/filters'; import {IFilter, IMatch, or, matchesContiguousSubString, matchesPrefix, matchesFuzzy} from 'vs/base/common/filters';
import Messages from 'vs/workbench/parts/markers/common/messages'; import Messages from 'vs/workbench/parts/markers/common/messages';
export class Resource { export class Resource {
...@@ -27,12 +27,15 @@ export class Resource { ...@@ -27,12 +27,15 @@ export class Resource {
} }
export class Marker { export class Marker {
constructor(public id:string, public marker: IMarker, public labelMatches: IMatch[] = []){} constructor(public id:string, public marker: IMarker,
public labelMatches: IMatch[] = [],
public sourceMatches: IMatch[] = []){}
} }
export class FilterOptions { export class FilterOptions {
static _filter: IFilter = or(matchesPrefix, matchesContiguousSubString); static _filter: IFilter = or(matchesPrefix, matchesContiguousSubString);
static _fuzzyFilter: IFilter = or(matchesPrefix, matchesContiguousSubString, matchesFuzzy);
private _filterErrors: boolean= false; private _filterErrors: boolean= false;
private _filterWarnings: boolean= false; private _filterWarnings: boolean= false;
...@@ -191,8 +194,9 @@ export class MarkersModel { ...@@ -191,8 +194,9 @@ export class MarkersModel {
} }
private toMarker(marker: IMarker, index: number):Marker { private toMarker(marker: IMarker, index: number):Marker {
const labelMatches = FilterOptions._filter(this._filterOptions.filter, marker.message); const labelMatches = FilterOptions._fuzzyFilter(this._filterOptions.filter, marker.message);
return new Marker(marker.resource.toString() + index, marker, labelMatches || []); const sourceMatches = !!marker.source ? FilterOptions._filter(this._filterOptions.filter, marker.source) : [];
return new Marker(marker.resource.toString() + index, marker, labelMatches || [], sourceMatches || []);
} }
private filterMarker(marker: IMarker):boolean { private filterMarker(marker: IMarker):boolean {
...@@ -206,12 +210,15 @@ export class MarkersModel { ...@@ -206,12 +210,15 @@ export class MarkersModel {
if (this._filterOptions.filterInfos && Severity.Info === marker.severity) { if (this._filterOptions.filterInfos && Severity.Info === marker.severity) {
return true; return true;
} }
if (!!FilterOptions._filter(this._filterOptions.filter, marker.message)) { if (!!FilterOptions._fuzzyFilter(this._filterOptions.filter, marker.message)) {
return true; return true;
} }
if (!!FilterOptions._filter(this._filterOptions.filter, paths.basename(marker.resource.fsPath))) { if (!!FilterOptions._filter(this._filterOptions.filter, paths.basename(marker.resource.fsPath))) {
return true; return true;
} }
if (!!marker.source && !!FilterOptions._filter(this._filterOptions.filter, marker.source)) {
return true;
}
return false; return false;
} }
return true; return true;
......
...@@ -31,5 +31,7 @@ export default class Messages { ...@@ -31,5 +31,7 @@ export default class Messages {
public static MARKERS_PANEL_SINGLE_UNKNOWN_LABEL:string= nls.localize('markers.panel.single.unknown.label', "1 Unknown"); public static MARKERS_PANEL_SINGLE_UNKNOWN_LABEL:string= nls.localize('markers.panel.single.unknown.label', "1 Unknown");
public static MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=(noOfUnknowns: number):string=>{return nls.localize('markers.panel.multiple.unknowns.label', "{0} Unknowns", ''+noOfUnknowns);}; public static MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=(noOfUnknowns: number):string=>{return nls.localize('markers.panel.multiple.unknowns.label', "{0} Unknowns", ''+noOfUnknowns);};
public static MARKERS_PANEL_AT_LINE_NUMBER= (lineNumber: number):string=>{return nls.localize('markers.panel.at.line.number', "Line {0}:", '' + lineNumber);} public static MARKERS_PANEL_AT_LINE_COL_NUMBER= (ln: number, col: number):string=>{return nls.localize('markers.panel.at.ln.col.number', "Ln {0}, Col {1}", '' + ln, '' + col);}
public static MARKERS_PANEL_TITLE_AT_LINE_COL_NUMBER= (ln: number, col: number):string=>{return nls.localize('markers.panel.title.at.ln.col.number', "At line {0}, column {1}", '' + ln, '' + col);}
public static MARKERS_PANEL_TITLE_SOURCE= (source: string):string=>{return nls.localize('markers.panel.title.source', "Built by {0}", source);}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册