monaco-languageclient icon indicating copy to clipboard operation
monaco-languageclient copied to clipboard

Quick fix is not available when changing message in middleware.

Open CherryPetale opened this issue 1 year ago • 2 comments

Quick fix is not available when changing message in middleware.

return new MonacoLanguageClient({
    name: 'client name',
    clientOptions: {
       ...
        middleware: {
            handleDiagnostics: (uri, d, next) => {
                const newd = d.map((v) => {
                    if (v.message.includes("fix available")) {
+                        v.message = "change message";
                    }
                    return v;
                });
                next(uri, newd);
            }
        }
    }
});
screenshot 2024-01-05 013739 screenshot 2024-01-05 013632

or is it a monaco-editor issue?

CherryPetale avatar Jan 04 '24 16:01 CherryPetale

@CherryPetale Does this work as expected in vscode? I don't think this should work, since the code actions/quick fixes are attached to the diagnostic. If the diagnostic changes somehow in transition, it is expected that the editor cannot attach the code actions anymore, since the diagnostic they were attached to no longer exists (at least in the expected form).

msujew avatar Jan 04 '24 17:01 msujew

@msujew I don't know how to check with vscode so I can't try right away, but all I am trying to do is translate and display the error text, so if it is too difficult I will give up.

CherryPetale avatar Jan 04 '24 17:01 CherryPetale

@CherryPetale did succeed with reproducing it in VSCode?

kaisalmen avatar Mar 13 '24 13:03 kaisalmen

@kaisalmen Sorry. I didn't know how to do it and gave up. Also, I am going to close issue if there are no problems, as it does not seem to be the original use of the middleware in the first place.

CherryPetale avatar Mar 13 '24 16:03 CherryPetale

@CherryPetale I will close this now. Feel free to open another issue or discussion if it makes sense.

kaisalmen avatar Mar 22 '24 13:03 kaisalmen