diff options
author | Fawzi Mohamed <fawzi.mohamed@qt.io> | 2022-04-28 12:20:56 +0200 |
---|---|---|
committer | Fawzi Mohamed <fawzi.mohamed@qt.io> | 2022-05-02 21:58:59 +0200 |
commit | e2708875ae3d0ff58882f845887fa4f55a2d5876 (patch) | |
tree | 26108a8eb564dd97bad80aef1907f5835d62416d /tools/qmlls/qqmlcodemodel.h | |
parent | 3a4b6b9ba212943e3f8ab3261493ae5a4eaf8dfd (diff) |
qmlls: call lsp uris urls
The Language Server Protocol calls several attributes "uri",
consistent with their definition in RFC 3986.
In Qml URI is normally used as module uri, i.e. a dot separated
sequence.
As per RFC 3986 URL is a subset of URI, but it turn out that the
usages in LSP are actually URLs, so use "url"" for its usages, to keep
the uri term as used in qqmlcodemodel unambiguous.
Leave the protocol objects usages of uri consistent with the LSP
definition, and use a noop lspUriToQmlUrl() to highlight the
transition between the two usages of uri.
Change-Id: Icf2ab5455e88849991e8a3432c5a2c91503d1285
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qmlls/qqmlcodemodel.h')
-rw-r--r-- | tools/qmlls/qqmlcodemodel.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/qmlls/qqmlcodemodel.h b/tools/qmlls/qqmlcodemodel.h index cf7a3cacbe..c217ef8437 100644 --- a/tools/qmlls/qqmlcodemodel.h +++ b/tools/qmlls/qqmlcodemodel.h @@ -52,7 +52,7 @@ public: AllCode = LatestCode | ValidCode }; Q_DECLARE_FLAGS(DumpOptions, DumpOption) - QByteArray uri; + QByteArray url; std::optional<int> docVersion; QQmlJS::Dom::DomItem doc; std::optional<int> validDocVersion; @@ -83,15 +83,15 @@ class QQmlCodeModel : public QObject { Q_OBJECT public: - enum class UriLookup { Caching, ForceLookup }; + enum class UrlLookup { Caching, ForceLookup }; enum class State { Running, Stopping }; explicit QQmlCodeModel(QObject *parent = nullptr); ~QQmlCodeModel(); QQmlJS::Dom::DomItem currentEnv(); QQmlJS::Dom::DomItem validEnv(); - OpenDocumentSnapshot snapshotByUri(const QByteArray &uri); - OpenDocument openDocumentByUri(const QByteArray &uri); + OpenDocumentSnapshot snapshotByUrl(const QByteArray &url); + OpenDocument openDocumentByUrl(const QByteArray &url); void openNeedUpdate(); void indexNeedsUpdate(); @@ -99,12 +99,12 @@ public: void addOpenToUpdate(const QByteArray &); void removeDirectory(const QString &path); // void updateDocument(const OpenDocument &doc); - QString uri2Path(const QByteArray &uri, UriLookup options = UriLookup::Caching); - void newOpenFile(const QByteArray &uri, int version, const QString &docText); - void newDocForOpenFile(const QByteArray &uri, int version, const QString &docText); - void closeOpenFile(const QByteArray &uri); + QString url2Path(const QByteArray &url, UrlLookup options = UrlLookup::Caching); + void newOpenFile(const QByteArray &url, int version, const QString &docText); + void newDocForOpenFile(const QByteArray &url, int version, const QString &docText); + void closeOpenFile(const QByteArray &url); signals: - void updatedSnapshot(const QByteArray &uri); + void updatedSnapshot(const QByteArray &url); private: void indexDirectory(const QString &path, int depthLeft); int indexEvalProgress() const; // to be called in the mutex @@ -130,8 +130,8 @@ private: QQmlJS::Dom::DomItem m_validEnv; QByteArray m_lastOpenDocumentUpdated; QSet<QByteArray> m_openDocumentsToUpdate; - QHash<QByteArray, QString> m_uri2path; - QHash<QString, QByteArray> m_path2uri; + QHash<QByteArray, QString> m_url2path; + QHash<QString, QByteArray> m_path2url; QHash<QByteArray, OpenDocument> m_openDocuments; }; |