2011-09-14 19:41:56 +04:00
|
|
|
#ifndef completion_hh_INCLUDED
|
|
|
|
#define completion_hh_INCLUDED
|
|
|
|
|
2013-04-09 22:05:40 +04:00
|
|
|
#include "string.hh"
|
|
|
|
|
2011-09-14 19:41:56 +04:00
|
|
|
#include <vector>
|
2011-10-11 02:38:58 +04:00
|
|
|
#include <functional>
|
2011-09-14 19:41:56 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2013-11-11 23:10:49 +04:00
|
|
|
class Context;
|
2012-08-06 23:37:43 +04:00
|
|
|
|
2012-04-14 05:17:09 +04:00
|
|
|
typedef std::vector<String> CandidateList;
|
2011-09-14 19:41:56 +04:00
|
|
|
|
|
|
|
struct Completions
|
|
|
|
{
|
|
|
|
CandidateList candidates;
|
2012-10-11 02:41:48 +04:00
|
|
|
ByteCount start;
|
|
|
|
ByteCount end;
|
2011-09-14 19:41:56 +04:00
|
|
|
|
2011-09-14 23:15:09 +04:00
|
|
|
Completions()
|
|
|
|
: start(0), end(0) {}
|
|
|
|
|
2012-10-11 02:41:48 +04:00
|
|
|
Completions(ByteCount start, ByteCount end)
|
2011-09-14 19:41:56 +04:00
|
|
|
: start(start), end(end) {}
|
|
|
|
};
|
|
|
|
|
2013-11-05 01:53:10 +04:00
|
|
|
enum class CompletionFlags
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
Fast
|
|
|
|
};
|
|
|
|
using Completer = std::function<Completions (const Context&, CompletionFlags,
|
|
|
|
const String&, ByteCount)>;
|
2011-10-11 02:38:58 +04:00
|
|
|
|
2013-11-05 01:53:10 +04:00
|
|
|
inline Completions complete_nothing(const Context& context, CompletionFlags,
|
2012-10-11 02:41:48 +04:00
|
|
|
const String&, ByteCount cursor_pos)
|
2011-10-11 02:38:58 +04:00
|
|
|
{
|
2011-11-11 00:57:25 +04:00
|
|
|
return Completions(cursor_pos, cursor_pos);
|
|
|
|
}
|
2011-10-11 02:38:58 +04:00
|
|
|
|
2013-12-30 18:20:05 +04:00
|
|
|
Completions shell_complete(const Context& context, CompletionFlags,
|
|
|
|
const String&, ByteCount cursor_pos);
|
|
|
|
|
2011-09-14 19:41:56 +04:00
|
|
|
}
|
|
|
|
#endif // completion_hh_INCLUDED
|