Example #1
0
    def is_enabled(self):
        v = self.window.active_view()
        if v and fs.is_fsharp_code(v.file_name()):
            return True

        msg = 'FSharp: Not an F# code file.'
        print(msg)
        sublime.status_message(msg)
        return False
Example #2
0
    def is_enabled(self):
        v = self.window.active_view()
        if v and fs.is_fsharp_code(v.file_name()):
            return True

        msg = 'FSharp: Not an F# code file.'
        print(msg)
        sublime.status_message(msg)
        return False
Example #3
0
    def on_query_completions(self, view, prefix, locations):
        if not fs.is_fsharp_code(view.file_name()):
            return []

        while not task_results.empty():
            task_results.get()

        # A request for completions is treated especially: the result will
        # be published to a queue.
        requests.completions(view)

        completions = []
        try:
            completions = task_results.get(timeout=0.2)
            completions = completions['Data']
        except queue.Empty:
            # Too bad. The daemon was too slow.
            pass

        # TODO: Necessary? (It seems so.)
        flags = (sublime.INHIBIT_EXPLICIT_COMPLETIONS |
                 sublime.INHIBIT_WORD_COMPLETIONS)

        return [[c, c] for c in completions], flags
Example #4
0
    def on_query_completions(self, view, prefix, locations):
        if not fs.is_fsharp_code(view.file_name()):
            return []

        while not task_results.empty():
            task_results.get()

        # A request for completions is treated especially: the result will
        # be published to a queue.
        requests.completions(view)

        completions = []
        try:
            completions = task_results.get(timeout=0.2)
            completions = completions['Data']
        except queue.Empty:
            # Too bad. The daemon was too slow.
            pass

        # TODO: Necessary? (It seems so.)
        flags = (sublime.INHIBIT_EXPLICIT_COMPLETIONS
                 | sublime.INHIBIT_WORD_COMPLETIONS)

        return [[c, c] for c in completions], flags
Example #5
0
 def test_is_fsharp_code_can_fail(self):
     self.assertFalse(fs.is_fsharp_code('three.txt'))
Example #6
0
 def test_can_detect_fs_code_file(self):
     self.assertTrue(fs.is_fsharp_code('one.fs'))
     self.assertTrue(fs.is_fsharp_code('two.fsx'))
     self.assertTrue(fs.is_fsharp_code('three.fsi'))