Sublime Forum

Needing help with ListInputItem


According to the API Reference, a list item for a list input handler can be an instance of ListInputItem as below:

ListInputItem(text, value, <details>, <annotation>, <kind>)

I’d like for value and <details> the be the same. Is there any way to only define one of these attributes and just refer to it from the other attribute?



Answering my own question.

I was able to generate this list of ListInputItem as below.

class ExampleInputHandler(sublime_plugin.ListInputHandler):
    def list_items(self):
        return [sublime.ListInputItem(i[0], i[1], i[1]) for i in examplePairs]

examplePairs = [
    ["Text 1", "Value 1."],
    ["Text 2", "Value 2."],
    ["Text 3", "Value 3."],