예제 #1
0
파일: test_hover.py 프로젝트: eliwe/LSP
    def test_hover_info(self):

        yield 100  # wait for file to be open
        self.view.run_command('insert', {"characters": ORIGINAL_CONTENT})

        wm = windows.lookup(self.view.window())

        text_config = ClientConfig("test", [], None, ["text.plain"], ["Plain text"], "test")
        register_client_config(text_config)
        wm._configs._configs.append(text_config)

        session = Session(text_config, dirname(__file__), TestClient())
        session.state = ClientStates.READY
        wm._sessions[text_config.name] = session

        # session = session_for_view(self.view)
        # self.assertIsNotNone(session)
        # self.assertTrue(session.has_capability('hoverProvider'))

        self.view.run_command('lsp_hover', {'point': 3})

        # popup should be visible eventually
        yield self.view.is_popup_visible()

        last_content = _test_contents[-1]
        self.assertTrue("greeting" in last_content)
예제 #2
0
파일: setup.py 프로젝트: Narretz/LSP
 def setUp(self) -> None:
     self.view = sublime.active_window().open_file(self.test_file_path)
     self.view.settings().set("auto_complete_selector", "text.plain")
     self.wm = windows.lookup(self.view.window())
     self.client = MockClient(async_response=sublime_delayer(100))
     add_config(text_config)
     inject_session(self.wm, text_config, self.client)
예제 #3
0
def get_session(window: sublime.Window) -> Optional[Session]:
    wm = windows.lookup(window)
    metals_session = None
    if wm is not None:
        for session in wm._sessions:
            if session.config.name == SESSION_NAME:
                metals_session = session

    return metals_session
예제 #4
0
 def setUp(self) -> None:
     self.view = sublime.active_window().open_file(test_file_path)
     self.wm = windows.lookup(self.view.window())
     self.client = MockClient(async_response=sublime_delayer(100))
     add_config(text_config)
     inject_session(self.wm, text_config, self.client)
예제 #5
0
 def test_window_without_configs(self):
     wm = windows.lookup(sublime.active_window())
     self.assertFalse(wm._configs.syntax_supported(self.view))