TerminalFi / LSP-copilot

GitHub Copilot support for Sublime Text LSP plugin provided through Copilot.vim.
625 stars 25 forks source link

tentative refactoring for #27 #50

Closed jfcherng closed 1 year ago

jfcherng commented 1 year ago

Besides, I don't like the following. ViewCompletionManager shouldn't be coupled with phantom-related thing.

class ViewCompletionManager:
    @property
    def is_phantom(self) -> bool:
        return self.completion_style == _PhantomCompletion.STYLE_TYPE

    def handle_selection_change(self) -> None:
        if not (self.is_phantom and self.is_visible):
            return

        self.hide()

    def handle_text_change(self) -> None:
        if not (self.is_phantom and self.is_visible):
            return

        self.hide()

    def handle_close(self) -> None:
        if not self.is_phantom:
            return

        self.completion_style_type.close(self.view)