[all-commits] [llvm/llvm-project] bca3e2: [clangd] Move DraftStore from ClangdLSPServer into...

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Mar 2 13:59:13 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bca3e24139cc301d7deae56a020057cf657035b6
      https://github.com/llvm/llvm-project/commit/bca3e24139cc301d7deae56a020057cf657035b6
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-03-02 (Tue, 02 Mar 2021)

  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/DraftStore.cpp
    M clang-tools-extra/clangd/DraftStore.h
    M clang-tools-extra/clangd/SourceCode.cpp
    M clang-tools-extra/clangd/SourceCode.h
    M clang-tools-extra/clangd/test/crash-non-added-files.test
    M clang-tools-extra/clangd/unittests/ClangdTests.cpp
    M clang-tools-extra/clangd/unittests/DraftStoreTests.cpp
    M clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
    M clang-tools-extra/clangd/unittests/SyncAPI.cpp
    M clang-tools-extra/clangd/unittests/SyncAPI.h

  Log Message:
  -----------
  [clangd] Move DraftStore from ClangdLSPServer into ClangdServer.

ClangdServer already gets notified of every change, so it makes sense for it to
be the source of truth.
This is a step towards having ClangdServer expose a FS that includes dirty
buffers: D94554

Related changes:
 - version is now optional for ClangdServer, to preserve our existing fuzziness
   in this area (missing version ==> autoincrement)
 - ClangdServer::format{File,Range} are now more regular ClangdServer functions
   that don't need the code passed in. While here, combine into one function.
 - incremental content update logic is moved from DraftStore to
   ClangdLSPServer, with most of the implementation in SourceCode.cpp.
   DraftStore is now fairly trivial, and will probably ultimately be
   *replaced* by the dirty FS stuff.

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




More information about the All-commits mailing list