{"action":"created","issue":{"url":"https://api.github.com/repos/jchannon/csharpextensions/issues/4","repository_url":"https://api.github.com/repos/jchannon/csharpextensions","labels_url":"https://api.github.com/repos/jchannon/csharpextensions/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/jchannon/csharpextensions/issues/4/comments","events_url":"https://api.github.com/repos/jchannon/csharpextensions/issues/4/events","html_url":"https://github.com/jchannon/csharpextensions/issues/4","id":183186649,"number":4,"title":"Unable to create a class under windows (Path.sep replace issue)","user":{"login":"shrayasr","id":240368,"avatar_url":"https://avatars.githubusercontent.com/u/240368?v=3","gravatar_id":"","url":"https://api.github.com/users/shrayasr","html_url":"https://github.com/shrayasr","followers_url":"https://api.github.com/users/shrayasr/followers","following_url":"https://api.github.com/users/shrayasr/following{/other_user}","gists_url":"https://api.github.com/users/shrayasr/gists{/gist_id}","starred_url":"https://api.github.com/users/shrayasr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shrayasr/subscriptions","organizations_url":"https://api.github.com/users/shrayasr/orgs","repos_url":"https://api.github.com/users/shrayasr/repos","events_url":"https://api.github.com/users/shrayasr/events{/privacy}","received_events_url":"https://api.github.com/users/shrayasr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-15T03:47:59Z","updated_at":"2016-10-15T07:45:57Z","closed_at":null,"body":"I'm unable to create a class when using this extension in Windows.\r\n\r\nLooks like there is a path separator issue. When I try to create a **new C# class**, the following error is thrown at the console\r\n\r\n```\r\nSyntaxError: Invalid regular expression: /\\/: \\ at end of pattern\r\n    at RegExp (native)\r\n    at vscode.window.showInputBox.then (C:\\Users\\shrayasr\\.vscode\\extensions\\jchannon.csharpextensions-1.0.1\\out\\src\\extension.js:51:39)\r\n    at Object.m [as _notify] (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:5002)\r\n    at Object.enter (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:8580)\r\n    at _run (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:10408)\r\n    at _completed (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:9849)\r\n    at c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:16511\r\n    at done (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:11709)\r\n    at Object.m [as _notify] (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:5144)\r\n    at Object.enter (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:8580)\r\n    at _run (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:10408)\r\n    at _completed (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:6:9849)\r\n    at e.resolveOk (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:8:4013)\r\n    at p (c:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\node\\extensionHostProcess.js:8:2495)\r\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n    at process._tickCallback (internal/process/next_tick.js:98:9)\r\n```\r\n\r\nLine 51 of the JS file is this:\r\n\r\n```javascript\r\nnamespace = namespace.replace(new RegExp(path.sep, 'g'), '.');\r\n```\r\n\r\nI tried out something simple in a REPL and ended up with the same issue\r\n\r\n```javascript\r\nλ node                                                                 \r\n> var path = require(\"path\");                                          \r\nundefined                                                              \r\n> path.sep                                                             \r\n'\\\\'                                                                   \r\n> \"myproject\\\\controllers\".replace(new RegExp(path.sep, \"g\"), \".\");    \r\nSyntaxError: Invalid regular expression: /\\/: \\ at end of pattern      \r\n    at new RegExp (native)                                             \r\n    at repl:1:34                                                       \r\n    at REPLServer.defaultEval (repl.js:248:27)                         \r\n    at bound (domain.js:280:14)                                        \r\n    at REPLServer.runBound [as eval] (domain.js:293:12)                \r\n    at REPLServer.<anonymous> (repl.js:412:12)                         \r\n    at emitOne (events.js:82:20)                                       \r\n    at REPLServer.emit (events.js:169:7)                               \r\n    at REPLServer.Interface._onLine (readline.js:210:10)               \r\n    at REPLServer.Interface._line (readline.js:549:8)                  \r\n```\r\n\r\nIt works under the nix platforms because `path.sep` will be `/` and this works fine \r\n\r\n```javascript\r\n> \"myproject/controllers\".replace(new RegExp(\"/\", \"g\"), \".\");\r\n'myproject.controllers'\r\n```\r\n\r\nI will try to put out a PR for this today "},"comment":{"url":"https://api.github.com/repos/jchannon/csharpextensions/issues/comments/253969064","html_url":"https://github.com/jchannon/csharpextensions/issues/4#issuecomment-253969064","issue_url":"https://api.github.com/repos/jchannon/csharpextensions/issues/4","id":253969064,"user":{"login":"jchannon","id":105126,"avatar_url":"https://avatars.githubusercontent.com/u/105126?v=3","gravatar_id":"","url":"https://api.github.com/users/jchannon","html_url":"https://github.com/jchannon","followers_url":"https://api.github.com/users/jchannon/followers","following_url":"https://api.github.com/users/jchannon/following{/other_user}","gists_url":"https://api.github.com/users/jchannon/gists{/gist_id}","starred_url":"https://api.github.com/users/jchannon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchannon/subscriptions","organizations_url":"https://api.github.com/users/jchannon/orgs","repos_url":"https://api.github.com/users/jchannon/repos","events_url":"https://api.github.com/users/jchannon/events{/privacy}","received_events_url":"https://api.github.com/users/jchannon/received_events","type":"User","site_admin":false},"created_at":"2016-10-15T07:45:57Z","updated_at":"2016-10-15T07:45:57Z","body":"I have this regex which works in a debugger but blows up in node for some reason.  Won't have any time to fix today 😢 \r\n\r\n```\r\n> '/Users/jc/projects/nancy/src/fred/poo/'.replace(new RegExp('\\/|\\\\', 'g'), '.');\r\nSyntaxError: Invalid regular expression: //|\\/: \\ at end of pattern\r\n```"}}
{"actor":{"display_login":"jchannon"}}