BookmarkFacilitator

BookmarkFacilitator

new BookmarkFacilitator(kwargsopt)

Class implementing bookmark-related operations

Source:
Properties:
Name Type Description
logger Logger

Logger used for error and warning messages

editor Editor

Editor integration object, providing access to unsaved file content

gitOps GitInteraction

Used to execute git commands

diffOps DiffInteraction

Used to execute diff

A BookmarkFacilitator needs a GitInteraction and a DiffInteraction for carrying out its various methods. If these are not provided in the kwargs.gitOps and kwargs.diffOps parameters, they will be constructed from the parameters that are provided.

Construction of a GitInteraction requires a runGitCommand which, if not provided in kwargs.runGitCommand, is constructed based on kwargs.toolOptions (though passing usesSubcommands as true). Similarly, construction of a DiffInteraction requires a runDiffCommand which, if not provided in kwargs.runDiffCommand, is constructed based on kwargs.toolOptions (though passing usesSubcommands as false).

Parameters:
Name Type Attributes Description
kwargs object <optional>
Properties
Name Type Attributes Default Description
editor Editor <optional>

Object used for interacting with the conceptual editor that might hold live changes to a given file in the working tree

gitOps GitInteraction <optional>

Alternate implementation of Git operations

runGitCommand ToolkitRunnerFunc <optional>

Alternate command runner for executing git program used to construct a GitInteraction object if kwargs.gitOps is not given

diffOps DiffInteraction <optional>

Alternate implementation of diff operations

runDiffCommand CommandRunnerFunc <optional>

Alternate command runner for executing diff program used to construct a DiffInteraction object if kwargs.diffOps is not given

toolOptions object <optional>
{}

Tool options passed to CommandRunner, used if functions for invoking git or diff are needed

logger Logger <optional>
console

A console-like object used for logging warnings and errors

Methods

(async) computeLinePeg(filePath, currentLine, kwargsopt) → {Promise.<{line: number, commit: ?string}>}

Compute peg for bookmark

Source:
Parameters:
Name Type Attributes Description
filePath string

Path of file

currentLine number

Line (1-based) of file

kwargs object <optional>
Properties
Name Type Attributes Description
commit string <optional>

Start point for the search

Returns:
Type
Promise.<{line: number, commit: ?string}>

(async) currentLocation(bookmark) → {Promise.<{file: string, line: number, col: number}>}

Find the location of a bookmark in the current file content

Source:
Parameters:
Name Type Description
bookmark Bookmark

Bookmark whose current location to determine

Returns:
Type
Promise.<{file: string, line: number, col: number}>