[PATCH] D94554: [clangd][WIP] Add a Filesystem that overlays Dirty files.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 14:20:14 PST 2021


njames93 created this revision.
Herald added subscribers: arphaman, javed.absar.
njames93 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Before I start, this should probably be on clangd-dev, but that list seems kinda dead so I've put my working here instead.

This definitely needs splitting up and tweaking most of the specifics but here is a proof of concept so to say.
The majority of changes here are:

- Change Drafts to hold ref counted strings.
- Add a ThreadsafeFS to Draftstore that overlays its contents over another ThreadsafeFS.
- Use said Filesystem in the ClangdServer to provide a way to access its contents in a much friendlier way.
- Add a command line option to control using that Filesystem when building pre-ambles.
- Always use this Filesystem when performing x-file renames and tweaks.

With all these changes I personally find the UX so much nicer.

I've put the Option for using DirtyBuffers when building pre-ambles as a hidden option for now, defaulted to off.
However as per LSP spec, we should think about in the future, once this is fully ready and tested to default it to on.
Also I know we shouldn't be using the command line really, when we have `.clangd` config instead.
This will be migrated to there in due time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94554

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/DraftStore.cpp
  clang-tools-extra/clangd/DraftStore.h
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/DraftStoreTests.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94554.316240.patch
Type: text/x-patch
Size: 41976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210112/e59f3c5e/attachment-0001.bin>


More information about the cfe-commits mailing list