Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

Uncaught SyntaxError: Invalid regular expression: /\\[$/: Unterminated character class #347

Open Dayjo opened 7 years ago

Dayjo commented 7 years ago
  1. Run 'Import Use Statment'

Atom: 1.18.0 x64 Electron: 1.3.15 OS: Mac OS X 10.11.6 Thrown From: atom-autocomplete-php package 0.25.6

Stack Trace

Uncaught SyntaxError: Invalid regular expression: /\[$/: Unterminated character class

At ~/.atom/packages/atom-autocomplete-php/lib/services/use-statement.coffee:15

SyntaxError: Invalid regular expression: /\\[$/: Unterminated character class
    at RegExp (native)
    at Object.importUseStatement (/packages/atom-autocomplete-php/lib/services/use-statement.coffee:15:21)
    at /packages/atom-autocomplete-php/lib/config.coffee:109:26)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:106:35)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:313:26)
    at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:81:20)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -2:09.4.0 core:backspace (input.hidden-input)
     -2:09.2.0 core:confirm (input.hidden-input)
  2x -1:12 core:undo (input.hidden-input)
     -1:10.3.0 core:save (input.hidden-input)
     -0:44.4.0 core:close (input.hidden-input)
     -0:36.9.0 command-palette:toggle (input.hidden-input)
     -0:33.5.0 core:confirm (input.hidden-input)
     -0:33.5.0 atom-autocomplete-php:namespace (input.hidden-input)
     -0:28.5.0 docblockr:parse-tab (input.hidden-input)
     -0:28.5.0 snippets:next-tab-stop (input.hidden-input)
     -0:28.5.0 snippets:expand (input.hidden-input)
     -0:28.5.0 editor:indent (input.hidden-input)
     -0:27.7.0 core:backspace (input.hidden-input)
     -0:12.4.0 command-palette:toggle (input.hidden-input)
     -0:07.9.0 core:confirm (input.hidden-input)
     -0:07.9.0 atom-autocomplete-php:import-use-statement (input.hidden-input)

Non-Core Packages

atom-autocomplete-php 0.25.6 
atom-beautify 0.30.3 
atom-ctags 5.1.0 
atom-google-tag-manager 0.0.0 
busy-signal 1.4.3 
color-picker 2.2.5 
docblockr 0.10.5 
emmet 2.4.3 
gist 1.0.0 
git-blame 1.1.1 
intentions 1.1.2 
language-blade 0.32.0 
language-docker 1.1.8 
linter 2.2.0 
linter-docker 0.2.0 
linter-eslint 8.2.1 
linter-jshint 3.1.5 
linter-php 1.3.2 
linter-stylint 2.2.7 
linter-stylint-h 0.0.15 
linter-ui-default 1.6.2 
open-recent 5.0.0 
permanent-delete 0.1.5 
pigments 0.39.1 
react 0.16.2 
Stylus 3.1.1 
sync-settings 0.8.2 
terminal-plus 0.14.5 
Peekmo commented 7 years ago

In fact, I have the problem too, it happens if your cursor is just at the beginning of your class name. If your cursor is in the word, there's no problem

e.g :

new [cursor]MyClass() => error new M[cursor]yClass() => no error

Dayjo commented 7 years ago

@Peekmo Ah well spotted :) Let me know if you need me to test anything.