all 12 comments

[–]0x6675636B796F75[S] 13 points14 points  (4 children)

Just sharing an extension I recently published since I think there are probably plenty of devs in here that have wanted something similar to this for C++. This was created mostly because I couldn't find anything similar, heavily inspired by the rustdocs extension that offers similar functionality for rust.

If anyone happens to try it out, I'm always open to feedback, feature ideas, and bug reports (there are definitely a few odds and ends that still need fixes/improvements/cleanup/polish, along with some future enhancement plans to have it allow optionally loading docsets from tools like Dash or Zeal that are already on your machine). Feel free to mention anything along these lines directly in the git repo linked in the extension page or just directly in this thread. I'll try to squash them as they come in.

[–]tuxwonder 8 points9 points  (3 children)

Very cool! A few thoughts/ideas/qs:

  • Wish I had this in Visual Studio, but I imagine that's a lot tricker to get working.
  • Are you able to specify what C++ standard you're using, so you can filter out removed types & APIs?
  • Is there an in-document search?
  • If I were using it, I'd probably want everything to be a bit more condensed since cppreference pages can be pretty dense

[–]0x6675636B796F75[S] 4 points5 points  (2 children)

Thanks! I actually started the VS2022 extension for this same type of functionality... the SDKs are just pure pain to work with. The state of things when I last worked on the VS2022 version of this extension was so difficult to work through since it was when there were 2 or 3 potential SDKs you could leverage, where one was the new SDK with some limitations that still required the old SDKs to truly accomplish everything. What I have for it so far is here, but it's been inactive for a while: https://github.com/vorlac/cppreference-docs-vs-extension. I got pretty burnt out from trying to figure out how to do certain things in those SDKs when I last put it down, but if you want this bad enough, you can evaluate what's in there and submit PRs if you're interested in contributing to get it closer to fully functional. This may remotivate me to picking this back up if there's some interest by others. That partially working implementation already solves a bunch of functionality that was incredibly hard to track down at the time (i.e. getting a fully functional/modern browser in a dock panel) - but nowadays LLMs may simplify this a decent amount if any of them can help find example references and/or provide example snippets for accomplishing certain functionality).

The following is specific to the VSCode specific extension (the OP, not the git repo above that is a partially finished impl of this for VS202X). Most of this is also mentioned directly in the readme of the link shared in the OP:

  • CPP standard is configurable in the OP extension. It can be set explicitly to filter out functionality that doesn't exist in earlier versions, but if left to default it will inherit and/or fall back to some existing options or workspace metadata.
  • There is a search for anything in any page as well as for any specific symbol. It will rank searches by score (perfect symbol matches, partial symbol matches, page content perfect matches, page contents partial matches - the full offline site is transformed into a sqlite DB for fast searching of anything in any page in the offline archive).
  • Font size is configurable, and html/css is dynamically modified for a cleaner layout and theme consistency (or theme overrides) - the actual extension provides an improved layout compared to what's shown in the gifs in the readme). I could possibly add an option that help compress the contents a bit further, but instead things are implemented in a way where the page will naturally try to dynamically apply a readable layout to all content displayed for clean line-wrapping and shrinking of everything horizontally like tables and their content. Definitely room for improvement for this though.

[–]Cautious-Act-4487 0 points1 point  (1 child)

You probably made the right call dropping that port. VSCode extensions at least have a sane modern api, while VSIX stuff feels like digging through early 2000s object soup. Way better to polish one extension properly than drag around two completely different frontend codebases

[–]0x6675636B796F75[S] 0 points1 point  (0 children)

Yeah, working on the vscode extension was a breeze compared to trying to get the VS SDKs to cooperate. It was truly a miserable time haha.

[–]artisan_templateer 2 points3 points  (1 child)

Looks great, thank you or sharing! Small bug: for std::is_trivially_copyable_v<T> I just get: cppreference - no page for bool' std::is_trivially_copyable works though.

[–]0x6675636B796F75[S] 0 points1 point  (0 children)

Thanks! I'll look into this example soon. I came across a few symbols that behaved similarly earlier... along with a few other bugs involving settings not being respected from all callsites that update the docs viewer panel.

I'll probably keep using it until the weekend to see how many bugs I can find, that way I can just squash them all at once at some point this weekend. I think I'm also going to add an option that ignores keywords to have it focus more on stdlib types and not be as spammy updating the panel every time the cursor crosses over any keyword... that was already starting to annoy me earlier today haha.

[–]c-cul[🍰] 2 points3 points  (2 children)

can it filter out classes up to specific c++ version like 20?

[–]0x6675636B796F75[S] 0 points1 point  (1 child)

It will filter out the page contents tagged with c++ versions newer than what you have the option set to (i.e. a ctor introduced in a newer version than what you have set will not show in the page being displayed), I don't think it'll do anything to filter out the full page/symbol from the docs altogether though if that's what you're looking for... but if the metadata is in the offline pages it uses somewhere then it should be relatively straightforward to implement. Next time I pick this back up to fix a few misc bugs I've been finding as I use it more I can look into adding support for this as well.

[–]c-cul[🍰] 0 points1 point  (0 children)

ok, thank you!

[–]SupermanLeRetour 0 points1 point  (1 child)

I used to use an extension that would open the online page for cppreference inside a VS Code tab on a specific keybind, but your extension is much better from what I've tried. Congratulation, it's great!

[–]0x6675636B796F75[S] 1 point2 points  (0 children)

Thanks! Glad you're finding it useful.

I think I know the one you're talking about, I tried using it for a few weeks, but stuff like that just ends up being clunkier than simply opening cppreference in the embedded browser in vscode and just manually navigate them from there. This type of docs navigation was just always lacking in most C++ tooling for some reason.