forked from qt-creator/qt-creator
ClangFormat: Replace checks widget with editor
The existing approach utilizing the widget poses maintenance challenges, primarily due to the dynamic nature of clang-format settings across versions. The widget necessitates regeneration for each new version, and compatibility issues arise when users have different clang-format versions on their devices. The updated solution adopts an Editor integrated with a yaml language server, offering the ability to highlight and provide code completion for the .clang-format file. This resolves the widget regeneration issue and ensures compatibility with various clang-format versions. - Replaced the checks widget with an editor - Introduced a line for yaml language server schema in .clang-format files to enable autocompletion. ToDo: Enhance schema accessibility without relying on this line. - Added Ctrl+Space shortcut for autocompletion - Added Ctrl+S shortcut for saving - Eliminated outdated logic related to the checks widget - Fixed copying and removal of clang-format settings Change-Id: I2e3fbf19abe2f4df031f6ba5faffd47e07274346 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
@@ -26,6 +27,7 @@ class LanguageClientPlugin final : public ExtensionSystem::IPlugin
|
||||
public:
|
||||
LanguageClientPlugin()
|
||||
{
|
||||
setObjectName("LanguageClient");
|
||||
qRegisterMetaType<LanguageServerProtocol::JsonRpcMessage>();
|
||||
}
|
||||
|
||||
@@ -34,6 +36,24 @@ private:
|
||||
void extensionsInitialized() final;
|
||||
ShutdownFlag aboutToShutdown() final;
|
||||
|
||||
Q_SLOT void openDocument(Core::IDocument *document)
|
||||
{
|
||||
LanguageClientManager::openDocument(document);
|
||||
}
|
||||
|
||||
Q_SLOT void closeDocument(Core::IDocument *document)
|
||||
{
|
||||
LanguageClientManager::closeDocument(document);
|
||||
}
|
||||
|
||||
Q_SLOT void openEditor(Core::IEditor *editor) { LanguageClientManager::openEditor(editor); }
|
||||
|
||||
Q_SLOT void closeClientForDocument(TextEditor::TextDocument *document)
|
||||
{
|
||||
if (auto client = LanguageClientManager::clientForDocument(document))
|
||||
client->closeDocument(document);
|
||||
}
|
||||
|
||||
LanguageClientOutlineWidgetFactory m_outlineFactory;
|
||||
};
|
||||
|
||||
@@ -57,6 +77,8 @@ void LanguageClientPlugin::initialize()
|
||||
inspectAction.setText(Tr::tr("Inspect Language Clients..."));
|
||||
inspectAction.addToContainer(Core::Constants::M_TOOLS_DEBUG);
|
||||
inspectAction.addOnTriggered(this, &LanguageClientManager::showInspector);
|
||||
|
||||
ExtensionSystem::PluginManager::addObject(this);
|
||||
}
|
||||
|
||||
void LanguageClientPlugin::extensionsInitialized()
|
||||
@@ -66,6 +88,7 @@ void LanguageClientPlugin::extensionsInitialized()
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag LanguageClientPlugin::aboutToShutdown()
|
||||
{
|
||||
ExtensionSystem::PluginManager::removeObject(this);
|
||||
LanguageClientManager::shutdown();
|
||||
if (LanguageClientManager::isShutdownFinished())
|
||||
return ExtensionSystem::IPlugin::SynchronousShutdown;
|
||||
|
||||
Reference in New Issue
Block a user