[PATCH] D36150: [clangd] LSP extension to switch between source/header file

William Enright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 12:04:34 PDT 2017


Nebiroth marked 5 inline comments as done.
Nebiroth added inline comments.


================
Comment at: clangd/ClangdLSPServer.cpp:234
+  else
+    ResultUri = URI::fromFile("");
+
----------------
ilya-biryukov wrote:
> Running `unparse` on an instance created via `URI::fromFile("")`  will result in `"file:///"`. 
> 
> Have you considered returning a list of paths as a result from `switchHeaderSource`?
> That way you could capture the "no file matched" case with an empty list.
> Later when an implementation will look into index, that would allow to return multiple source files for a header file, which also  happens in some C++ projects.
> 
> Returning an empty string is also an option we could start with.
I think I will start by returning an empty string for now. Returning a list of paths sounds like a good idea once an indexer is implemented, but that would require changing some parts of the code like find_if which returns only the first instance of a match.


https://reviews.llvm.org/D36150





More information about the cfe-commits mailing list