Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/source/components/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ Features
.. fault:: Sphinx-codelinks halucinates traceability objects in C++
:id: FAULT_CPP_2

.. feature:: C# Language Support
:id: FE_CSHARP

Support for defining traceability objects in C# source code.

The C# language parser leverages tree-sitter to accurately identify and extract
comments from C# source files, including single-line (``//``), multi-line (``/* */``),
and documentation (``///``) comment styles. This ensures that traceability markers are
correctly associated with the appropriate code structures such as classes, methods, and
properties.

Key capabilities:

* Detection of inline, block, and documentation comments
* Association of comments with method, class, and property declarations
* Support for standard C# comment conventions
* Accurate scope detection for nested structures

.. fault:: Traceability objects are not detected in C# language
:id: FAULT_CSHARP_1

.. fault:: Sphinx-codelinks halucinates traceability objects in C#
:id: FAULT_CSHARP_2

.. feature:: Python Language Support
:id: FE_PY

Expand Down
4 changes: 2 additions & 2 deletions docs/source/development/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Upcoming
--------

- ⬆️ Support and test sphinx-needs v5-8
- 📚 Documented C# language support in ``features.rst``
- 🧪 Added Sphinx integration test for C# source files
- ✨ Added Go parser for the ``analyse`` module.

Need ID references and one-line need definitions can now be extracted from Go source files.
Expand Down Expand Up @@ -35,7 +37,6 @@ New and Improved
Warning messages now include more context to help diagnose parsing issues.

- 📚 Added traceability page to the documentation.

- 📚 Added ``features.rst`` page documenting the full feature set with source tracing.

Fixes
Expand All @@ -45,7 +46,6 @@ Fixes

Leading and trailing spaces in extracted marker content are now correctly stripped.


.. _`release:1.1.0`:

1.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<document source="<source>">
<target anonymous="" ids="IMPL_1" refid="IMPL_1">
<Need classes="need need-impl" ids="IMPL_1" refid="IMPL_1">
27 changes: 27 additions & 0 deletions tests/doc_test/cs_basic/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "source-tracing-demo"
copyright = "2025, useblocks"
author = "useblocks"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx_needs", "sphinx_codelinks"]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

src_trace_config_from_toml = "src_trace.toml"

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
7 changes: 7 additions & 0 deletions tests/doc_test/cs_basic/dummy_src.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System;

// @ title here, IMPL_1, impl
void SingleLineExample()
{
Console.WriteLine("Single-line comment example");
}
2 changes: 2 additions & 0 deletions tests/doc_test/cs_basic/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. src-trace::
:project: src
5 changes: 5 additions & 0 deletions tests/doc_test/cs_basic/src_trace.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codelinks.projects.src]
remote_url_pattern = "https://github.com/useblocks/sphinx-codelinks/blob/{commit}/{path}#L{line}"

[codelinks.projects.src.source_discover]
comment_type = "cs"
4 changes: 4 additions & 0 deletions tests/test_src_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def test_src_tracing_config_positive(make_app: Callable[..., SphinxTestApp], tmp
Path("doc_test") / "id_required",
Path("doc_test") / "id_required",
),
(
Path("doc_test") / "cs_basic",
Path("doc_test") / "cs_basic",
),
(
Path("doc_test") / "go_basic",
Path("doc_test") / "go_basic",
Expand Down
Loading