[PATCH] D54077: [clangd] Implemented DraftFileSystem

Lutsenko Danil via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 06:57:08 PST 2018


LutsenkoDanil planned changes to this revision.
LutsenkoDanil added a comment.

@ilya-biryukov, For example, VSCode saves all changed files by default when you press Ctrl+Shift+B (if build task configured for project).

@klimek If behavior will be configurable, is it ok for you?

@sammccall Current behavior may confuse new users, since, other IDEs mostly (all?) shows diagnostics for edited files instead of saved one. And it's unexpected that headers have 2 states - visible and saved (which cannot be viewed in IDE at all). Looks like performance will be same like usage of 'auto save after delay' feature in editor, if we make debounce delay configurable, what do you think?

I suggest inroduce following changes to the patch:

[ ] Changes proposed by @ilya-biryukov
[ ] Configurable behavior
[ ] Debounce timeout option



================
Comment at: clangd/FS.h:82
+
+    if (auto D = DS.getDraft(Path.str())) {
+      return std::unique_ptr<llvm::vfs::File>(
----------------
ilya-biryukov wrote:
> This assumes the `Path` is absolute and `vfs::FileSystem` can be called with non-absolute paths too.
> One way to make it work with relative paths is to create an `InMemoryFileSystem` with the headers (it handles the absolute paths conversions) and create an `OverlayFileSystem` on top of it and the `RealFileSystem`.
> 
> This would also make more complicated things work, e.g. getting the same files when traversing parent directories, etc.
> 
> Could we try this approach? WDYT?
> 
Sounds good. Thank you for review!


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54077





More information about the cfe-commits mailing list