Skip to content

Remove TextMate.selected_paths_array from shelltokenize.rb, but maybe keep functionality? #25

@noniq

Description

@noniq

This is more or less a duplicate of TextMate.selected_files from textmate.rb. It is currently only used in a few places in the CVS, Mercurial, SVK and SVN bundles (sometimes via TextMate.selected_paths_for_shell).

However, there is one difference: If no files are selected, selected_path_array returns an array with a single entry for ENV["TM_FILEPATH"], or an empty array if this is not set. selected_files returns nil in those cases.

I wonder whether this functionality (“Give me an array of selected files, falling back to the current file if nothing is selected“) is so common that it should be part of the “official” bundle support API?

For example, the Git bundle has its own rather elaborate implementation that even supports different fallbacks (current file vs. project directory) and optional unique-filtering: https://github.com/textmate/git.tmbundle/blob/d1db42c2d71948662098183a6df519fb53a7a15b/Support/lib/git.rb#L114-L137

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions