-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: this.tokenLinesForScreenRows is not a function #481
Comments
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 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:
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'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. |
I hope it’ll provide some insight on what’s happening with #481
[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
The text was updated successfully, but these errors were encountered: