Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Uncaught TypeError: Cannot read property 'scopeName' of undefined #6235

Closed

Description

@ATNC

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 0.189.0
System: linux 3.13.0-48-generic
Thrown From: Atom Core

Stack Trace

Uncaught TypeError: Cannot read property 'scopeName' of undefined

At /opt/atom/resources/app/src/text-editor.js:2263

TypeError: Cannot read property 'scopeName' of undefined
    at TextEditor.module.exports.TextEditor.usesSoftTabs (/opt/atom/resources/app/src/text-editor.js:2263:28)
    at TextEditor.module.exports.TextEditor.handleTokenization (/opt/atom/resources/app/src/text-editor.js:2803:44)
    at /opt/atom/resources/app/src/text-editor.js:205:24
    at Emitter.module.exports.Emitter.emit (/opt/atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
    at TokenizedBuffer.module.exports.TokenizedBuffer.markTokenizationComplete (/opt/atom/resources/app/src/tokenized-buffer.js:306:22)
    at TokenizedBuffer.module.exports.TokenizedBuffer.tokenizeNextChunk (/opt/atom/resources/app/src/tokenized-buffer.js:299:21)
    at /opt/atom/resources/app/src/tokenized-buffer.js:247:26
    at /opt/atom/resources/app/node_modules/underscore-plus/node_modules/underscore/underscore.js:666:47

Commands

Config

{
  "core": {
    "themes": [
      "seti-ui",
      "atom-dark-syntax"
    ]
  },
  "editor": {
    "invisibles": {},
    "fontSize": 17
  }
}

Installed Packages

# User
atom-django, v0.2.1
django-templates, v0.4.0
linter-jshint, v0.1.0
linter-pep8, v0.1.0
script, v2.18.0
seti-ui, v0.6.3
terminal-panel, v1.10.0

# Dev
No dev packages

Activity

  1. izuzak commented on Apr 3, 2015

    @izuzak
    Contributor

    @ATNC Can you share some steps which reproduce the problem? Can you reproduce this in safe mode?

  2. zdennis commented on May 19, 2015

    @zdennis

    Putting the following in your init script reproduces the above issue for me:

    atom.workspace.observeTextEditors (editor) ->
      unless editor.getPath()
        editor.setGrammar(atom.grammars.grammarForScopeName('source.md'))
    

    Update: The above snippet fails because I don't actually have a markdown grammar installed.

  3. izuzak commented on May 26, 2015

    @izuzak
    Contributor

    @zdennis Thanks for providing some steps to reproduce this -- not sure if that's the same thing though, since you're manually setting the grammar to undefined there.

    @nathansobo Seems like the exception is being thrown here:

    usesSoftTabs: ->
        return false if @getGrammar().scopeName is 'source.makefile'
        ...

    Can you think of a scenario where getGrammar() would return undefined (other than the user setting it to undefined)? Should we worry about this or just guard against the call on an undefined?

  4. nathansobo commented on May 26, 2015

    @nathansobo
    Contributor

    Tokenization occurs in chunks because we're still parsing on the UI thread and need to yield for browser updates when editing large files. This is why you see underscore at the top of the stack trace... we're using _.defer.

    It seems like what may have happened is the grammar somehow got set to null in between two calls to tokenizeNextChunk. What's a bit confusing to me is how the grammar could have been assigned to null without throwing an exception itself. So, I don't have any answers here.

  5. lock commented on Mar 31, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  6. locked and limited conversation to collaborators on Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions