pythonlanguagesupport.h 3.72 KB
Newer Older
Piyush Verma's avatar
Piyush Verma committed
1 2 3 4
/*****************************************************************************
 * Copyright (c) 2007 Andreas Pakulat <apaku@gmx.de>                         *
 * Copyright (c) 2007 Piyush verma <piyush.verma@gmail.com>                  *
 *                                                                           *
5 6 7 8
 * This program is free software; you can redistribute it and/or             *
 * modify it under the terms of the GNU General Public License as            *
 * published by the Free Software Foundation; either version 2 of            *
 * the License, or (at your option) any later version.                       *
9
 *                                                                           *
10 11 12 13
 * This program is distributed in the hope that it will be useful,           *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
 * GNU General Public License for more details.                              *
14
 *                                                                           *
15 16 17 18
 * You should have received a copy of the GNU General Public License         *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
 *****************************************************************************
 */
Piyush Verma's avatar
Piyush Verma committed
19

20 21 22
#ifndef KDEVPYTHONLANGUAGESUPPORT_H
#define KDEVPYTHONLANGUAGESUPPORT_H

23
#include <interfaces/iplugin.h>
24 25
#include <interfaces/ilanguagecheck.h>
#include <interfaces/ilanguagecheckprovider.h>
26
#include <language/interfaces/ilanguagesupport.h>
27 28 29 30
#include <language/duchain/topducontext.h>

#include <QVariant>
#include <QProcess>
31 32 33

namespace KDevelop
{
Andreas Pakulat's avatar
Andreas Pakulat committed
34 35 36
class ParseJob;
class IDocument;
class ICodeHighlighting;
37
}
38

Andreas Pakulat's avatar
Andreas Pakulat committed
39
namespace Python
40 41
{

42
class Highlighting;
43
class Refactoring;
44
class StyleChecking;
Andreas Pakulat's avatar
Andreas Pakulat committed
45

46 47 48 49
class LanguageSupport
    : public KDevelop::IPlugin
    , public KDevelop::ILanguageSupport
    , public KDevelop::ILanguageCheckProvider
50
{
Andreas Pakulat's avatar
Andreas Pakulat committed
51
    Q_OBJECT
52
    Q_INTERFACES( KDevelop::ILanguageSupport )
53
    Q_INTERFACES( KDevelop::ILanguageCheckProvider )
Andreas Pakulat's avatar
Andreas Pakulat committed
54

55
public:
56
    LanguageSupport( QObject *parent, const QVariantList& args = QVariantList() );
57
    ~LanguageSupport() override;
58
    /*Name Of the Language*/
59
    QString name() const override;
60
    /*Parsejob used by background parser to parse given Url*/
61
    KDevelop::ParseJob *createParseJob( const KDevelop::IndexedString &url ) override;
62
    /*the code highlighter*/
63 64
    KDevelop::ICodeHighlighting* codeHighlighting() const override;
    KDevelop::BasicRefactoring* refactoring() const override;
65
    
66
    KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override;
67
    
68
    static LanguageSupport* self();
69 70 71

    int suggestedReparseDelayForChange(KTextEditor::Document* doc, const KTextEditor::Range& changedRange,
                                       const QString & changedText, bool removal) const override;
Sven Brauch's avatar
Sven Brauch committed
72
    
73
    KDevelop::SourceFormatterItemList sourceFormatterItems() const override;
Andreas Pakulat's avatar
Andreas Pakulat committed
74

75
    /// Tells whether this plugin is enabled for the given file.
76
    static bool enabledForFile(const QUrl& url);
77

78
    QList<KDevelop::ILanguageCheck*> providedChecks() override;
79

80 81
    int configPages() const override;
    KDevelop::ConfigPage* configPage(int number, QWidget* parent) override;
82

83 84 85
    int perProjectConfigPages() const override;
    KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override;

86
public Q_SLOTS:
87
    void documentOpened(KDevelop::IDocument*);
88
    void updateStyleChecking(KDevelop::ReferencedTopDUContext top);
89

90
private:
91
    Highlighting* m_highlighting;
92 93
    Refactoring* m_refactoring;
    StyleChecking* m_styleChecking;
94
    static LanguageSupport* m_self;
95 96
};

97 98
}

99
#endif
Piyush Verma's avatar
Piyush Verma committed
100