ioi-2023 / contestant-vm

Contestant virtual machine for online IOI (since 2020)
1 stars 2 forks source link

clangd VSCode Extension #71

Closed skittles1412 closed 1 year ago

skittles1412 commented 1 year ago

Hi,

Would it be possible to include the VSCode clangd extension (vsix file from github releases at https://github.com/clangd/vscode-clangd/releases/download/0.1.24/vscode-clangd-0.1.24.vsix)?

It's better and more powerful than the currently installed c++ extension in terms of intellisense.

However, if installed, users would need to disable the intellisense of the current c++ extension to avoid conflicts, so probably it'll need to be included but not installed by default.

Thanks!

radl97 commented 1 year ago

Thank you for the request, and thanks again for the detailed request!

I have not tried the extension, but there is a possible stability issue I can see, detailed below. And installing (or allowing the install of) another extension is a vouch on supporting it. Thus, from a technical perspective, it means investing additional time -- even if now it would take 3 lines to add support. Thus, I am reluctant to add this.

I have not investigated for more than 20 minutes, so I might very well be mistaken. If there is any additional insight You (or others interested in the extension) can give, I would be happy to hear.

PS on a personal note, I like the idea of a VSCode extension straight from LLVM and clangd. I would really like to be mistaken :)

pobrn commented 1 year ago

I have been using the clangd extension for a long time; even on very large C/C++ code bases. I have seen my fair share of clangd crashes, it does happen from time to time, though I want to emphasize that it is not the norm in my experience. Nonetheless, I would only feel comfortable adding it if it is made clear, that it is provided on an "as-is" basis. (I believe this should be the case for every (most?) vscode extensions that area shipped.) We cannot really do more than

if it starts crashing.

skittles1412 commented 1 year ago

Hi,

Thanks for taking the time to look at the extension.

I believe the first bug you mentioned is triggered only when clangd hasn't been activated yet. For example, the bug would be triggered if a contestant opened VSCode then attempted to restart the language server before opening any .cpp files. Restarting the language server after it has crashed should work fine.

I think despite the versioning, the extension is fairly stable. It's an official extension (and in fact the only official clangd editor extension, as far as I can tell) and is recommended by clangd (source).

If you don’t have strong feelings about an editor, we suggest you try out VSCode, it has excellent language server support and most faithfully demonstrates what clangd can do.

I believe there are other editors in the current VM configured to use clangd as a language server. I don't think the vscode extension would be necessarily more buggy or error-prone than those editors. The language server crashing is a real possibility, but it also isn't specific to this extension. In that case, restarting the language server doesn't take too long (less than a minute) and contestants can still code, albeit without intellisense.

All that said, I understand that one more extension would mean one more thing to keep track of and manage. I don't wish for it to cause too much of a burden, and I'd understand if the final decision is to not include the extension.

Once again, thanks for your time.

radl97 commented 1 year ago

Can you confirm that an (LSP, vscode) restart or cache cleanup removes any possible issue? @pobrn

No files are corrupted, VSCode is able to start up...?

pobrn commented 1 year ago

The issues I have experienced were mostly related to clangd, not the extension itself. And as far as I can tell clangd is shipped, so I cannot see any reason not to provide the vscode extension for it.

Can you confirm that an (LSP, vscode) restart or cache cleanup removes any possible issue?

All I can say is that in the vast majority of cases restarting clangd and/or removing its data about the workspace (.cache/clangd) were enough to make it work again.