- Published on
Open Files in Your Editor at a Specific Line and Column in Node.js
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Open files at a specific column and line in your favourite editor (or default editor) could be a great help especially when trying to debug things or just improving your developer experience for a large project that you're working on.
In Next.js we can easily do that with the help of open-editor NPM package.
Here is how to do it:
Dependency
npm install open-editor
Snippet
import openEditor from 'open-editor';
openEditor(
[
{
file: "package.json",
line: 3,
column: 2,
},
],
{
// Set an editor explicitly.
// By default, it is auto-deduced based on the $EDITOR environment variable.
editor: "code",
}
);
Happy opening files!