Add a delegate to errors.d to make error handling configurable#10072
Add a delegate to errors.d to make error handling configurable#10072RazvanN7 merged 3 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @ManishKhurana11! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#10072" |
jacob-carlborg
left a comment
There was a problem hiding this comment.
I've been planning to do something similar. I don't think this is the best approach. I've been discussing this with Walter and he prefers we add a delegate to make the error handling configurable. By default the delegate would do what verrorPrint does today.
What is that? |
That appears to be the Language Server Protocol GSoC project: https://forum.dlang.org/post/tatciprksgbbnczqfxbc@forum.dlang.org |
We shouldn't have to guess. Besides, @jacob-carlborg is right. Instead of adding more and more data structures and complexity for error reporting in the compiler, just add a sink delegate that the compiler sends the message to, and the recipient then does what it needs. |
For reference, LSP (Language Server Protocol) [1] is a client-server protocol for implementing intellisense (code completion, go to definition, and so on). The client would be a text editor or an IDE and the server would be a daemon running in the background containing all the logic for the intellisense. The idea is that one doesn't have to implement the same intellisense logic (for a given language) for all the text editors out there. It's enough to implement once. Same idea as the separation of a compiler frontend and backend. Manish Khurana is a Google Summer of Code student that is working on an LSP server that is using DMD as a library. |
bf06411 to
fbb9562
Compare
|
Please add a new parameter to the [1] Lines 105 to 108 in bc6bb99 |
0530b1d to
6878910
Compare
6878910 to
e8e553a
Compare
|
I think this is fine, but please add a test similar to the ones in https://github.com/dlang/dmd/blob/master/test/unit |
1950037 to
0c17d1e
Compare
|
I've pushed some minor changes:
If this is merged, the DiagnosticReporter classes could build on it and could be moved from the core compiler to the frontend library as in master...rainers:move_diagreport. @jacob-carlborg would you be ok with this? |
af15bfa to
f5711ae
Compare
|
Yes. |
f5711ae to
1356f3b
Compare
|
What is the status of this? Should we merge this or do you have an alternate solution @jacob-carlborg ? |
|
I don’t have an alternate solution. But the handler should be set to |
Ok, I added that. |
bd158ce to
0f40610
Compare
|
@jacob-carlborg Is your change request resolved? As I have contributed to this PR I'm biased and hesitate to merge it myself, I'm using it in my own fork for a language server, though, and would like to reduce differences... |
Yes. |
|
Thanks! |
This PR adds a delegate to errors.d to make error handling configurable