launch-editor
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -38,2 +38,3 @@ const path = require('path') | ||
case 'Code': | ||
case 'codium': | ||
return ['-r', '-g', `${fileName}:${lineNumber}:${columnNumber}`] | ||
@@ -53,3 +54,3 @@ case 'appcode': | ||
case 'webstorm64': | ||
return ['--line', lineNumber, fileName] | ||
return ['--line', lineNumber, '--column', columnNumber, fileName] | ||
} | ||
@@ -56,0 +57,0 @@ |
32
guess.js
@@ -27,3 +27,3 @@ const path = require('path') | ||
const output = childProcess | ||
.execSync('ps x', { | ||
.execSync('ps x -o comm=', { | ||
stdio: ['pipe', 'pipe', 'ignore'] | ||
@@ -33,21 +33,35 @@ }) | ||
const processNames = Object.keys(COMMON_EDITORS_OSX) | ||
const processList = output.split('\n') | ||
for (let i = 0; i < processNames.length; i++) { | ||
const processName = processNames[i] | ||
// Find editor by exact match. | ||
if (output.indexOf(processName) !== -1) { | ||
return [COMMON_EDITORS_OSX[processName]] | ||
} | ||
const processNameWithoutApplications = processName.replace('/Applications', '') | ||
// Find editor installation not in /Applications. | ||
if (output.indexOf(processNameWithoutApplications) !== -1) { | ||
// Use the CLI command if one is specified | ||
if (processName !== COMMON_EDITORS_OSX[processName]) { | ||
return [COMMON_EDITORS_OSX[processName]] | ||
} | ||
// Use a partial match to find the running process path. If one is found, use the | ||
// existing path since it can be running from anywhere. | ||
const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications)) | ||
if (runningProcess !== undefined) { | ||
return [runningProcess] | ||
} | ||
} | ||
} | ||
} else if (process.platform === 'win32') { | ||
const output = childProcess | ||
.execSync('powershell -Command "Get-Process | Select-Object Path"', { | ||
stdio: ['pipe', 'pipe', 'ignore'] | ||
}) | ||
.execSync( | ||
'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"', | ||
{ | ||
stdio: ['pipe', 'pipe', 'ignore'] | ||
} | ||
) | ||
.toString() | ||
const runningProcesses = output.split('\r\n') | ||
for (let i = 0; i < runningProcesses.length; i++) { | ||
// `Get-Process` sometimes returns empty lines | ||
if (!runningProcesses[i]) { | ||
continue | ||
} | ||
const fullProcessPath = runningProcesses[i].trim() | ||
@@ -54,0 +68,0 @@ const shortProcessName = path.basename(fullProcessPath) |
{ | ||
"name": "launch-editor", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "launch editor from node.js", | ||
@@ -22,4 +22,4 @@ "main": "index.js", | ||
"picocolors": "^1.0.0", | ||
"shell-quote": "^1.6.1" | ||
"shell-quote": "^1.7.3" | ||
} | ||
} |
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
12122
337
Updatedshell-quote@^1.7.3