26. Phantoms

The following are the methods in sublime.View class related to Phantoms.

def add_phantom(self, key: str, region: Region, content: str, layout: PhantomLayout,
                on_navigate: Optional[Callable[[str], None]] = None) -> int:
    return sublime_api.view_add_phantom(self.view_id, key, region, content, layout, on_navigate)

def erase_phantoms(self, key: str):
    sublime_api.view_erase_phantoms(self.view_id, key)

def erase_phantom_by_id(self, pid: int):
    sublime_api.view_erase_phantom(self.view_id, pid)

def query_phantom(self, pid: int) -> list[Region]:
    return sublime_api.view_query_phantoms(self.view_id, [pid])

def query_phantoms(self, pids: list[int]) -> list[Region]:
    return sublime_api.view_query_phantoms(self.view_id, pids)