[all-commits] [llvm/llvm-project] c627b1: [clangd] Cancel certain operations if the file cha...

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


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

  Changed paths:
    M clang-tools-extra/clangd/Cancellation.cpp
    M clang-tools-extra/clangd/Cancellation.h
    M clang-tools-extra/clangd/ClangdServer.cpp
    M clang-tools-extra/clangd/JSONTransport.cpp
    M clang-tools-extra/clangd/TUScheduler.cpp
    M clang-tools-extra/clangd/TUScheduler.h
    M clang-tools-extra/clangd/unittests/CancellationTests.cpp
    M clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

  Log Message:
  -----------
  [clangd] Cancel certain operations if the file changes before we start.

Summary:
Otherwise they can force us to build lots of snapshots that we don't need.
Particularly, try to do this for operations that are frequently
generated by editors without explicit user interaction, and where
editing the file makes the result less useful. (Code action
enumeration is a good example).

https://github.com/clangd/clangd/issues/298

This doesn't return the "right" LSP error code (ContentModified) to the client,
we need to teach the cancellation API to distinguish between different causes.

Reviewers: kadircet

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

Tags: #clang

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




More information about the All-commits mailing list