[PATCH] D82642: [clangd] Run formatting operations asynchronously.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 04:18:39 PDT 2020


sammccall created this revision.
sammccall added a reviewer: kbobyrev.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82642

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/SyncAPI.cpp
  clang-tools-extra/clangd/unittests/SyncAPI.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82642.273654.patch
Type: text/x-patch
Size: 11067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200626/c6788fd1/attachment-0001.bin>


More information about the cfe-commits mailing list