Use Server side Diagnostics#4856
Conversation
|
Below is a small documentation of a different API Design that i tried exploring. Origin :if we notice the use of our new API in
attempted solutionTLDR : case (File Not published ) => empty codeaction on first load :)
Pros :More versatile API ( and efficient ) Cons :Fall back case results to no codeaction |
|
Using a separate primitive for writing CodeAction handlers does the job, but can we do better? I think we perform some similar special logic in ghcide for certain requests? |
|
I began working with this same logic that you present. I tried updating the f' helper that is responsible for intercepting and calling for codeaction in mkpluginhandler. Later discarded it because that felt too complicated. But yea, i can surly work on it. Just so that we are on the same page, our expectation is : Basically, update mkpluginhandler such that it does everything our new API does. Helping users to remain as they were before on the caller site. |
20a6e5c to
5524332
Compare
|
I think this does what we were expecting. Surprisingly simpler than what i was trying to do before so thanks for the direction :) |
|
Could you also expand the commit message to contain more information? |
5524332 to
15595dc
Compare
|
Are there any call sites of Also, you have to rebase this PR as there is a conflict. |
15595dc to
bb01d40
Compare
I don't think we can replace any of the Below is the list of all plugins that uses
I have Rebased it on top of master; |
fendor
left a comment
There was a problem hiding this comment.
Some doc changes, and one thing to discuss, otherwise looks good to me!
Replace client-supplied diagnostics in CodeActionParams with server-side diagnostics when available, falling back otherwise. Required for consistent code action behavior.
Since Server Diags are authoritive, dont fallback to client diags. Cases where server resolved all diags but client still have stale diags may break from expected behaviour. Also change tests that deviate from expectations
f395c21 to
716011a
Compare
|
I have rebased on top of Master; Thanks a lot for reviewing and co-authoring this PR 🚀 |
Fixes #4805
This PR aims to deliver server-side diagnostics to codeactions.
The Comment below linked issue by @fendor stated
This is the approach i followed, hopefully it aligns with the expectations :
mkCodeActionHandlerWithDiagnosticsmkPluginHandler SMethod_TextDocumentCodeActionactiveDiagnosticsInRangeis used to fetch server-side diagnosticsmkPluginHandler SMethod_TextDocumentCodeActionwith this fresh diagnostics ( if available ).Edit :
the above mentioned approach has been discarded. The new approach follows :