File indexing completed on 2024-04-21 04:35:56

0001 /* This file is part of KDevelop
0002  *
0003  * Copyright 2006-2010 Alexander Dymo <adymo@kdevelop.org>
0004  * Copyright (C) 2014-2015 Miquel Sabaté Solà <mikisabate@gmail.com>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU Library General Public License as
0008  * published by the Free Software Foundation; either version 2 of the
0009  * License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public
0017  * License along with this program; if not, write to the
0018  * Free Software Foundation, Inc.,
0019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0020  */
0021 
0022 #ifndef RUBY_LANGUAGE_SUPPORT_H
0023 #define RUBY_LANGUAGE_SUPPORT_H
0024 
0025 #include <interfaces/iplugin.h>
0026 #include <language/interfaces/ilanguagesupport.h>
0027 
0028 #include <parser/node.h>
0029 
0030 namespace ruby {
0031 
0032 class Highlighting;
0033 class Launcher;
0034 struct Refactoring;
0035 
0036 namespace rails {
0037     class Support;
0038 }
0039 
0040 /**
0041  * @class LanguageSupport
0042  *
0043  * This is the class that represents the KDevelop Ruby Plugin. This class
0044  * also connects all the actions related to Rails navigation. And last, but
0045  * not least, this class also enables the plugin to execute the current Ruby
0046  * file or test functions.
0047  */
0048 class LanguageSupport
0049     : public KDevelop::IPlugin
0050     , public KDevelop::ILanguageSupport
0051 {
0052     Q_OBJECT
0053     Q_INTERFACES(KDevelop::ILanguageSupport)
0054 
0055 public:
0056     explicit LanguageSupport(QObject *parent, const QVariantList &args = {});
0057     ~LanguageSupport() override;
0058 
0059     /**
0060      * @return an instance of this LanguageSupport.
0061      */
0062     static LanguageSupport * self();
0063 
0064     /**
0065      * @return the name of the language.
0066      */
0067     QString name() const override;
0068 
0069     /**
0070      * @return the ParseJob that is going to be used by the Background
0071      * parser to parse the given @p url.
0072      */
0073     KDevelop::ParseJob * createParseJob(const KDevelop::IndexedString &url) override;
0074 
0075     /**
0076      * @return the Code Highlighting for the Ruby language.
0077      */
0078     KDevelop::ICodeHighlighting * codeHighlighting() const override;
0079 
0080     /**
0081      * @returns the ContextMenuExtension for the Php plugin.
0082      */
0083     KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override;
0084 
0085     /**
0086      * @return the version of Ruby to be picked.
0087      */
0088     enum ruby_version version() const;
0089 
0090     /**
0091      * Setup the actions defined by this plugin.
0092      */
0093     void createActionsForMainWindow(Sublime::MainWindow *window,
0094                                     QString &xmlFile,
0095                                     KActionCollection &actions) override;
0096 
0097 private:
0098     Highlighting *m_highlighting;
0099     Refactoring *m_refactoring;
0100     Launcher *m_launcher;
0101     enum ruby_version m_version;
0102 
0103     rails::Support *m_rails;
0104 };
0105 
0106 }
0107 
0108 #endif // RUBY_LANGUAGE_SUPPORT_H
0109