Why I got an error said atom.workspace.toggle is not a function


#1

I created a package following the flight manual about package-active-editor-info and got an error about “atom.workspace.toggle is not a function”.

I read from atom.workspace’s api page that it indeed has a toggle function, so what caused this error?
The tutorial source code from github reported the same error.

below is the error message created by atom, includes my environment and other things useful.

[Enter steps to reproduce:]

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Ubuntu 16.04.2
Thrown From: active-editor-info package 0.0.0

Stack Trace

Uncaught TypeError: atom.workspace.toggle is not a function

At /home/zhch/temp/d3/active-editor-info/lib/active-editor-info.js:40

TypeError: atom.workspace.toggle is not a function
    at Object.toggle (/home/zhch/github/qinglangee/active-editor-info/lib/active-editor-info.js:40:20)
    at atom-workspace.activeEditorInfoToggle (/home/zhch/github/qinglangee/active-editor-info/lib/active-editor-info.js:21:49)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at /app.asar/src/command-registry.js:3:59
    at Object.didConfirmSelection (/app.asar/node_modules/command-palette/lib/command-palette-view.js:106:29)
    at SelectListView.confirmSelection (/app.asar/node_modules/atom-select-list/src/select-list-view.js:301:20)
    at HTMLDivElement.coreConfirm (/app.asar/node_modules/atom-select-list/src/select-list-view.js:67:14)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at /app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
    at /app.asar/src/window-event-handler.js:3:59)

Commands

     -1:08.4.0 command-palette:toggle (input.hidden-input)
     -1:05.5.0 core:confirm (input.hidden-input)
     -1:05.1.0 active-editor-info:toggle (input.hidden-input)

Non-Core Packages

active-editor-info 0.0.0 
custom-finder 0.0.0 
language-babel 2.67.0 
xiaoqiao-todo 0.0.0 

#2

Hi.

Changes to come to Atom. We are now beta testing V1.20.
Perhaps consider updating your V1.15 to V1.19.

Cheers.


#3

@Malloc You should at least post the actual code snippet that’s throwing the error


#4

Dear Sir,

Would it be enough to compare the API of V1.15 with (which the flight manual uses?) V1.18?

  1. https://atom.io/docs/api/v1.15.0/Workspace
  2. https://atom.io/docs/api/v1.18.0/Workspace

More so…
API description for ‘atom.workspace.toggle’


#5

Thanks, the latest version works well. Atom evolved so fast!!


#6

Thanks for the feedback.