コード例 #1
0
ファイル: clang_server.py プロジェクト: rugby110/nuclide
  def get_completions(self, request, response):
    src = request['src']
    contents = request['contents']
    line = request['line']
    column = request['column']
    prefix = request['prefix']
    token_start_column = request['tokenStartColumn']
    flags = request['flags']

    # Update the translation unit with the latest contents.
    translation_unit = self._tryUpdateTranslationUnit(src, contents, flags)

    if translation_unit:
      completions = get_completions(
          translation_unit,
          src,
          line + 1,
          token_start_column + 1,
          prefix,
          contents)
    else:
      completions = []
    response['file'] = src
    response['completions'] = completions
    response['line'] = line
    response['column'] = column
    response['prefix'] = prefix
コード例 #2
0
ファイル: clang_server.py プロジェクト: errazudin/nuclide
  def get_completions(self, request, response):
    src = request['src']
    contents = request['contents']
    line = request['line']
    column = request['column']
    prefix = request['prefix']
    token_start_column = request['tokenStartColumn']
    flags = request['flags']

    # Update the translation unit with the latest contents.
    translation_unit = self._tryUpdateTranslationUnit(src, contents, flags)

    if translation_unit:
      completions = get_completions(
          translation_unit,
          src,
          line + 1,
          token_start_column + 1,
          prefix,
          contents)
    else:
      completions = []
    response['file'] = src
    response['completions'] = completions
    response['line'] = line
    response['column'] = column
    response['prefix'] = prefix
コード例 #3
0
ファイル: clang_server.py プロジェクト: nguyenlamzx/nuclide
  def get_completions(self, request, response):
    src = request['src']
    contents = request['contents']
    line = request['line']
    column = request['column']
    prefix = request['prefix']
    token_start_column = request['tokenStartColumn']
    flags = request['flags']

    # NOTE: there is no need to update the translation unit here.
    # libclang's completions API seamlessly takes care of unsaved content
    # without any special handling.
    translation_unit = self._get_translation_unit(src, flags)
    if translation_unit:
      completions = get_completions(
          translation_unit,
          src,
          line + 1,
          token_start_column + 1,
          prefix,
          contents,
          limit=COMPLETIONS_LIMIT)
    else:
      completions = []
    response['file'] = src
    response['completions'] = completions
    response['line'] = line
    response['column'] = column
    response['prefix'] = prefix
コード例 #4
0
ファイル: clang_server.py プロジェクト: simendancer/nuclide
    def get_completions(self, request, response):
        src = request['src']
        contents = request['contents']
        line = request['line']
        column = request['column']
        prefix = request['prefix']
        token_start_column = request['tokenStartColumn']
        flags = request['flags']

        # NOTE: there is no need to update the translation unit here.
        # libclang's completions API seamlessly takes care of unsaved content
        # without any special handling.
        translation_unit = self._get_translation_unit(src, flags)
        if translation_unit:
            completions = get_completions(translation_unit,
                                          src,
                                          line + 1,
                                          token_start_column + 1,
                                          prefix,
                                          contents,
                                          limit=COMPLETIONS_LIMIT)
        else:
            completions = []
        response['file'] = src
        response['completions'] = completions
        response['line'] = line
        response['column'] = column
        response['prefix'] = prefix