Giter Site home page Giter Site logo

sphinx-csharp's People

Contributors

djungelorm avatar mizukyf avatar noname77 avatar oragonefreet avatar rogerbarton avatar xuhongxu96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sphinx-csharp's Issues

issue with generics in properties

hi again and thanks for taking a quick action on my other issues!

another thing I noticed now was to do with properties with generic types, i.e.

/// <summary>
///  Test list property.
/// </summary>
public List<int> TestList { get; }

is rendered as:
image

I have started looking into this and using this commit I think I managed to fix this in here

not sure if the generics need to be additionally parsed further as in the parse_method_signature and CSharpMethod.handle_signature but things seem to be doing fine without it.

I also tried it on a nested generic property like so

/// <summary>
///  Nested generic property test.
/// </summary>
public Dictionary<Enum, List<IList<int>>> TestDictionary { get; } =
    new Dictionary<Enum, List<IList<int>>>();

and the output seems fine:

image

I still don't like that both getter and setter are rendered, regardless of if the setter is present or not.
will give it a go and submit a PR afterwards

best,
wiktor

missing link to overloaded method

Hi again,

I have a method with overloads in my interface. my issue is that a link to only the first method (overload) is generated, i.e.

IExample.cs:

namespace Company.Package
{
    /// <summary>
    ///  <c>IExample</c> exposes the example.
    /// </summary>
    public interface IExample
    {
        /// <summary>
        ///  Tests the example with parameter of type A.
        /// </summary>
        /// <param name="parameter">Parameter of type A.</param>
        void OverloadTest(A parameter);

        /// <summary>
        ///  Tests the example with parameter of type B.
        /// </summary>
        /// <param name="parameter">Parameter of type B.</param>
        void OverloadTest(B parameter);
    }
}

doxygen documentation links to both methods fine:
doxygen-output

however, breathe's output only generates a link to the first overload

test.rst:

.. doxygeninterface:: Company::Package::IExample
   :members:
   :undoc-members:

breathe output with breathe_debug_trace_directives = True

Running directive: .. cs:interface::  Company.Package.IExample
  Running directive: .. cs:function::  void OverloadTest (A parameter)
  Running directive: .. cs:function::  void OverloadTest (B parameter)

rendered output (note the # / permalink next to the first method overload and missing one next to the second overload)
Screenshot 2023-02-13 at 18 26 28

also, note the missing link in the html output
image

vs correct link in for the first overload
image

Do you have any pointers where to look further / how to fix this?

Best,
Wiktor

Cannot find namespace "Name.Space"

Issue

I'm just getting started with this project... and I'm fairly new to C#, so it's possible I am doing something incorrectly. I have used Doxygen + Breathe for a C++ project before though, so I think I have that in order.

My RST file:

ThemerrManager
==============

.. doxygennamespace:: Jellyfin.Plugin.Themerr
   :members:
   :protected-members:
   :private-members:
   :undoc-members:

I get the following error:

/home/docs/checkouts/readthedocs.org/user_builds/themerr-jellyfin/checkouts/187/docs/source/code/ThemerrManager.rst:4: WARNING: doxygennamespace: Cannot find namespace "Jellyfin.Plugin.Themerr" in doxygen xml output for project "Jellyfin.Plugin.Themerr" from directory: ../build/doxyxml

I think I must just be referencing the namespaces incorrectly, as the namespaces are in my doxygen xml build directory.
image

I can reference the highest level "Jellyfin" namespace, but with that I get a bunch of Failed to find xref for: <Object> warnings/errors... which I have not looked into yet. I also don't think I want to document that far up in the structure.

References

PR to add code docs: LizardByte/Themerr-jellyfin#187

Publish to PyPI

Seeing that upstream has been inactive for a long time now, would you consider publishing your fork to pypi, maybe under a different name?

#define crashes the HTML generator

I believe this is the specific block of XML generated by Doxygen which is causing Sphinx/Breathe to crash

    <sectiondef kind="define">
      <memberdef kind="define" id="_color_replacement_setter_8cs_1ad10dd27d12fbd568f6ee8088b11e36fb" prot="public" static="no">
        <name>COLOR_REPLACEMENT_SAFTEYCHECKS</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="Assets/Scripts/Overworld/Rendering/ColorReplacementSetter.cs" line="1" column="9" bodyfile="Assets/Scripts/Overworld/Rendering/ColorReplacementSetter.cs" bodystart="1" bodyend="-1"/>
      </memberdef>
    </sectiondef>

Here is the log produced

# Platform:         win32; (Windows-10-10.0.19045-SP0)
# Sphinx version:   7.2.5
# Python version:   3.10.11 (CPython)
# Docutils version: 0.20.1
# Jinja2 version:   3.1.2
# Pygments version: 2.16.1

# Last messages:
#   Docs_rst_gen/file/_color_in_out_v_f_x_8cs
#   
#   �[2K
#   reading sources... [ 49%]
#   Docs_rst_gen/file/_color_replacement_profile_8cs
#   
#   �[2K
#   reading sources... [ 49%]
#   Docs_rst_gen/file/_color_replacement_setter_8cs
#   

# Loaded extensions:
#   sphinx.ext.mathjax (7.2.5)
#   alabaster (0.7.13)
#   sphinxcontrib.applehelp (1.0.7)
#   sphinxcontrib.devhelp (1.0.5)
#   sphinxcontrib.htmlhelp (2.0.4)
#   sphinxcontrib.serializinghtml (1.1.9)
#   sphinxcontrib.qthelp (1.0.6)
#   breathe (4.35.0)
#   sphinx_csharp (unknown version)
#   sphinx_tippy (0.4.1)
#   furo (2023.09.10)
#   sphinx_basic_ng (1.0.0.beta2)

# Traceback:
Traceback (most recent call last):
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\cmd\build.py", line 298, in build_main
    app.build(args.force_all, args.filenames)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\application.py", line 355, in build
    self.builder.build_update()
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\builders\__init__.py", line 293, in build_update
    self.build(to_build,
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\builders\__init__.py", line 313, in build
    updated_docnames = set(self.read())
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\builders\__init__.py", line 420, in read
    self._read_serial(docnames)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\builders\__init__.py", line 441, in _read_serial
    self.read_doc(docname)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\builders\__init__.py", line 498, in read_doc
    publisher.publish()
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\core.py", line 234, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\io.py", line 105, in read
    self.parse()
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\readers\__init__.py", line 76, in parse
    self.parser.parse(self.input, document)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\parsers.py", line 81, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 169, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 2785, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 325, in section
    self.new_subsection(title, lineno, messages)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 391, in new_subsection
    newabsoffset = self.nested_parse(
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 279, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 2355, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 2367, in explicit_construct
    return method(self, expmatch)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 2104, in directive
    return self.run_directive(
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\docutils\parsers\rst\states.py", line 2154, in run_directive
    result = directive_instance.run()
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\directives\file.py", line 83, in run
    return self.handle_contents(file_, project_info)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\directives\file.py", line 53, in handle_contents
    node_list.extend(object_renderer.render(node_stack[0], context))
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2624, in render
    result = method(self, node)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 1360, in visit_compounddef
    child_nodes = self.render(sectiondef)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2624, in render
    result = method(self, node)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 1407, in visit_sectiondef
    node_list.extend(self.render_iterable(member_def))
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2634, in render_iterable
    output.extend(self.render(entry))
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2624, in render
    result = method(self, node)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2525, in dispatch_memberdef
    return self.visit_define(node)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 2080, in visit_define
    return self.handle_declaration(node, declaration, declarator_callback=add_definition)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 667, in handle_declaration
    nodes_ = self.run_directive(obj_type, declaration, content_callback, options)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 596, in run_directive
    directive = DomainDirectiveFactory.create(self.context.domain, args)
  File "C:\Users\nuck\AppData\Local\Programs\Python\Python310\lib\site-packages\breathe\renderer\sphinxrenderer.py", line 331, in create
    cls, name = DomainDirectiveFactory.cs_classes[args[0]]
KeyError: 'define'

missing 'ushort' internal type

hi,

got back to using this extension recently and im getting :

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

and its indeed missing from the built-in types

will push a PR in a sec

best,
wiktor

wrong link when attribute name is the same as type / class name

hi, i think i've found another issue which might be specific to the csharp domain since it allows for the attributes to have the same name as their types

example class definitions:

public class Foo
{
    public Foo() {}
}

public class Bar
{
    public Foo Foo;

    public Bar() {
        Foo = new Foo();
    }
}

the issue is that the link to Foo class from the type in Bar's attribute documentation doesn't lead to the Foo's documentation page, but to the Foo attribute / variable in the Bar's documentation instead (see the title when hovering). doxygen handles this correctly

sphinx html render:
image

i'd be happy to provide more details if necessary

Failed to find xref for custom objects

I'm seeing a bunch of WARNINGs like this when using doxygenindex in my rst:

/Users/me/myapp/docs/index.rst:35: WARNING: Failed to find xref for: IActionResult, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']
/Users/me/myapp/docs/index.rst:35: WARNING: Failed to find xref for: CancellationToken, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']
/Users/me/myapp/docs/index.rst:35: WARNING: Failed to find xref for: ILogger, no objects found that end like this, searched in object types: ['class', 'struct', 'interface', 'function', 'var', 'event', 'enum']

Is this a doxygen issue or an issue with this sphinx plugin? Is it not able to find the libraries for these classes or something?

Issues with nullable value types

Hi rogerbarton,

first of all thanks for you great job improving/providing a Sphinx domain for C#. I'm using it currently with DoxyGen and Breathe in a project and getting some issues with the nullable value types of C# 8.0 (https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-value-types).

This is an example C# code for describing the problem.

    public class ExampleClass
    {
        /// <summary>
        /// Constructor of the class.
        /// </summary>
        public ExampleClass()
        {
        }

        /// <summary>
        /// A nullable bool value.
        /// </summary>
        public bool? BNullableBool { get; set; }

        /// <summary>
        /// A nullable int value.
        /// </summary>
        public int? NNullableInt { get; set; }

        /// <summary>
        /// A nullable function.
        /// </summary>
        /// <param name="bValue">A nullable bool.</param>
        /// <returns>A nullable int.</returns>
        public int? FooBar(bool? bValue)
        {
            return null;
        }
    }

In Sphinx I'm using the following Breathe directive to create the HTML output:

    .. doxygenclass:: WpfApp1::Models::ExampleClass
        :members:

During the build I'm getting the following warnings:

WARNING: Method signature invalid: int? FooBar (bool? bValue)
WARNING: Definition list ends without a blank line; unexpected unindent.

And the output looks like this:

Breathe

The types of the properties are not getting parsed properly and also the "highlighting" of them differs from the other stuff in case of a method.

I'm not totally sure if this issue is completly solvable by this domain, but I hope you can help me.

Missing 'inline' keyword, C# 7.0 Tuples

Hi @rogerbarton rogerbarton,

I am trying your solution and have some warning and exception, do you have any thought about this?

-----------------
WARNING: Method signature invalid: static inline void Error (string s)
WARNING: Method signature invalid: static inline void Warning (string s)
WARNING: Method signature invalid: static inline void Log (string s)
WARNING: Method signature invalid: static inline Dictionary< ESkeletonType, Dictionary< ESkinPart, List< string > > > initAssetMaps ()
WARNING: Method signature invalid: static inline Dictionary< ESkinPart,(List< string >, List< string >)> initAssetMap2 ()
WARNING: Method signature invalid: static inline ESkeletonType getSkeletonTypeByName (string name)
WARNING: Method signature invalid: static inline ESkinPart getSkinPartByName (string name)
WARNING: Method signature invalid: static inline error _cloneSkinMesh (GameObject src, GameObject target)
WARNING: Method signature invalid: static inline async Task< bool > AutoInitAssetBundleSource ()
WARNING: Method signature invalid: static inline Task< bool > _initAssetBundle (AssetBundleSouce src)
WARNING: Method signature invalid: static inline async Task<(Object, error)> LoadAssetEx (string assetKeyName, AssetBundleSouce assetSource)
WARNING: Method signature invalid: static inline async Task<(Object, error)> LoadAsset (string assetKeyName)
WARNING: Method signature invalid: inline void SaveTextureFile (string path)
WARNING: Method signature invalid: static inline Transform rotateAnchor (Transform rootBone)
WARNING:  .....
...... many warnings like those .....

Exception:
  File "/opt/homebrew/lib/python3.9/site-packages/sphinx_csharp/csharp.py", line 237, in parse_type_signature
    match = CLASS_SIG_RE.match(sig.strip())
AttributeError: 'NoneType' object has no attribute 'strip'

Originally posted by @Feng-Seng in breathe-doc/breathe#550 (comment)

issue with `const` keyword

Hey, thanks for great work on adding c# support for breathe and sphinx!

I think I'm using latest versions of your fork of sphinx-csharp and breathe

% 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

and using latest doxygen installed with homebrew (im on mac)

% 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 docs, however I think it might be also an artifact of breathe / doxygen.

I tried to do some quick debugging and it seems the signature passed to parse_variable_signature by breathe already has the keywords merged, i.e.

DEBUG: sig: static constint SomeInt   = 123
parsed var: (['static'], 'constint', 'constint', [], 'SomeInt', '123')

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?

breathe issue xref

Best,
Wiktor

issue with resolving internal links when used with myst_parser

Hi

I started moving from rst to MyST recently to be able to write documentation in markdown and I'm getting errors while resolving internal references in [description](link) format, i.e. when linking to a header within a document [mobile](#mobile):

<PROJECT_PATH>/index.md:10: WARNING: Failed to find xref for: #mobile, no objects found that end like this, searched in object types: ['enumerator']

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.8/site-packages/myst_parser/sphinx_ext/myst_refs.py", line 147, in resolve_myst_ref
    domain.resolve_any_xref(
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx_csharp/csharp.py", line 1031, in resolve_any_xref
    raise NotImplementedError
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/cmd/build.py", line 284, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 311, in build_update
    self.build(to_build,
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 377, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 579, in write
    self._write_serial(sorted(docnames))
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 586, in _write_serial
    doctree = self.env.get_and_resolve_doctree(docname, self)
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/environment/__init__.py", line 622, in get_and_resolve_doctree
    self.apply_post_transforms(doctree, docname)
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/environment/__init__.py", line 668, in apply_post_transforms
    transformer.apply_transforms()
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/transforms/__init__.py", line 80, in apply_transforms
    super().apply_transforms()
  File "/home/vscode/.local/lib/python3.8/site-packages/docutils/transforms/__init__.py", line 173, in apply_transforms
    transform.apply(**kwargs)
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx/transforms/post_transforms/__init__.py", line 37, in apply
    self.run(**kwargs)
  File "/home/vscode/.local/lib/python3.8/site-packages/myst_parser/sphinx_ext/myst_refs.py", line 52, in run
    newnode = self.resolve_myst_ref(refdoc, node, contnode)
  File "/home/vscode/.local/lib/python3.8/site-packages/myst_parser/sphinx_ext/myst_refs.py", line 163, in resolve_myst_ref
    res = domain.resolve_xref(
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx_csharp/csharp.py", line 915, in resolve_xref
    objects = {
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx_csharp/csharp.py", line 919, in <dictcomp>
    if key[0] in objtypes and key[1].endswith(target) and
TypeError: argument of type 'NoneType' is not iterable

Exception occurred:
  File "/home/vscode/.local/lib/python3.8/site-packages/sphinx_csharp/csharp.py", line 919, in <dictcomp>
    if key[0] in objtypes and key[1].endswith(target) and
TypeError: argument of type 'NoneType' is not iterable

I added a debug print in csharp.py -> CSharpDomain.resolve_xref, which shows

target: #mobile, node: {'rawsource': '', 'children': [<inline: <#text: 'mobile'>>], 'attributes': {'ids': [], 'classes': [], 'names': [], 'dupnames': [], 'backrefs': [], 'refdoc': 'index', 'reftarget': '#mobile', 'reftype': 'myst', 'refdomain': None, 'refexplicit': True, 'refwarn': True}, 'tagname': 'pending_xref', 'line': 10, 'source': '<PROJECT_PATH>/index.md', 'parent': <paragraph: <#text: 'redacted ...'><pending_xref...><#text: '  ...>, '_document': <document: <section "redacted"...>>}

Modifying resolve_xref like so seems to fix the issue

    def resolve_xref(self, _, fromdocname, builder, typ, target, node, contnode):
        targets = []
        parents = []

        if node.attributes["refdomain"] != self.name:
            return None

        # rest of resolve_xref unchanged

Any chance you could include this in your releases?

Best,
Wiktor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.