hoosierhobbyist / quantum-shell

An experimental terminal emulator for the Atom text editor
MIT License
19 stars 6 forks source link

Uncaught SyntaxError: Invalid regular expression: /\/: \ at end of pattern #22

Open dk0r opened 8 years ago

dk0r commented 8 years ago

[Description:] Error incurred when attempting to change directories using tab completion (tab key).

[Screenshot:] http://i.imgur.com/yfuQ86l.png

[Enter steps to reproduce below:]

  1. Open atom-1.3.2
  2. Press Ctrl+shift+q to open quantum-shell-0.8.1
  3. Type "cd w" into the quantum shell and then press the tab-key to autocomplete (in my case) the 'workspace' folder.
  4. Incur "Uncaught SyntaxError: Invalid regular expression: /\/: \ at end of pattern" error.

Atom Version: 1.3.2 System: Microsoft Windows 10 Enterprise Thrown From: quantum-shell package, v0.7.1

Stack Trace

Uncaught SyntaxError: Invalid regular expression: /\/: \ at end of pattern

At /C:/Users/user/.atom/packages/quantum-shell/lib/quantum-shell-controller.coffee:393

SyntaxError: Invalid regular expression: /\/: \ at end of pattern
    at new RegExp (native)
    at RegExp (native)
    at Object.module.exports.QuantumShellController.tabCompletion (file:///C:/Users/user/.atom/packages/quantum-shell/lib/quantum-shell-controller.coffee:255:20)
    at HTMLInputElement.subscriptions.add.atom.commands.add.quantum-shell:tab-completion (file:///C:/Users/user/.atom/packages/quantum-shell/lib/quantum-shell-controller.coffee:136:49)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:536:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:359:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\src\window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (C:\Users\user\AppData\Local\atom\app-1.3.2\resources\app.asar\src\window-event-handler.js:3:61)

Commands

     -0:07.3.0 quantum-shell:toggle (atom-pane.pane.active)
     -0:02.8.0 quantum-shell:tab-completion (input#quantum-shell-input.)

Config

{
  "core": {
    "autoHideMenuBar": true,
    "projectHome": "C:\\Users\\user\\workspace\\atom.io",
    "audioBeep": false
  }
}

Installed Packages

# User
autohide-tree-view, v0.25.1
browser-plus, v0.0.54
emmet, v2.3.17
language-babel, v2.6.2
linter, v1.11.3
linter-eslint, v5.2.6
local-history, v3.2.3
meteor-api, v2.20.0
minimap, v4.18.1
quantum-shell, v0.7.1
resize-indent, v0.2.1

# Dev
No dev packages
hoosierhobbyist commented 8 years ago

I am able to recreate this issue and will be looking into it soon (hopefully tomorrow). Thank you for the bug report! And for the details/image, it's extremely helpful :smile:

ghost commented 7 years ago

I was running into the same issue with a different setup, perhaps it helps to track down the error. My workstation is windows with an installation of msys2 and mingw64 in it, since I needed the PATH variable from msys to start atom because of atom/atom#12608. The output of $PATH in mingw64 shell is

└─> $ echo $PATH

/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/user/.gem/ruby/2.3.0/bin:/c/Progra\ Files/7-Zip/

The error message caught inside atom after the same procedure described by @dk0r is

/C:/Users/user/AppData/Local/Temp/atom/.atom/packages/quantum-shell/lib/quantum-shell-controller.coffee:393

In my setup c is mounted on /c/... and not /C:/ so the different handling of paths in linux and windows is probably causing the issue since the regex expression has to be different.