Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmldocumentsymbolsupport.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qqmldocumentsymbolsupport_p.h"
5
#
include
"private/documentsymbolutils_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
using
namespace
Qt::StringLiterals;
10
QQmlDocumentSymbolSupport
::
QQmlDocumentSymbolSupport
(QmlLsp::QQmlCodeModelManager *model)
11
:
BaseT
(
model
)
12
{
13
}
14
15
void
QQmlDocumentSymbolSupport
::
setupCapabilities
(QLspSpecification::ServerCapabilities &caps)
16
{
17
caps.documentSymbolProvider =
true
;
18
}
19
20
void
QQmlDocumentSymbolSupport
::
registerHandlers
(QLanguageServer *,
21
QLanguageServerProtocol *protocol)
22
{
23
protocol->registerDocumentSymbolRequestHandler(getRequestHandler());
24
}
25
26
void
QQmlDocumentSymbolSupport
::
process
(QQmlDocumentSymbolSupport::RequestPointerArgument request)
27
{
28
const
auto
doc = m_codeModelManager->openDocumentByUrl(
29
QQmlLSUtils::lspUriToQmlUrl(request->m_parameters.textDocument.uri));
30
const
auto
qmlFileItem = doc.snapshot.validDoc.fileObject(QQmlJS::Dom::GoTo::MostLikely);
31
QList<QLspSpecification::DocumentSymbol> results;
32
ResponseScopeGuard guard(results, request->m_response);
33
if
(qmlFileItem.internalKind() != QQmlJS::Dom::DomType::QmlFile)
34
return
;
35
results = DocumentSymbolUtils::assembleSymbolsForQmlFile(qmlFileItem);
36
DocumentSymbolUtils::reorganizeForOutlineView(results);
37
}
38
39
QT_END_NAMESPACE
QQmlDocumentSymbolSupport
Definition
qqmldocumentsymbolsupport_p.h:31
QQmlDocumentSymbolSupport::QQmlDocumentSymbolSupport
QQmlDocumentSymbolSupport(QmlLsp::QQmlCodeModelManager *codeModel)
Definition
qqmldocumentsymbolsupport.cpp:10
QQmlDocumentSymbolSupport::process
void process(RequestPointerArgument req) override
Definition
qqmldocumentsymbolsupport.cpp:26
QQmlDocumentSymbolSupport::setupCapabilities
void setupCapabilities(QLspSpecification::ServerCapabilities &caps) override
Definition
qqmldocumentsymbolsupport.cpp:15
QQmlDocumentSymbolSupport::registerHandlers
void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override
Definition
qqmldocumentsymbolsupport.cpp:20
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
qmlls
documentSymbolSupport
qqmldocumentsymbolsupport.cpp
Generated on
for Qt by
1.18.0