Skip to content

Commit

Permalink
Fixes launching Visual Studio Code due to args being a nested array.
Browse files Browse the repository at this point in the history
Summary:
**Motivation**

Visual Studio Code appears to have been accidentally borked in RN 38 & 39.

[Here you see](facebook@a643784#diff-9ad1aafc931637a94d74b60c06b46871R153) args become an array to support the new `shell-quote` support.

Problem is, `getArgumentsForLineNumber` also returns an array.

[And because we](facebook@a643784#diff-9ad1aafc931637a94d74b60c06b46871R161) `push` instead of `concat`, we get hawt array-on-array action.

Surprisingly Atom works.  But Code doesn't like this at all.

**Test plan (required)**

On RN 0.38 and 0.39, what's happening when I click on the simulator stack frame, Code opens with the array as a string...

![image](https://cloud.githubusercontent.com/assets/68273/20971724/83a3d7c4-bc60-11e6-8170-a1c2a4adee60.png)

I've tested Vim, Code and Atom (all on 10.11.6) as well as all combinations of `REACT_EDITOR` both set
Closes facebook#11345

Differential Revision: D4339963

Pulled By: lacker

fbshipit-source-id: 030cb9e3d84fd6861f28e3652bebfe2eef28dd62
  • Loading branch information
skellock authored and facebook-github-bot committed Dec 16, 2016
1 parent 20938ae commit f49093f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions local-cli/server/util/launchEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ function launchEditor(fileName, lineNumber, projectRoots) {
return;
}

const [editor, ...args] = guessEditor();
let [editor, ...args] = guessEditor();
if (!editor) {
printInstructions('PRO TIP');
return;
}

var workspace = findRootForFile(projectRoots, fileName);
if (lineNumber) {
args.push(getArgumentsForLineNumber(editor, fileName, lineNumber, workspace));
args = args.concat(getArgumentsForLineNumber(editor, fileName, lineNumber, workspace));
} else {
args.push(fileName);
}
Expand Down

0 comments on commit f49093f

Please sign in to comment.