Пример #1
0
 def __init__(self, resp_proc):
     _logger.info("starting fsac server...")
     self.fsac = FsacClient(server.start(), resp_proc)
     self.compilers_path = None
     self.project_file = None
     self.fsac.send_request(CompilerLocationRequest())
     response_processor.add_listener(ON_COMPILER_PATH_AVAILABLE, self.on_compiler_path_available)
Пример #2
0
 def __init__(self, resp_proc):
     _logger.info('starting fsac server...')
     self.fsac = FsacClient(server.start(), resp_proc)
     self.compilers_path = None
     self.project_file = None
     self.fsac.send_request(CompilerLocationRequest())
     response_processor.add_listener(ON_COMPILER_PATH_AVAILABLE,
                                     self.on_compiler_path_available)
    def __init__(self, resp_proc):
        _logger.info ('Starting F# language services...')

        self.fsac = FsacClient(server.start(), resp_proc)

        self.compilers_path = None
        self.project_file = None

        self._errors = []

        self.fsac.send_request(CompilerLocationRequest())
        # todo: register as decorator instead?
        response_processor.add_listener(ON_COMPILER_PATH_AVAILABLE,
                                        self.on_compiler_path_available)

        response_processor.add_listener(ON_ERRORS_AVAILABLE,
                                        self.on_errors_available)

        self._write_lock = threading.Lock()
Пример #4
0
    def __init__(self, resp_proc):
        _logger.info('Starting F# language services...')

        self.fsac = FsacClient(server.start(), resp_proc)

        self.compilers_path = None
        self.project_file = None

        self._errors = []
        self.errors_panel = FSharpErrorsPanel()

        self.fsac.send_request(CompilerLocationRequest())
        # todo: register as decorator instead?
        response_processor.add_listener(ON_COMPILER_PATH_AVAILABLE,
                                        self.on_compiler_path_available)

        response_processor.add_listener(ON_ERRORS_AVAILABLE,
                                        self.on_errors_available)

        self._write_lock = threading.Lock()
Пример #5
0
    '''Implements contexts for .sublime-keymap files.
    '''
    def on_query_context(self, view, key, operator, operand, match_all):
        if key == 'fs_is_code_file':
            value = FSharpFile(view).is_code
            return self._check(value, operator, operand, match_all)


class FSharpAutocomplete(sublime_plugin.EventListener):
    WAIT_ON_COMPLETIONS = False

    @staticmethod
    def on_completions_requested(data):
        FSharpAutocomplete.WAIT_ON_COMPLETIONS = True

    def on_query_completions(self, view, prefix, locations):
        if not FSharpAutocomplete.WAIT_ON_COMPLETIONS:
            return []

        try:
            data = completions_queue.get(block=True, timeout=.75)
            data = json.loads(data.decode('utf-8'))
            return [[item, item] for item in data['Data']]
        except:
            return []
        finally:
            FSharpAutocomplete.WAIT_ON_COMPLETIONS = False


add_listener(ON_COMPLETIONS_REQUESTED, FSharpAutocomplete.on_completions_requested)