CMake: Add CMakeSnippetProvider

This allows to define snippets for CMakeLists.txt files. They can not
be used yet:-/

Change-Id: Iad68632798ecfe04018d08d284f9b5a8b0e564ee
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Tobias Hunger
2016-08-18 13:22:06 +02:00
parent 5097acebf3
commit 59bab5e0ac
6 changed files with 110 additions and 0 deletions

View File

@@ -51,5 +51,8 @@ const char M_CONTEXT[] = "CMakeEditor.ContextMenu";
// Settings page
const char CMAKE_SETTINGSPAGE_ID[] = "Z.CMake";
// Snippets
const char CMAKE_SNIPPETS_GROUP_ID[] = "CMake";
} // namespace Constants
} // namespace CMakeProjectManager

View File

@@ -18,6 +18,7 @@ HEADERS = builddirmanager.h \
cmaketool.h \
cmakeparser.h \
cmakesettingspage.h \
cmakesnippetprovider.h \
cmaketoolmanager.h \
cmake_global.h \
cmakekitinformation.h \
@@ -44,6 +45,7 @@ SOURCES = builddirmanager.cpp \
cmaketool.cpp \
cmakeparser.cpp \
cmakesettingspage.cpp \
cmakesnippetprovider.cpp \
cmaketoolmanager.cpp \
cmakekitinformation.cpp \
cmakekitconfigwidget.cpp \

View File

@@ -64,6 +64,8 @@ QtcPlugin {
"cmaketoolmanager.h",
"cmakesettingspage.h",
"cmakesettingspage.cpp",
"cmakesnippetprovider.cpp",
"cmakesnippetprovider.h",
"cmakeindenter.h",
"cmakeindenter.cpp",
"cmakeautocompleter.h",

View File

@@ -30,6 +30,7 @@
#include "cmakeprojectmanager.h"
#include "cmakebuildconfiguration.h"
#include "cmakerunconfiguration.h"
#include "cmakesnippetprovider.h"
#include "cmakeprojectconstants.h"
#include "cmakelocatorfilter.h"
#include "cmakesettingspage.h"
@@ -46,6 +47,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
Q_UNUSED(errorMessage)
Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
addAutoReleasedObject(new Internal::CMakeSnippetProvider);
addAutoReleasedObject(new CMakeSettingsPage);
addAutoReleasedObject(new CMakeManager);
addAutoReleasedObject(new CMakeBuildStepFactory);

View File

@@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "cmakesnippetprovider.h"
#include "cmakeprojectconstants.h"
#include "cmakeeditor.h"
#include <texteditor/snippets/snippeteditor.h>
namespace CMakeProjectManager {
namespace Internal {
CMakeSnippetProvider::~CMakeSnippetProvider() = default;
QString CMakeProjectManager::Internal::CMakeSnippetProvider::groupId() const
{
return Constants::CMAKE_SNIPPETS_GROUP_ID;
}
QString CMakeProjectManager::Internal::CMakeSnippetProvider::displayName() const
{
return tr("CMake");
}
void CMakeProjectManager::Internal::CMakeSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
{
Q_UNUSED(editor);
// What needs to go here?
}
} // namespace Internal
} // namespace CMakeProjectManager

View File

@@ -0,0 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <texteditor/snippets/isnippetprovider.h>
namespace CMakeProjectManager {
namespace Internal {
class CMakeSnippetProvider : public TextEditor::ISnippetProvider
{
Q_OBJECT
public:
~CMakeSnippetProvider() final;
QString groupId() const final;
QString displayName() const final;
void decorateEditor(TextEditor::SnippetEditorWidget *editor) const final;
};
} // namespace Internal
} // namespace CMakeProjectManager