open-editor
Advanced tools
Comparing version 1.0.1 to 1.1.0
20
index.js
@@ -29,3 +29,3 @@ 'use strict'; | ||
if (editor.id === 'webstorm') { | ||
if (['webstorm', 'intellij'].indexOf(editor.id) !== -1) { | ||
args.push(lineColumnPath.stringify(parsed, {column: false})); | ||
@@ -43,2 +43,7 @@ continue; | ||
if (['vim', 'neovim'].indexOf(editor.id) !== -1) { | ||
args.push(`+call cursor(${parsed.line}, ${parsed.column})`, parsed.file); | ||
continue; | ||
} | ||
args.push(parsed.file); | ||
@@ -49,3 +54,4 @@ } | ||
bin: editor.bin, | ||
args | ||
args, | ||
isTerminalEditor: editor.isTerminalEditor | ||
}; | ||
@@ -57,5 +63,7 @@ }; | ||
const stdio = result.isTerminalEditor ? 'inherit' : 'ignore'; | ||
const cp = childProcess.spawn(result.bin, result.args, { | ||
detached: true, | ||
stdio: 'ignore' | ||
stdio | ||
}); | ||
@@ -72,5 +80,9 @@ | ||
cp.unref(); | ||
if (result.isTerminalEditor) { | ||
cp.on('exit', process.exit); | ||
} else { | ||
cp.unref(); | ||
} | ||
}; | ||
module.exports.make = make; |
{ | ||
"name": "open-editor", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Open files in your editor at a specific line and column", | ||
@@ -39,6 +39,9 @@ "license": "MIT", | ||
"webstorm", | ||
"textmate" | ||
"textmate", | ||
"vim", | ||
"neovim", | ||
"intellij" | ||
], | ||
"dependencies": { | ||
"env-editor": "^0.1.0", | ||
"env-editor": "^0.3.1", | ||
"line-column-path": "^1.0.0", | ||
@@ -45,0 +48,0 @@ "opn": "^5.0.0" |
@@ -12,2 +12,5 @@ # open-editor [![Build Status](https://travis-ci.org/sindresorhus/open-editor.svg?branch=master)](https://travis-ci.org/sindresorhus/open-editor) | ||
- TextMate* | ||
- Vim | ||
- NeoVim | ||
- IntelliJ IDEA* | ||
@@ -67,5 +70,5 @@ *\*Doesn't support column.* | ||
Same as `openEditor()`, but returns an object with the binary name and arguments. | ||
Same as `openEditor()`, but returns an object with the binary name, arguments, and a flag indicating whether the editor runs in the terminal. | ||
Example: `{bin: 'subl', args: ['foo.js:1:5']}` | ||
Example: `{bin: 'subl', args: ['foo.js:1:5'], isTerminalEditor: false}` | ||
@@ -72,0 +75,0 @@ Can be useful if you want to handle opening the files yourself. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5688
65
85
1
+ Addedenv-editor@0.3.1(transitive)
- Removedenv-editor@0.1.1(transitive)
Updatedenv-editor@^0.3.1