clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
617 stars 100 forks source link

If clangd crashes on startup, show the reason for the crash (currently only in the Output window) in a dialog #70

Open Leon0402 opened 3 years ago

Leon0402 commented 3 years ago

For some reason, clangd crashed a few times and I got the following message: "The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted."

But I can't even restart the server with "Restart server" command in VsCode, the same message will appear. There should be some way to manually restart the server again. Or what else am I suppossed to do?

HighCommander4 commented 3 years ago

This suggests clangd is crashing on startup. When you perform "restart server", that does restart the server, it just crashes again on startup.

If you look at the Clangd section of the Output window, there should be a message indicating the reason for the crash. Feel free to post it here (or the entire log) for further diagnosis.

Leon0402 commented 3 years ago

Hi,

thank you very much, you are right, it actually just crashed constantly!

The reason it did was because it didn't detect a command line argument I parsed via the gui.

I put into the field "--compile-commands-dir build" and clangd complained that it doesn't know that command line argument.It turned out, I have to put "--compile-commands-dir" and "build" into two seperate fields.

Perhaps vscode-clangd could check if the passed params are valid and if not output the error message?

Leon0402 commented 3 years ago

Just another question, I found another issue, but I'm not quite sure if it's a bug in clangd or in this extension.

image

It seems like doxygen documenation syntax is not recognized. Could you tell me, where I have to report it @HighCommander4 ?

HighCommander4 commented 3 years ago

Perhaps vscode-clangd could check if the passed params are valid and if not output the error message?

I don't think we want to duplicate the logic for validating clangd's command line parameters in both clangd and vscode-clangd (and all other clangd clients).

HighCommander4 commented 3 years ago

It seems like doxygen documenation syntax is not recognized.

Could you be more specific about what you are expecting / hoping to see?

Leon0402 commented 3 years ago

Perhaps vscode-clangd could check if the passed params are valid and if not output the error message?

I don't think we want to duplicate the logic for validating clangd's command line parameters in both clangd and vscode-clangd (and all other clangd clients).

I was thinking more of just doing a test run perhaps? In the simplest way, you could just check if the server starts sucessfully.

Leon0402 commented 3 years ago

It seems like doxygen documenation syntax is not recognized.

Could you be more specific about what you are expecting / hoping to see?

Here is the output of the C/C++ intellisense plugin: image

As you can see it makes use of the \brief, \param options and displays the information in the right place (for example the param documentation next to the params)

HighCommander4 commented 3 years ago

I was thinking more of just doing a test run perhaps? In the simplest way, you could just check if the server starts sucessfully.

We do check that. And if it doesn't start successfully, we start it again. And if that happens 5 times we show the "crashed 5 times in the last 3 minutes" message.

(More precisely, I think it's vscode itself doing the above, rather than the vscode-clangd plugin.)

I think perhaps what you're suggesting is that, when this happens, instead of having to look in the Output window to see the reason for the crash, it would be better to show that in the dialog. I think that would be a useful improvement.

HighCommander4 commented 3 years ago

As you can see it makes use of the \brief, \param options and displays the information in the right place (for example the param documentation next to the params)

Thanks. I think this is a missing feature on the server side (it would have to parse the doxygen syntax and turn it into appropriate markdown for the client). Please feel free to file a server-side issue for it.

HighCommander4 commented 3 years ago

I think perhaps what you're suggesting is that, when this happens, instead of having to look in the Output window to see the reason for the crash, it would be better to show that in the dialog. I think that would be a useful improvement.

I'll re-title this issue to track this suggestion.

Trass3r commented 3 years ago

But I can't even restart the server with "Restart server" command in VsCode, the same message will appear. There should be some way to manually restart the server again. Or what else am I suppossed to do?

I think that hasn't ever really worked for me, I always have to do Reload Window or it won't restart at all. clangd just can't handle certain sources and crashes every time on them in my case, if you close the current editor this will help usually.

As you can see it makes use of the \brief, \param options and displays the information in the right place (for example the param documentation next to the params)

Thanks. I think this is a missing feature on the server side (it would have to parse the doxygen syntax and turn it into appropriate markdown for the client). Please feel free to file a server-side issue for it.

Probably there's a parser in clang already for -Wdocumentation.

I think perhaps what you're suggesting is that, when this happens, instead of having to look in the Output window to see the reason for the crash, it would be better to show that in the dialog. I think that would be a useful improvement.

Or at least it should open the output window when clicking on the popup.

ghost commented 3 years ago

I have encountered this problem, and it appears frequently. What should I do? :sob:

HighCommander4 commented 3 years ago

I have encountered this problem, and it appears frequently. What should I do? sob

Look in the Output window (choose Clangd from the dropdown) for Clangd logs. If the cause of the crash / how to fix it is not clear from the logs, feel free to file an issue and attach the logs.