[PATCH] D75582: [clangd] Track document versions, include them with diags, enhance logs

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 16:40:15 PST 2020


sammccall created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay, javed.absar, ilya-biryukov.
Herald added a project: clang.
sammccall updated this revision to Diff 248069.
sammccall added a comment.
sammccall added a reviewer: hokein.
sammccall updated this revision to Diff 248070.

Fix accidental default.


sammccall added a comment.

Fix incomplete message.


This ties to an LSP feature (diagnostic versioning) but really a lot
of the value is in being able to log what's happening with file versions
and queues more descriptively and clearly.

As such it's fairly invasive, for a logging patch :-\

Key decisions:

- at the LSP layer, we don't reqire the client to provide versions (LSP makes it mandatory but we never enforced it). If not provided, versions start at 0 and increment. DraftStore handles this.
- don't propagate magically using contexts, but rather manually: addDocument -> ParseInputs -> (ParsedAST, Preamble, various callbacks) Context-propagation would hide the versions from ClangdServer, which would make producing good log messages hard
- within ClangdServer, treat versions as opaque and unordered. json::Value is a convenient type for this, and allows richer versions for embedders. They're "mandatory" but nullptr is a sensible default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75582

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/Compiler.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/ParsedAST.h
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/Preamble.h
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/Protocol.h
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/index/FileIndex.cpp
  clang-tools-extra/clangd/index/FileIndex.h
  clang-tools-extra/clangd/test/diagnostic-category.test
  clang-tools-extra/clangd/test/diagnostics-no-tidy.test
  clang-tools-extra/clangd/test/diagnostics-notes.test
  clang-tools-extra/clangd/test/diagnostics.test
  clang-tools-extra/clangd/test/did-change-configuration-params.test
  clang-tools-extra/clangd/test/execute-command.test
  clang-tools-extra/clangd/test/fixits-codeaction.test
  clang-tools-extra/clangd/test/fixits-command.test
  clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
  clang-tools-extra/clangd/test/path-mappings.test
  clang-tools-extra/clangd/test/semantic-highlighting.test
  clang-tools-extra/clangd/test/version.test
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
  clang-tools-extra/clangd/unittests/SyncAPI.cpp
  clang-tools-extra/clangd/unittests/SyncAPI.h
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
  clang-tools-extra/clangd/unittests/TestTU.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75582.248070.patch
Type: text/x-patch
Size: 69904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200304/a193b00e/attachment-0001.bin>


More information about the cfe-commits mailing list