-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(log-table): useful context menus (#169)
Co-authored-by: Sam Maddock <smaddock@slack-corp.com>
- Loading branch information
1 parent
2e7a38f
commit 3654c7c
Showing
11 changed files
with
151 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { shell } from 'electron'; | ||
import { exec } from 'child_process'; | ||
import debug from 'debug'; | ||
|
||
const d = debug('sleuth:open-line-in-source'); | ||
|
||
interface OpenSourceOptions { | ||
defaultEditor: string; | ||
} | ||
|
||
export function openLineInSource( | ||
line: number, | ||
sourceFile: string, | ||
options: OpenSourceOptions, | ||
) { | ||
if (options.defaultEditor) { | ||
const cmd = options.defaultEditor | ||
.replace('{filepath}', `"${sourceFile}"`) | ||
.replace('{line}', line.toString(10)); | ||
|
||
d(`Executing ${cmd}`); | ||
exec(cmd, (error: Error) => { | ||
if (!error) return; | ||
d(`Tried to open source file, but failed`, error); | ||
shell.showItemInFolder(sourceFile); | ||
}); | ||
} else { | ||
shell.showItemInFolder(sourceFile); | ||
} | ||
} |
Oops, something went wrong.