Skip to content
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

const keyword parsing in C# #730

Closed
noname77 opened this issue Aug 31, 2021 · 1 comment · Fixed by #737
Closed

const keyword parsing in C# #730

noname77 opened this issue Aug 31, 2021 · 1 comment · Fixed by #737
Assignees
Labels
bug Problem in existing code code Source code

Comments

@noname77
Copy link

Hey, thanks for the great work!

I have a C# project and seem to have an issue with the sphinx output for const variables.
I think I'm on latest breathe and rogerbarton/sphinx-csharp

c# support issue xref #550
sphinx-csharp issue xref

% python -m pip freeze
[...]
breathe==4.30.0
Sphinx==4.1.2
sphinx-csharp==0.1.11
sphinx-rtd-theme==0.5.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-versioning==2.2.1
% doxygen --version
1.9.2

My issue is that i have a class with a bunch of constants and it seems to fail to recognise those with the following warnings:

WARNING: Failed to find xref for: constbool, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']

WARNING: Failed to find xref for: conststring, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']

WARNING: Failed to find xref for: constint, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']

WARNING: Failed to find xref for: constfloat, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']

In my case its an child/internal static class, however the behaviour seems to be the same for any consts. static keyword is also added implicitly in the generated sphinx docs (not present in doxygen html)

class definition:

namespace Namespace
{
    public class OuterClass
    {
        public static class InnerClass
        {
            public const int SomeInt = 123;
        }
    }
}

Doxygen output:

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.17">
  <compounddef id="class_namespace_1_1_outer_class_1_1_inner_class" kind="class" language="C#" prot="public">
    <compoundname>Namespace::OuterClass::InnerClass</compoundname>
      <sectiondef kind="public-static-attrib">
      <memberdef kind="variable" id="class_namespace_1_1_outer_class_1_1_inner_class_1a1256d6832064011e942341198ffdeabd" prot="public" static="yes" mutable="no">
        <type>const int</type>
        <definition>const int SomeInt</definition>
        <argsstring></argsstring>
        <name>SomeInt</name>
        <initializer>= 123</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/<SomePath>/OuterClass.cs" line="xx" column="yy" bodyfile="/<SomePath>/OuterClass.cs" bodystart="zz" bodyend="ee"/>
      </memberdef>
  </compounddef>
</doxygen>

Doxygen html output:
image

Sphinx html output:
image

Any ideas how to get rid of the static keyword or at least split the constint into two keywords?
Or how to get the sphinx/breathe html output closer to that of doxygen?

Best,
Wiktor

@noname77
Copy link
Author

noname77 commented Sep 2, 2021

update, the issue was fixed here: rogerbarton/breathe@fc0d085

static keyword is removed and const keyword is separate from any following type now
image

i think i should leave the issue open here until this is merged in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem in existing code code Source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants