Open ikari7789 opened 8 years ago
Hi @ikari7789, that's weird, because the function definitely exist (https://github.com/atom-minimap/minimap/blob/master/lib/mixins/canvas-drawer.js#L413-L460) it looks like you're still running the old code after updating the package from within Atom, can you confirm it?
How could I confirm it? Sorry, I'm not very familiar with the plugin system in Atom beyond the GUI.
You can find the source of all the package you have installed in ~/.atom/packages
, so there should be a tokenLinesForScreenRows
in the lib/mixins/canvas-drawer.js
file of the minimap package.
If I guess correctly the file should have the method, and restarting/reloading Atom should solve this issue.
It is there in my package and I'm no longer receiving the error message. If it pops up again I'll make a new ticket. Thanks for the help!
Actually... It just happened again and I've definitely restarted Atom several times. I'm not sure what could be causing it. It doesn't seem to happen on small files, but has been popping up on large files, the one I'm using to test with in particular is 33,880 lines. The error pops up when I reach the bottom of the file.
P35040:~ andrew.miller$ grep --line-number --context=5 --color=always 'tokenLinesForScreenRows' /Users/andrew.miller/.atom/packages/minimap/lib/mixins/canvas-drawer.js
408- * @param {number} startRow The start row
409- * @param {number} endRow The end row
410- * @return {Array<Array>} An array of tokens by line
411- * @access private
412- */
413: tokenLinesForScreenRows (startRow, endRow) {
414- const editor = this.getTextEditor()
415- let tokenLines = []
416- if (typeof editor.tokenizedLinesForScreenRows === 'function') {
417- for (let tokenizedLine of editor.tokenizedLinesForScreenRows(startRow, endRow)) {
418- if (tokenizedLine) {
--
--
481- const displayCodeHighlights = this.displayCodeHighlights
482- const context = this.tokensLayer.context
483- const {width: canvasWidth} = this.tokensLayer.getSize()
484-
485- let y = offsetRow * lineHeight
486: for (let tokens of this.tokenLinesForScreenRows(firstRow, lastRow)) {
487- let x = 0
488- context.clearRect(x, y, canvasWidth, lineHeight)
489- for (let token of tokens) {
490- if (/^\s+$/.test(token.value)) {
491- x += token.value.length * charWidth
That's really weird, but thanks for the investigation, I'll see if I can at least add some guards against this issue. Maybe it's just that the function is called with another context object that isn't a minimap element instance.
Same issue here, find stack trace below:
/C:/Users/mthorade/.atom/packages/minimap/lib/mixins/canvas-drawer.js:588
Hide Stack Trace
TypeError: this.tokenLinesForScreenRows is not a function
at atom-text-editor-minimap.drawLines (C:/Users/mthorade/.atom/packages/minimap/lib/mixins/canvas-drawer.js:486:29)
at atom-text-editor-minimap.redrawRangesOnLayer (C:/Users/mthorade/.atom/packages/minimap/lib/mixins/canvas-drawer.js:270:14)
at atom-text-editor-minimap.updateTokensLayer (C:/Users/mthorade/.atom/packages/minimap/lib/mixins/canvas-drawer.js:136:10)
at atom-text-editor-minimap.updateCanvas (C:/Users/mthorade/.atom/packages/minimap/lib/mixins/canvas-drawer.js:104:10)
at atom-text-editor-minimap.update (C:/Users/mthorade/.atom/packages/minimap/lib/minimap-element.js:846:10)
at C:/Users/mthorade/.atom/packages/minimap/lib/minimap-element.js:740:12
This happened when opening a 40K lines html file.
(Atom 1.7.3, minimap 4.23.5, Windows 10 64bit)
I get this, too. But it only happens to me when scrolling down to the end of a large file. (A file that's well over 1000 lines).
I get this, too. But it only happens to me when scrolling down to the end of a large file. (A file that's well over 1000 lines).
☝️ I've seen this with one file, which has over 12k lines, and it comes up after minimap reaches the very bottom of the file and can't scroll any further. I'm not familiar with the code but thought I would add some color after seeing this issue.
I've reopened the issue. Sorry for the delay, I'll plan to work on this during this week-end.
FYI, the latest update (4.24.0) still has this defect.
[Enter steps to reproduce below:]
Atom Version: 1.7.3 System: Mac OS X 10.11.4 Thrown From: minimap package, v4.23.5
Stack Trace
Uncaught TypeError: this.tokenLinesForScreenRows is not a function
Commands
Config
Installed Packages