def test_span_from_view_selection(self): window = mock_window([cur_dir + '/projects/helloworld']) view = mock_view('src/Main.hs', window) span = utility.span_from_view_selection(view) self.assertEqual(1, span['spanFromLine']) self.assertEqual(1, span['spanToLine']) self.assertEqual(1, span['spanFromColumn']) self.assertEqual(1, span['spanToColumn']) self.assertEqual('src/Main.hs', span['spanFilePath'])
def on_selection_modified(self, view): if not is_haskell_view(view): return window = view.window() if not StackIDEManager.is_running(window): return # Only try to get types for views into files # (rather than e.g. the find field or the console pane) if view.file_name(): # Uncomment to see the scope at the cursor: # Log.debug(view.scope_name(view.sel()[0].begin())) request = Req.get_exp_types(span_from_view_selection(view)) send_request(window, request, Win(window).highlight_type)
def run(self,edit): request = Req.get_exp_info(span_from_view_selection(self.view)) send_request(self.view.window(),request, self._handle_response)