ArcsinX wrote:

> In terms of how to notify the user, I can think of 3 options:
> 
> 1. Print an error message to the log (clangd's stderr) using `elog()`. This 
> is the easiest to implement, but it's  also easy for the user to overlook it.
> 2. Generate a diagnostic, pushed to the client with 
> `textDocument/publishDiagnostics`, on line 1 of any opened file. This takes 
> some more plumbing to implement, but it's much more likely the user will 
> notice it.

I'm more inclined to the first option. The absence of resource-dir usually 
leads to a large number of errors, and when there are many of them, it seems 
easy to miss a specific one (I mean hear possible resource-dir not existing 
diagnostic), given that the first line of the file will most likely contain the 
"too many errors" diagnostic.
It's relatively likely to me that the user will look into the log when there 
are a lot of red wavy lines in the file.

> 3. Exit clangd, i.e. clangd refuses to start with a non-existent resource 
> directory. This one the user definitely can't miss, but it's a pretty drastic 
> option. (Maybe there are use cases where clangd still works without a 
> resource directory, which this would break?)

This also seems reasonable, but only if the user has specified the resource-dir 
explicitly via clangd command line arguments.



https://github.com/llvm/llvm-project/pull/203332
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to