[all-commits] [llvm/llvm-project] ffa63d: [clangd] Run formatting operations asynchronously.

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Jun 30 15:52:30 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ffa63dde8e97a34b8914a151556551f74d4227e7
      https://github.com/llvm/llvm-project/commit/ffa63dde8e97a34b8914a151556551f74d4227e7
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-07-01 (Wed, 01 Jul 2020)

  Changed paths:
    M clang-tools-extra/clangd/ClangdLSPServer.cpp
    M clang-tools-extra/clangd/ClangdServer.cpp
    M clang-tools-extra/clangd/ClangdServer.h
    M clang-tools-extra/clangd/unittests/ClangdTests.cpp
    M clang-tools-extra/clangd/unittests/SyncAPI.cpp
    M clang-tools-extra/clangd/unittests/SyncAPI.h

  Log Message:
  -----------
  [clangd] Run formatting operations asynchronously.

Summary:
They don't need ASTs or anything, so they should still run immediately.

These were sync for historical reasons (they predate clangd having a pervasive
threading model). This worked ok as they were "cheap".
Aside for consistency, there are a couple of reasons to make them async:
 - they do IO (finding .clang-format) so aren't trivially cheap
 - having TUScheduler involved in running these tasks means we can use it as
   an injection point for configuration.
   (TUScheduler::run will need to learn about which file is being operated on,
   but that's an easy change).
 - adding the config system adds more potential IO, too

Reviewers: kbobyrev

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

Tags: #clang

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




More information about the All-commits mailing list