How to display LSP's relatedInformation in VS Code












0















I'm writing a language server. It delivers additional DiagnosticRelatedInformation as part of its diagnostics response. Just like in https://code.visualstudio.com/updates/v1_22#_related-information-in-errors-and-warnings.
Currently, though while I do see the main error being displayed both in the "Problems" window and in the main text area, the additional "relatedInformation" is nowhere to be seen.



I suspect there may be two reasons for this. Either clientside: the capability of displaying this information is not enabled in VS Code. At least when the protocol is initiated, this capability is nowhere to be seen, here is the initial JSON message from the client:



[Trace - 2:22:13 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 6640,
"rootPath": null,
"rootUri": null,
"capabilities": {
"workspace": {
"applyEdit": true,
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true
},
"executeCommand": {
"dynamicRegistration": true
}
},
"textDocument": {
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true
}
},
"hover": {
"dynamicRegistration": true
},
"signatureHelp": {
"dynamicRegistration": true
},
"definition": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true
},
"codeAction": {
"dynamicRegistration": true
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true
},
"documentLink": {
"dynamicRegistration": true
}
}
},
"trace": "verbose"
}


I'm using VS Code 1.28.2 on Win10, by the way.



The other reason may be serverside: the response that contains the diagnostics may be misformed. It looks like this:



Params: {
"diagnostics": [
{
"code": null,
"message": "the declaration of 'x' shadows an existing declaration",
"range": {
"end": {
"character": 17,
"line": 8
},
"start": {
"character": 17,
"line": 8
}
},
"relatedInformation": [
{
"location": {
"uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
"range": {
"end": {
"character": 13,
"line": 6
},
"start": {
"character": 13,
"line": 6
}
}
},
"message": "existing declaration"
},
{
"location": {
"uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
"range": {
"end": {
"character": 17,
"line": 8
},
"start": {
"character": 17,
"line": 8
}
}
},
"message": "shadowing declaration"
}
],
"severity": {
"_tag": 0
},
"source": "Parsing Error"
}
],
"uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc"
}


At least the URIs are correct (though modified for readability here) since I can click on them and the editor does jump to the correct file.



My problem is I do not see how to test the one or the other hypothesis about what is going wrong. Or maybe I am missing something completely different?










share|improve this question



























    0















    I'm writing a language server. It delivers additional DiagnosticRelatedInformation as part of its diagnostics response. Just like in https://code.visualstudio.com/updates/v1_22#_related-information-in-errors-and-warnings.
    Currently, though while I do see the main error being displayed both in the "Problems" window and in the main text area, the additional "relatedInformation" is nowhere to be seen.



    I suspect there may be two reasons for this. Either clientside: the capability of displaying this information is not enabled in VS Code. At least when the protocol is initiated, this capability is nowhere to be seen, here is the initial JSON message from the client:



    [Trace - 2:22:13 PM] Sending request 'initialize - (0)'.
    Params: {
    "processId": 6640,
    "rootPath": null,
    "rootUri": null,
    "capabilities": {
    "workspace": {
    "applyEdit": true,
    "didChangeConfiguration": {
    "dynamicRegistration": true
    },
    "didChangeWatchedFiles": {
    "dynamicRegistration": true
    },
    "symbol": {
    "dynamicRegistration": true
    },
    "executeCommand": {
    "dynamicRegistration": true
    }
    },
    "textDocument": {
    "synchronization": {
    "dynamicRegistration": true,
    "willSave": true,
    "willSaveWaitUntil": true,
    "didSave": true
    },
    "completion": {
    "dynamicRegistration": true,
    "completionItem": {
    "snippetSupport": true,
    "commitCharactersSupport": true
    }
    },
    "hover": {
    "dynamicRegistration": true
    },
    "signatureHelp": {
    "dynamicRegistration": true
    },
    "definition": {
    "dynamicRegistration": true
    },
    "references": {
    "dynamicRegistration": true
    },
    "documentHighlight": {
    "dynamicRegistration": true
    },
    "documentSymbol": {
    "dynamicRegistration": true
    },
    "codeAction": {
    "dynamicRegistration": true
    },
    "codeLens": {
    "dynamicRegistration": true
    },
    "formatting": {
    "dynamicRegistration": true
    },
    "rangeFormatting": {
    "dynamicRegistration": true
    },
    "onTypeFormatting": {
    "dynamicRegistration": true
    },
    "rename": {
    "dynamicRegistration": true
    },
    "documentLink": {
    "dynamicRegistration": true
    }
    }
    },
    "trace": "verbose"
    }


    I'm using VS Code 1.28.2 on Win10, by the way.



    The other reason may be serverside: the response that contains the diagnostics may be misformed. It looks like this:



    Params: {
    "diagnostics": [
    {
    "code": null,
    "message": "the declaration of 'x' shadows an existing declaration",
    "range": {
    "end": {
    "character": 17,
    "line": 8
    },
    "start": {
    "character": 17,
    "line": 8
    }
    },
    "relatedInformation": [
    {
    "location": {
    "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
    "range": {
    "end": {
    "character": 13,
    "line": 6
    },
    "start": {
    "character": 13,
    "line": 6
    }
    }
    },
    "message": "existing declaration"
    },
    {
    "location": {
    "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
    "range": {
    "end": {
    "character": 17,
    "line": 8
    },
    "start": {
    "character": 17,
    "line": 8
    }
    }
    },
    "message": "shadowing declaration"
    }
    ],
    "severity": {
    "_tag": 0
    },
    "source": "Parsing Error"
    }
    ],
    "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc"
    }


    At least the URIs are correct (though modified for readability here) since I can click on them and the editor does jump to the correct file.



    My problem is I do not see how to test the one or the other hypothesis about what is going wrong. Or maybe I am missing something completely different?










    share|improve this question

























      0












      0








      0








      I'm writing a language server. It delivers additional DiagnosticRelatedInformation as part of its diagnostics response. Just like in https://code.visualstudio.com/updates/v1_22#_related-information-in-errors-and-warnings.
      Currently, though while I do see the main error being displayed both in the "Problems" window and in the main text area, the additional "relatedInformation" is nowhere to be seen.



      I suspect there may be two reasons for this. Either clientside: the capability of displaying this information is not enabled in VS Code. At least when the protocol is initiated, this capability is nowhere to be seen, here is the initial JSON message from the client:



      [Trace - 2:22:13 PM] Sending request 'initialize - (0)'.
      Params: {
      "processId": 6640,
      "rootPath": null,
      "rootUri": null,
      "capabilities": {
      "workspace": {
      "applyEdit": true,
      "didChangeConfiguration": {
      "dynamicRegistration": true
      },
      "didChangeWatchedFiles": {
      "dynamicRegistration": true
      },
      "symbol": {
      "dynamicRegistration": true
      },
      "executeCommand": {
      "dynamicRegistration": true
      }
      },
      "textDocument": {
      "synchronization": {
      "dynamicRegistration": true,
      "willSave": true,
      "willSaveWaitUntil": true,
      "didSave": true
      },
      "completion": {
      "dynamicRegistration": true,
      "completionItem": {
      "snippetSupport": true,
      "commitCharactersSupport": true
      }
      },
      "hover": {
      "dynamicRegistration": true
      },
      "signatureHelp": {
      "dynamicRegistration": true
      },
      "definition": {
      "dynamicRegistration": true
      },
      "references": {
      "dynamicRegistration": true
      },
      "documentHighlight": {
      "dynamicRegistration": true
      },
      "documentSymbol": {
      "dynamicRegistration": true
      },
      "codeAction": {
      "dynamicRegistration": true
      },
      "codeLens": {
      "dynamicRegistration": true
      },
      "formatting": {
      "dynamicRegistration": true
      },
      "rangeFormatting": {
      "dynamicRegistration": true
      },
      "onTypeFormatting": {
      "dynamicRegistration": true
      },
      "rename": {
      "dynamicRegistration": true
      },
      "documentLink": {
      "dynamicRegistration": true
      }
      }
      },
      "trace": "verbose"
      }


      I'm using VS Code 1.28.2 on Win10, by the way.



      The other reason may be serverside: the response that contains the diagnostics may be misformed. It looks like this:



      Params: {
      "diagnostics": [
      {
      "code": null,
      "message": "the declaration of 'x' shadows an existing declaration",
      "range": {
      "end": {
      "character": 17,
      "line": 8
      },
      "start": {
      "character": 17,
      "line": 8
      }
      },
      "relatedInformation": [
      {
      "location": {
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
      "range": {
      "end": {
      "character": 13,
      "line": 6
      },
      "start": {
      "character": 13,
      "line": 6
      }
      }
      },
      "message": "existing declaration"
      },
      {
      "location": {
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
      "range": {
      "end": {
      "character": 17,
      "line": 8
      },
      "start": {
      "character": 17,
      "line": 8
      }
      }
      },
      "message": "shadowing declaration"
      }
      ],
      "severity": {
      "_tag": 0
      },
      "source": "Parsing Error"
      }
      ],
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc"
      }


      At least the URIs are correct (though modified for readability here) since I can click on them and the editor does jump to the correct file.



      My problem is I do not see how to test the one or the other hypothesis about what is going wrong. Or maybe I am missing something completely different?










      share|improve this question














      I'm writing a language server. It delivers additional DiagnosticRelatedInformation as part of its diagnostics response. Just like in https://code.visualstudio.com/updates/v1_22#_related-information-in-errors-and-warnings.
      Currently, though while I do see the main error being displayed both in the "Problems" window and in the main text area, the additional "relatedInformation" is nowhere to be seen.



      I suspect there may be two reasons for this. Either clientside: the capability of displaying this information is not enabled in VS Code. At least when the protocol is initiated, this capability is nowhere to be seen, here is the initial JSON message from the client:



      [Trace - 2:22:13 PM] Sending request 'initialize - (0)'.
      Params: {
      "processId": 6640,
      "rootPath": null,
      "rootUri": null,
      "capabilities": {
      "workspace": {
      "applyEdit": true,
      "didChangeConfiguration": {
      "dynamicRegistration": true
      },
      "didChangeWatchedFiles": {
      "dynamicRegistration": true
      },
      "symbol": {
      "dynamicRegistration": true
      },
      "executeCommand": {
      "dynamicRegistration": true
      }
      },
      "textDocument": {
      "synchronization": {
      "dynamicRegistration": true,
      "willSave": true,
      "willSaveWaitUntil": true,
      "didSave": true
      },
      "completion": {
      "dynamicRegistration": true,
      "completionItem": {
      "snippetSupport": true,
      "commitCharactersSupport": true
      }
      },
      "hover": {
      "dynamicRegistration": true
      },
      "signatureHelp": {
      "dynamicRegistration": true
      },
      "definition": {
      "dynamicRegistration": true
      },
      "references": {
      "dynamicRegistration": true
      },
      "documentHighlight": {
      "dynamicRegistration": true
      },
      "documentSymbol": {
      "dynamicRegistration": true
      },
      "codeAction": {
      "dynamicRegistration": true
      },
      "codeLens": {
      "dynamicRegistration": true
      },
      "formatting": {
      "dynamicRegistration": true
      },
      "rangeFormatting": {
      "dynamicRegistration": true
      },
      "onTypeFormatting": {
      "dynamicRegistration": true
      },
      "rename": {
      "dynamicRegistration": true
      },
      "documentLink": {
      "dynamicRegistration": true
      }
      }
      },
      "trace": "verbose"
      }


      I'm using VS Code 1.28.2 on Win10, by the way.



      The other reason may be serverside: the response that contains the diagnostics may be misformed. It looks like this:



      Params: {
      "diagnostics": [
      {
      "code": null,
      "message": "the declaration of 'x' shadows an existing declaration",
      "range": {
      "end": {
      "character": 17,
      "line": 8
      },
      "start": {
      "character": 17,
      "line": 8
      }
      },
      "relatedInformation": [
      {
      "location": {
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
      "range": {
      "end": {
      "character": 13,
      "line": 6
      },
      "start": {
      "character": 13,
      "line": 6
      }
      }
      },
      "message": "existing declaration"
      },
      {
      "location": {
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc",
      "range": {
      "end": {
      "character": 17,
      "line": 8
      },
      "start": {
      "character": 17,
      "line": 8
      }
      }
      },
      "message": "shadowing declaration"
      }
      ],
      "severity": {
      "_tag": 0
      },
      "source": "Parsing Error"
      }
      ],
      "uri": "file:///c%3A/Users/blabla/XlocalShadow3.blc"
      }


      At least the URIs are correct (though modified for readability here) since I can click on them and the editor does jump to the correct file.



      My problem is I do not see how to test the one or the other hypothesis about what is going wrong. Or maybe I am missing something completely different?







      javascript json visual-studio-code vscode-extensions language-server-protocol






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 14:16









      Friedrich GretzFriedrich Gretz

      293211




      293211
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The problem simply was an outdated version of vscode-languageclientin the dependencies section of package.json. The feature was implemented in 4.1.0 but since my project is a bit dated it required only something above 3.5. I have now updated to the newest version and everything works.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283010%2fhow-to-display-lsps-relatedinformation-in-vs-code%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The problem simply was an outdated version of vscode-languageclientin the dependencies section of package.json. The feature was implemented in 4.1.0 but since my project is a bit dated it required only something above 3.5. I have now updated to the newest version and everything works.






            share|improve this answer




























              0














              The problem simply was an outdated version of vscode-languageclientin the dependencies section of package.json. The feature was implemented in 4.1.0 but since my project is a bit dated it required only something above 3.5. I have now updated to the newest version and everything works.






              share|improve this answer


























                0












                0








                0







                The problem simply was an outdated version of vscode-languageclientin the dependencies section of package.json. The feature was implemented in 4.1.0 but since my project is a bit dated it required only something above 3.5. I have now updated to the newest version and everything works.






                share|improve this answer













                The problem simply was an outdated version of vscode-languageclientin the dependencies section of package.json. The feature was implemented in 4.1.0 but since my project is a bit dated it required only something above 3.5. I have now updated to the newest version and everything works.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 15:47









                Friedrich GretzFriedrich Gretz

                293211




                293211






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283010%2fhow-to-display-lsps-relatedinformation-in-vs-code%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Xamarin.form Move up view when keyboard appear

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Anylogic : not able to use stopDelay()