aurmer / atom-snowflake-buddy

Other
1 stars 0 forks source link

Uncaught TypeError: Cannot read property 'markBufferRange' of undefined #7

Open gauraklein opened 4 years ago

gauraklein commented 4 years ago

I get this error anytime I use an snowflake buddy suggestion, in one particular .scss file. As far as I can tell the only unique thing about the file that throws the error is that it is 2600 lines.

Atom: 1.49.0 x64 Electron: 5.0.13 OS: Mac OS X 10.14.1 Thrown From: snowflake-buddy package 1.0.1

Stack Trace

Uncaught TypeError: Cannot read property 'markBufferRange' of undefined

At /Users/gauraAdmin/.atom/packages/snowflake-buddy/lib/flake-decorator.js:59

TypeError: Cannot read property 'markBufferRange' of undefined
    at markValidMatches (/packages/snowflake-buddy/lib/flake-decorator.js:59:26)
    at TextBuffer.scanInRange (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:494884)
    at /packages/snowflake-buddy/lib/flake-decorator.js:103:18
    at Array.forEach (<anonymous>)
    at watchChanges (/packages/snowflake-buddy/lib/flake-decorator.js:94:19)
    at Function.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1201500)
    at Emitter.emit (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1202941)
    at TextBuffer.emitDidChangeTextEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:505061)
    at TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:493171)
    at TextEditor.transact (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:24215)
    at AutocompleteManager.replaceTextWithMatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:654940)
    at AutocompleteManager.confirm (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:653923)
    at /Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:647027
    at Function.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1201500)
    at Emitter.emit (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1202941)
    at SuggestionList.confirm (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:14:497430)
    at SuggestionListElement.confirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:14:1423947)
    at Function.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1201500)
    at Emitter.emit (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1202941)
    at SuggestionList.confirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:14:497491)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:349781)
    at KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1242286)
    at KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1238420)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:284830)

Commands

     -1:28.9.0 core:paste (input.hidden-input)
     -1:28.3.0 core:save (input.hidden-input)
  2x -1:20.9.0 editor:delete-to-beginning-of-line (input.hidden-input)
     -1:20 core:save (input.hidden-input)
     -0:47.6.0 vim-mode-plus:move-to-previous-word (input.hidden-input)
     -0:38.1.0 vim-mode-plus:delete (input.hidden-input)
     -0:37.8.0 vim-mode-plus:move-to-next-word (input.hidden-input)
     -0:36.8.0 vim-mode-plus:move-to-previous-word (input.hidden-input)
     -0:36.3.0 vim-mode-plus:delete (input.hidden-input)
     -0:36.3.0 vim-mode-plus:move-to-next-word (input.hidden-input)
     -0:35.8.0 vim-mode-plus:delete (input.hidden-input)
     -0:35.8.0 vim-mode-plus:move-to-next-word (input.hidden-input)
     -0:34.4.0 vim-mode-plus:insert-after (input.hidden-input)
     -0:26.1.0 snowflake-buddy:generate-hextail (input.hidden-input)
     -0:10.2.0 autocomplete-plus:confirm (input.hidden-input)
     -0:08.4.0 core:save (input.hidden-input)

Non-Core Packages

delete-lines 0.5.0 
parinfer 1.23.0 
snowflake-buddy 1.0.1 
vim-mode-plus 1.36.4 
aurmer commented 4 years ago

Okay, large files could be a problem. I will look into this.

gauraklein commented 4 years ago

Awesome! The extension is working great other wise!

aurmer commented 4 years ago

Don't have a lot of time right now. Was working in VS Code and got a popup saying "buffer too large, disabling XYZ"

I could start with this. If a file is >N Bytes, the typing detection can ignore the file. (Mind you, the CLI tool will still pick up existing flakes in those files once they are saved.)

This way you can open large files without having to disable the package.

aurmer commented 4 years ago

Gaura, any chance I can get a file from you that reliably causes this problem?

gauraklein commented 4 years ago

Hey, it's a work file so I can't share it but Chris doesn't have that issue with the same file. Chris' guess was that it was probably something to do with the other extensions I'm using. I'll be back in the snowflake project next week so will experiment with my local set up and see what happens

oakmac commented 3 years ago

FYI - I am seeing this error today on a CSS file that is less than 200 loc.

aurmer commented 3 years ago

Thanks. I will add a type check as a patch.

aurmer commented 3 years ago

@oakmac, can you also provide runtime context for the error?

oakmac commented 3 years ago

@oakmac, can you also provide runtime context for the error?

I can't think of anything out of the ordinary. I had two buffers open: one was a CSS file and the other was application code that contained snowflake hashes (templates file).

These buffers had been open for a long time (think: greater than one week) and I had not used that instance of Atom in a while. Maybe that was related?