[all-commits] [llvm/llvm-project] 2cd33e: [clangd] Track document versions, include them wit...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Mar 4 16:23:15 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2cd33e6fe60f1fe1155ae86ef7e843df55066bda
      https://github.com/llvm/llvm-project/commit/2cd33e6fe60f1fe1155ae86ef7e843df55066bda
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-03-05 (Thu, 05 Mar 2020)

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

  Log Message:
  -----------
  [clangd] Track document versions, include them with diags, enhance logs

Summary:
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.
   std::string is a convenient type for this, and allows richer versions
   for embedders. They're "mandatory" but "null" is a reasonable default.

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75582




More information about the All-commits mailing list