@types/open-in-editor
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Installation

npm install --save @types/open-in-editor

Summary

This package contains type definitions for open-in-editor (https://github.com/lahmatiy/open-in-editor#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/open-in-editor.

export interface OpenInEditor {
    /**
     * @param path
     *   A file reference with the following format: `filename[:line[:column]]`, where `line` and `column` tell the editor where to place cursor when file is opened.
     */
    open(path: string): Promise<void>;
}

export interface ConfigureOptions {
    /**
     * Editor to open a file. Once value is set, we try to detect a command to launch an editor.
     *
     * @default null
     */
    editor?:
        | "sublime"
        | "atom"
        | "code"
        | "webstorm"
        | "phpstorm"
        | "idea14ce"
        | "vim"
        | "emacs"
        | "visualstudio"
        | null
        | undefined;

    /**
     * Command to launch an editor.
     *
     * @default null
     */
    cmd?: string | null | undefined;

    /**
     * Option to specify arguments for a command. Pattern can contain placeholders to be replaced by actual values. Supported placeholders: filename, line and column.
     *
     * @default null
     */
    pattern?: string | null | undefined;

    /**
     * Number of the first line in the editor
     *
     * @default 1
     */
    line?: number | undefined;

    /**
     * Number of the first column in the editor
     *
     * @default 1
     */
    column?: number | undefined;
}

/**
 * @param options
 *   Used to set up a command to launch an editor. If no options set it will try to get the command from [environment](https://github.com/lahmatiy/open-in-editor#environment)
 * @param failCallback
 *   Function that is called when something's wrong with editor setup.
 */
export function configure(
    options?: ConfigureOptions,
    failCallback?: (err: Error) => void,
): OpenInEditor;

Additional Details

  • Last updated: Mon, 25 Nov 2024 21:02:24 GMT
  • Dependencies: none

Credits

These definitions were written by Remco Haszing.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/open-in-editor

Weekly Downloads

88

Version

2.2.0

License

MIT

Unpacked Size

6.04 kB

Total Files

5

Last publish

Collaborators

  • types