def on_post_save(self, view): if not is_haskell_view(view): return if not StackIDEManager.is_running(view.window()): return StackIDEManager.for_window(view.window()).update_files([relative_view_file_name(view)])
def on_post_save(self, view): if not is_haskell_view(view): return if not StackIDEManager.is_running(view.window()): return StackIDEManager.for_window(view.window()).update_files( [relative_view_file_name(view)])
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 on_query_completions(self, view, prefix, locations): if not is_haskell_view(view): return window = view.window() if not StackIDEManager.is_running(window): return # Check if this completion query is due to our refreshing the completions list # after receiving a response from stack-ide, and if so, don't send # another request for completions. if not self.refreshing: self.view = view request = Req.get_autocompletion(filepath=relative_view_file_name(view),prefix=prefix) send_request(window, request, self._handle_response) # Clear the flag to allow future completion queries self.refreshing = False return list(self.format_completion(*completion) for completion in self.returned_completions)
def on_query_completions(self, view, prefix, locations): if not is_haskell_view(view): return window = view.window() if not StackIDEManager.is_running(window): return # Check if this completion query is due to our refreshing the completions list # after receiving a response from stack-ide, and if so, don't send # another request for completions. if not self.refreshing: self.view = view request = Req.get_autocompletion( filepath=relative_view_file_name(view), prefix=prefix) send_request(window, request, self._handle_response) # Clear the flag to allow future completion queries self.refreshing = False return list( self.format_completion(*completion) for completion in self.returned_completions)
def test_is_haskell_view(self): window = mock_window([cur_dir + '/projects/helloworld']) view = mock_view('src/Main.hs', window) self.assertTrue(utility.is_haskell_view(view))