ashthespy / Atom-LaTeX

The only LaTeX package you need for typesetting with Atom.
https://atom.io/packages/atom-latex
MIT License
22 stars 9 forks source link

Uncaught TypeError: Array.prototype.indexOf called on null or undefined #187

Closed ahsen1402 closed 5 years ago

ahsen1402 commented 5 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.33.0 x64 Electron: 2.0.11 OS: Mac OS X 10.14.2 Thrown From: atom-latex package 0.8.5

Stack Trace

Uncaught TypeError: Array.prototype.indexOf called on null or undefined

At /Users/erenam01/.atom/packages/atom-latex/lib/builder.coffee:37

TypeError: Array.prototype.indexOf called on null or undefined
    at indexOf (<anonymous>)
    at Builder.module.exports.Builder.saveonBuild (/packages/atom-latex/lib/builder.coffee:37:34)
    at Builder.module.exports.Builder.build (/packages/atom-latex/lib/builder.coffee:19:18)
    at /packages/atom-latex/lib/main.coffee:34:53)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:349858)
    at CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:348333)
    at AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:654926)
    at EventEmitter.t (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:662310)
    at emitThree (events.js:136:13)
    at EventEmitter.emit (events.js:217:7)

Commands

     -1:21.1.0 markdown-writer:insert-new-line (input.hidden-input)
     -1:21.1.0 editor:newline (input.hidden-input)
     -1:20.4.0 core:move-down (input.hidden-input)
     -1:07.4.0 atom-latex:build-here (ul.list-inline.tab-bar.inset-panel)
  2x -1:06.4.0 core:save (ul.list-inline.tab-bar.inset-panel)
  2x -0:59.2.0 atom-latex:build (input.hidden-input)
  2x -0:57.2.0 core:save (input.hidden-input)
  3x -0:48.9.0 atom-latex:build (input.hidden-input)
     -0:39.2.0 atom-latex:build-here (input.hidden-input)
     -0:38 core:save (input.hidden-input)
     -0:32 atom-latex:build (input.hidden-input)
     -0:26 atom-latex:clean (input.hidden-input)
     -0:24.9.0 core:save (input.hidden-input)
  2x -0:23.5.0 atom-latex:build (input.hidden-input)
  8x -0:21.9.0 core:save (input.hidden-input)
     -0:12.4.0 atom-latex:build-here (input.hidden-input)

Non-Core Packages

atom-latex 0.8.5 
autocomplete-paths 2.12.2 
autocomplete-python 1.11.0 
emmet 2.4.3 
Hydrogen 2.7.0 
language-latex 1.2.0 
language-markdown 0.27.0 
language-r 0.4.2 
markdown-preview-plus 3.7.1 
markdown-toc 0.4.2 
markdown-writer 2.11.3 
ashthespy commented 5 years ago

Need steps to reproduce, do update if you have the issue again!

Regina-v commented 5 years ago

@ashthespy I'm having the same issue. I enabled the "Save files before Build" option. When I now change something in my tex file and then build with Ctrl+L Ctrl+B, the error occurs. The error does not occur when I manually save the changes before building.

Atom: 1.35.1 x64 Electron: 2.0.18 OS: Linux Mint Thrown From: atom-latex package 0.8.5

Stack Trace

Uncaught TypeError: Array.prototype.indexOf called on null or undefined

At /home/regina/.atom/packages/atom-latex/lib/builder.coffee:37

TypeError: Array.prototype.indexOf called on null or undefined
    at indexOf (<anonymous>)
    at Builder.module.exports.Builder.saveonBuild (/packages/atom-latex/lib/builder.coffee:37:34)
    at Builder.module.exports.Builder.build (/packages/atom-latex/lib/builder.coffee:19:18)
    at /packages/atom-latex/lib/main.coffee:33:48)
    at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/static/<embedded>:11:350055)
    at KeymapManager.t.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/static/<embedded>:11:1230796)
    at KeymapManager.t.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/static/<embedded>:11:1226930)
    at WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/static/<embedded>:11:285234)

Commands

  2x -3:00.4.0 editor:newline (input.hidden-input)
  2x -2:53.8.0 core:backspace (input.hidden-input)
     -2:50.6.0 editor:newline (input.hidden-input)
     -2:49.5.0 core:paste (input.hidden-input)
     -2:49.1.0 core:move-up (input.hidden-input)
     -2:46.7.0 autocomplete-plus:confirm (input.hidden-input)
     -2:46.3.0 editor:newline (input.hidden-input)
  4x -2:43.3.0 core:backspace (input.hidden-input)
     -2:42.2.0 autocomplete-plus:confirm (input.hidden-input)
     -2:40.3.0 core:undo (input.hidden-input)
  3x -2:39.8.0 editor:newline (input.hidden-input)
     -2:23.4.0 autocomplete-plus:confirm (input.hidden-input)
  2x -2:22.8.0 editor:newline (input.hidden-input)
  3x -2:16.8.0 core:backspace (input.hidden-input)
     -2:13.1.0 editor:newline (input.hidden-input)
     -0:59.5.0 atom-latex:build (input.hidden-input)

Non-Core Packages

atom-ide-ui 0.13.0 
atom-latex 0.8.5 
atom-runner 2.7.1 
autocomplete-python 1.14.0 
docblock-python 0.14.1 
linter-python-pep257 0.0.1 
linter-python-pep8 0.2.0 
MagicPython 1.1.1 
platformio-ide-terminal 2.9.1 
python-debugger 0.2.0 
todo-show 2.3.2 
ashthespy commented 5 years ago

Some questions:

  1. Do you explicitly set the LaTeX root file if not, how is it determined?
  2. Could you try debugging by instead of clicking build/hitting save, opening up the dev console and running the following:
    > atom_latex.latex.texFiles
    // which should output something like
    < undefined
    // Then try
    > atom_latex.latex.manager.findAll()
    > atom_latex.latex.texFiles
Regina-v commented 5 years ago

ad 1.: I haven't set the root file since I only have a single tex file. Atom prompts the message:

Set the following file as LaTeX main file.
/path/to/my/file.tex
Reason: The active editor is a valid LaTeX main file.

I tested the same with another tex document that is splitted into several sub files, each file (except the root file) contains a % !TEX root = doc.tex. With this document I have no problems at all, also "save files before build" is working.

ad 2.:

> atom_latex.latex.texFiles
undefined
> atom_latex.latex.manager.findAll()
true
> atom_latex.latex.texFiles
undefined
ashthespy commented 5 years ago

@rwehler Sorry, you issue seems to have slipped through the cracks. I just tried reproducing it, but can't trigger this behaviour. Are you still facing issues?

Regina-v commented 5 years ago

@ashthespy Yes. Still the same issue as in May. At the moment I'm only working in a larger document with several included tex files and by that I'm not facing the error every day ;-) But when I try to compile a single tex file and have not saved it manually before building, I still get the error message.

ashthespy commented 5 years ago

Found the issue yesterday, it was triggered when there was no 'Project' open, should be fixed with v.0.8.9