-
-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help me fix the full template specializations? #354
Comments
I see that something was changed in Sphinx as referenced above. Is there still an issue with Breathe that remains? |
Yes. I will try and take a closer look this week or next weekend, but in order for Breathe to catch up with Sphinx we need to stop emitting an extra node for the template signature and instead populate the template related variables for the Sphinx types. My understanding of the evolution is that when this was all originally implemented Sphinx did not have template stuff in there. |
This is probably the core issue of several other. See my comment on #284. |
Hi @jakobandersen, thank you very much for your continued work on both supporting C++ in Sphinx, and helping Breathe catch up! TL;DR: the main tension is that currently breathe injects a bunch of nodes when rendering things, but what we need to do is just create the nodes and populate the correct member variables and appending children in the graph (AKA it might be that we just remove our sphinx renderer altogether?)? I just did a little more digging to test this, I made a really quick and dirty check repository: https://github.com/svenevs/toward_templates All I did was use the Breathe code for the directive, but not incorporate anything from the sphinx renderer in breathe.
This builds exactly as expected. So I think that means that for Breathe, we just need to:
Does this sound correct? CC: @arximboldi @melvinvermeeren @eric-wieser |
Basically yes. I think there are two types of node/ast injection/manipulation going on:
The Sphinx directives have
However, I'm not familiar enough with the structure in Breathe to say how actually to begin refactoring into this scheme. |
Thank you for the response. I'm still trying to wrap my head around the last two bullet points:
contentnode = addnodes.desc_content()
node.append(contentnode)
if self.names:
# needed for association of version{added,changed} directives
self.env.temp_data['object'] = self.names[0]
self.before_content() You mean that FWIW I think breathe has been sufficiently broken for long enough that it may be worth a more forceful approach, AKA "start from scratch" scenario and pin our requirements to
Is it possible to make The only snag I see here is layout in terms of public / protected / private. But if I'm understanding this correctly, we should be able to transform the logic taking place for that into |
Yes, though the
Sure, I'll add it soon. Classes and structs are the same so the difference will probably only be which class key is displayed in front of the declaration, and which is shown in the index. I don't think Breathe has gotten more broken, and it should be possible to incrementally refactor it without having to start over. For example, the code from Sphinxrenderer.visit_compounddef() looks like the one responsible for rendering classes with the sections you mention. In some sense, that could should "just" be moved into |
Ok I'm willing to try and give it a shot, I'll try just setting Thanks for the |
Should be fixed with #512, released in Breathe v4.17.0. Note that you also need Sphinx 3.x for recent Breathe versions. |
I'm working with the specialization here. For reference
unspecialized
warnings:
partial specialization
warnings
full specialization (?)
warnings
where do I start?
Update ok I did a lot of digging and I think I've figured out what the problem is here. The
sphinxrenderer
is creating the right signatures, but this happens too late.This works perfectly, but the issue is this information actually needs to be a part of the
sphinx/domain/cpp.py:CPPObject
.Presumably the same or similar logic can be used, but it has to happen much sooner. I did "editable" installs of sphinx and breathe and the warnings are emitted before the render signature is created (which makes sense).
In the same file in
breathe/sphinxrenderer.py
the classDomainDirectiveFactory
hasSo is the right place to be doing this at
### !!!!!!!!!!!!!!!!!!
or somewhere else entirely? E.g.The text was updated successfully, but these errors were encountered: