add a tooltip to the encoding status view #45
Conversation
Right now the wording is: |
lib/encoding-status-view.js
Outdated
if(this.toolTip) { | ||
this.toolTip.dispose() | ||
} | ||
this.toolTip = atom.tooltips.add(this.encodingLink, {title: 'File displayed using ' + encodingLabel.list + ' encoding'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we generally use this.tooltip
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's better. Changed.
lib/encoding-status-view.js
Outdated
@@ -64,6 +68,11 @@ export default class EncodingStatusView { | |||
this.encodingLink.textContent = encodingLabel.status | |||
this.encodingLink.dataset.encoding = editorEncoding | |||
this.element.style.display = '' | |||
|
|||
if(this.tooltip) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a space between if and (
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. And installed the linter-js-standard package.
lib/encoding-status-view.js
Outdated
if(this.tooltip) { | ||
this.tooltip.dispose() | ||
} | ||
this.tooltip = atom.tooltips.add(this.encodingLink, {title: 'File displayed using ' + encodingLabel.list + ' encoding'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if 'displayed' is the right word. It's parsed with the encoding so if you change encoding and save it you can lose information. Displayed sounds like it's completely passive. Also consider using string interpolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point. Changed to This file uses UTF-8 encoding
.
I wasn't sure I wanted to be the first to use interpolation in this package... but it works fine. :)
Requirements
Description of the Change
This PR adds a tooltip to the status bar indicator.
Alternate Designs
No other designs were considered. Happy to make changes.
Benefits
Unfamiliar users will be reassured that, yes, this indicator does refer to the file being edited.
Also, most status bar items have tooltips. This offers a bit of reassuring consistency.
Possible Drawbacks
Maybe I'll leak the tooltip if I missed a place where it needs to be disposed?
Applicable Issues
#26