atom-react icon indicating copy to clipboard operation
atom-react copied to clipboard

Uncaught TypeError: Cannot read property 'scopeDescriptorForBufferPosition' of undefined

Open jaucourt opened this issue 9 years ago • 24 comments

[Enter steps to reproduce:]

  1. Editing jsx file
  2. Pressed return, error occurred. Still able to enter other characters, just not line feed Doesn't occur in js file, just jsx

Atom: 1.22.0-beta1 x64 Electron: 1.6.15 OS: Mac OS X 10.12.6 Thrown From: react package 0.16.2

Stack Trace

Uncaught TypeError: Cannot read property 'scopeDescriptorForBufferPosition' of undefined

At /Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:959

TypeError: Cannot read property 'scopeDescriptorForBufferPosition' of undefined
    at TokenizedBuffer.editor.languageMode.suggestedIndentForBufferRow (/packages/react/lib/atom-react.coffee:78:32)
    at TextEditor.module.exports.TextEditor.suggestedIndentForBufferRow (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:3732:41)
    at TextEditor.module.exports.TextEditor.autoIndentBufferRow (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:3737:32)
    at Selection.module.exports.Selection.insertText (/Applications/Atom Beta.app/Contents/Resources/app/src/selection.js:494:27)
    at /Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1215:35
    at /Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1254:34
    at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:952:24)
    at TextEditor.module.exports.TextEditor.transact (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1687:32)
    at /Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1248:30
    at TextEditor.module.exports.TextEditor.mergeSelections (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2635:24)
    at TextEditor.module.exports.TextEditor.mergeIntersectingSelections (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2597:41)
    at TextEditor.module.exports.TextEditor.mutateSelectedText (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1246:25)
    at TextEditor.module.exports.TextEditor.insertText (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1212:25)
    at TextEditor.object.(anonymous function) [as insertText] (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/underscore-plus/lib/underscore-plus.js:77:33)
    at TextEditor.module.exports.TextEditor.insertNewline (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1227:25)
    at TextEditor.object.(anonymous function) [as insertNewline] (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/underscore-plus/lib/underscore-plus.js:77:33)
    at TextEditor.editor:newline (/Applications/Atom Beta.app/Contents/Resources/app/src/register-default-commands.js:617:27)
    at /Applications/Atom Beta.app/Contents/Resources/app/src/register-default-commands.js:677:40
    at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:952:24)
    at TextEditor.module.exports.TextEditor.transact (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1687:32)
    at HTMLElement.newCommandListeners.(anonymous function) (/Applications/Atom Beta.app/Contents/Resources/app/src/register-default-commands.js:676:28)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:381:36)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -0:17.9.0 editor:newline (input.hidden-input)

Non-Core Packages

atom-ide-ui 0.5.1 
atom-indentation-eslintrc 0.1.1 
busy-signal 1.4.3 
eslint-fixer 1.3.0 
ide-json 0.1.0 
ide-php 0.6.9 
ide-typescript 0.6.2 
intentions 1.1.5 
linter 2.2.0 
linter-eslint 8.4.0 
linter-ui-default 1.6.10 
react 0.16.2 

jaucourt avatar Oct 19 '17 12:10 jaucourt

Issue seems to be isolated - other jsx files fine and this file was ok after closing and re-opening it

jaucourt avatar Oct 19 '17 12:10 jaucourt

I got the same warning here while using it for react practice how to fix this issue? any solutions?

Niava avatar Nov 08 '17 09:11 Niava

It disappeared after I rebooted - Atom seemed to be getting itself in a mess.

jaucourt avatar Nov 08 '17 10:11 jaucourt

I'm still getting the same issue after closing all files in atom then re-booting. any one else still having this issue after rebooting?

eborada avatar Nov 08 '17 14:11 eborada

I'm experiencing the issue as well (using Atom 1.22.0).

jamesedmonston avatar Nov 08 '17 15:11 jamesedmonston

Same issue here when editing *.js file Atom v1.22.0, react package v0.16.3. Looks like a update to Atom was released this morning (on Github it was v1.22.0 was released 5 days ago) which is causing this. Temporary fix,on windows you can rollback to Atom 1.21.x by navigating to C:\Users<Username>\AppData\Local\Atom\ and removing the latest update. Disabling the package will also work. I have not tried building the binary from source since v1.23.0 is available on github but this might fix the issue to?

UPDATE: After rolling back to 1.21.x, I downloaded the latest installer from the Atom website 1.22.0 and this resolved the issue for v0.16.3. Weird. Regardless, atom-react was updated to v0.17.0 to fix the issue.

cme0848 avatar Nov 08 '17 16:11 cme0848

any workaround?

ezzkht avatar Nov 08 '17 16:11 ezzkht

Thanks cme0848, it worked :)

ezzkht avatar Nov 08 '17 16:11 ezzkht

Any solution for Mac?

devashish-patel avatar Nov 08 '17 18:11 devashish-patel

This is still broken, not sure why the issue is closed.

zackliston avatar Nov 08 '17 19:11 zackliston

I had this issue on Mac. Quitting atom entirely and reopening did not solve, however closing the individual file affected and reopening though cmd+p sorted it!

georgegillams avatar Nov 08 '17 21:11 georgegillams

@georgegillams It's a temporary hack. I did what you suggested but after some amount of time I'm facing the same problem again.

devashish-patel avatar Nov 08 '17 21:11 devashish-patel

Same issue here. No way to get rid of it.

Karzam avatar Nov 08 '17 23:11 Karzam

I worked around this by switch OFF atom-react package > JavaScript (JSX) Grammer > "Auto Indent"

and don't use tab

ericfong avatar Nov 09 '17 08:11 ericfong

Brilliant! This works for me and issue solved!! Thank you very much!

On 9 Nov 2017, at 7:32 pm, Eric Fong [email protected] wrote:

I worked around this by switch OFF atom-react package > JavaScript (JSX) Grammer > "Auto Indent"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/orktes/atom-react/issues/245#issuecomment-343082814, or mute the thread https://github.com/notifications/unsubscribe-auth/AIMxDR_c_icKjYDxeThivCN8mv-pGi8Cks5s0riGgaJpZM4P_LNe.

Niava avatar Nov 09 '17 08:11 Niava

Working for me. Thanks a lot!!

On Nov 9, 2017 2:32 AM, "Eric Fong" [email protected] wrote:

I worked around this by switch OFF atom-react package > JavaScript (JSX) Grammer > "Auto Indent"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/orktes/atom-react/issues/245#issuecomment-343082814, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfGTtv-xs7nZFNlgv6TaROuoKLCQc_cks5s0riGgaJpZM4P_LNe .

devashish-patel avatar Nov 09 '17 09:11 devashish-patel

updating the react JSX package did the trick for me

youngtk96 avatar Nov 10 '17 16:11 youngtk96

Yes, v0.17.0 was just released. This resolves the issue. Hooray!

cme0848 avatar Nov 10 '17 16:11 cme0848

thanks @ericfong that solution worked for me!

kahlilashanti avatar Nov 20 '17 00:11 kahlilashanti

Hi @kahlilashanti , you better upgrade to v0.17.0.

Which solve this problem (confirmed).

And we can switch ON "Auto Indent" and use tab key again

ericfong avatar Nov 20 '17 05:11 ericfong