File indexing completed on 2024-05-26 11:22:03

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2016 Ivan Lakhtanov <ivan.lakhtanov@gmail.com>
0004 */
0005 
0006 #pragma once
0007 
0008 #include "completionobject.h"
0009 #include "expression.h"
0010 
0011 class JuliaSession;
0012 
0013 /**
0014  * Implements code completion for Julia language
0015  *
0016  * Uses Julia's Base.REPL.REPLCompletions.completions command to get
0017  * context-aware completions like in native Julia REPL
0018  */
0019 class JuliaCompletionObject : public Cantor::CompletionObject
0020 {
0021 public:
0022     /**
0023      * Constructs JuliaCompletionObject
0024      *
0025      * @param cmd command piece to generate completion
0026      * @param index index of cursor in command
0027      * @param session current session
0028      */
0029     JuliaCompletionObject(const QString &cmd, int index, JuliaSession *session);
0030     ~JuliaCompletionObject() override;
0031 
0032 protected:
0033     /**
0034      * @see Cantor::CompletionObject::mayIdentifierContain
0035      */
0036     bool mayIdentifierContain(QChar c) const override;
0037     bool mayIdentifierBeginWith(QChar c) const override;
0038 
0039     /**
0040      * @see Cantor::CompletionObject::mayIdentifierBeginWith
0041      */
0042 
0043 protected Q_SLOTS:
0044     /**
0045      * @see Cantor::CompletionObject::fetchCompletions
0046      */
0047     void fetchCompletions() override;
0048     void extractCompletions(Cantor::Expression::Status status);
0049 
0050 private:
0051     Cantor::Expression* m_expression;
0052 };