def gather_candidates(self, context):
        line = self.vim.current.window.cursor[0]
        column = context['complete_position']

        buf = self.vim.current.buffer
        offset = self.vim.call('line2byte', line) + \
            charpos2bytepos(self.vim, context['input'][: column], column) - 1
        source = '\n'.join(buf).encode()

        fp = tempfile.NamedTemporaryFile(delete=False, suffix=".swift")
        fp.write(source)
        fp.flush()
        fp.close()

        args = [self.source_kitten_binary(), "complete", "--file", fp.name, "--offset", str(offset)]

        process = subprocess.Popen(args,
                                   stdin=subprocess.PIPE,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
                                   start_new_session=True)
        stdout_data, stderr_data = process.communicate()
        result = stdout_data.decode()

        os.remove(fp.name)

        if stderr_data != b'':
            raise Exception((args, stderr_data.decode()))

        results = json.loads(result)

        return self.identifiers_from_result(results)
dataset/ETHPy150Open landaire/deoplete-swift/rplugin/python3/deoplete/sources/swift.py/Source.gather_candidates/original