Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Show context in messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lierdakil committed Mar 27, 2017
1 parent de66b13 commit 2b18604
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion decl/results-db/result-item.d.ts
Expand Up @@ -7,15 +7,17 @@ export interface IResultItem {
position?: TPosition;
message: TMessage;
severity: TSeverity;
context?: string;
}
export declare class ResultItem {
readonly providerId: number;
readonly uri?: string;
readonly position?: Point;
readonly message: MessageObject;
readonly severity: TSeverity;
readonly context?: string;
private _isValid;
constructor(providerId: number, {uri, message, severity, position}: IResultItem);
constructor(providerId: number, {uri, message, severity, position, context}: IResultItem);
isValid(): boolean;
setValid(isValid: boolean): void;
hash(): string;
Expand Down
3 changes: 2 additions & 1 deletion lib/output-panel/views/output-panel-item.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions lib/results-db/result-item.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/output-panel/views/output-panel-item.tsx
Expand Up @@ -10,6 +10,7 @@ export class OutputPanelItem {
return (
<ide-haskell-panel-item>
{this.renderPosition()}
<ide-haskell-item-context>{this.props.model.context || ""}</ide-haskell-item-context>
<ide-haskell-item-description innerHTML={this.props.model.message.toHtml()}/>
</ide-haskell-panel-item>
)
Expand Down
8 changes: 6 additions & 2 deletions src/results-db/result-item.ts
Expand Up @@ -10,19 +10,22 @@ export interface IResultItem {
position?: TPosition
message: TMessage
severity: TSeverity
context?: string
}

export class ResultItem {
public readonly uri?: string
public readonly position?: Point
public readonly message: MessageObject
public readonly severity: TSeverity
public readonly context?: string
private _isValid: boolean
constructor (public readonly providerId: number, {uri, message, severity, position}: IResultItem) {
constructor (public readonly providerId: number, {uri, message, severity, position, context}: IResultItem) {
this.uri = uri
this.message = MessageObject.fromObject(message)
this.severity = severity
this.position = position && Point.fromObject(position)
this.context = context
this._isValid = true
}

Expand All @@ -38,7 +41,8 @@ export class ResultItem {
const h = createHash('md5')
h.update(JSON.stringify({
uri: this.uri, position: this.position && this.position.serialize(),
message: this.message.raw(), severity: this.severity
message: this.message.raw(), severity: this.severity,
context: this.context
}))
return h.digest('latin1')
}
Expand Down
8 changes: 7 additions & 1 deletion styles/ide-haskell.less
Expand Up @@ -332,7 +332,13 @@ ide-haskell-panel {

ide-haskell-item-position {
cursor: pointer;
display: block;
display: inline-block;
}

ide-haskell-item-context {
display: inline-block;
font-family: Consolas, monospace;
margin-left: 1em;
}

ide-haskell-item-description {
Expand Down

0 comments on commit 2b18604

Please sign in to comment.