CMake: Indentation and matching brace insertion for the CMake editor

Adds the following improvements to the CMake editor:
* Indentation support (both through Ctrl+I and when pressing enter)
* Insertion of matching paranthesis and quotes (pressing '(' inserts ')')

Change-Id: If9a63b08b3e0897989e4d8ac69e3acc072b0b825
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
Jan Dalheimer
2015-08-24 08:43:18 +02:00
parent 2108b2de6f
commit ac98023275
7 changed files with 404 additions and 4 deletions

View File

@@ -33,6 +33,8 @@
#include "cmakefilecompletionassist.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include "cmakeindenter.h"
#include "cmakeautocompleter.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -274,14 +276,17 @@ CMakeEditorFactory::CMakeEditorFactory()
setEditorCreator([]() { return new CMakeEditor; });
setEditorWidgetCreator([]() { return new CMakeEditorWidget; });
setDocumentCreator([]() { return new CMakeDocument; });
setIndenterCreator([]() { return new CMakeIndenter; });
setUseGenericHighlighter(true);
setCommentStyle(Utils::CommentDefinition::HashStyle);
setCodeFoldingSupported(true);
setCompletionAssistProvider(new CMakeFileCompletionAssistProvider);
setAutoCompleterCreator([]() { return new CMakeAutoCompleter; });
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor);
| TextEditorActionHandler::JumpToFileUnderCursor
| TextEditorActionHandler::Format);
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT);
contextMenu->addAction(ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR));