Skip to content

feat(DocumentSymbolProvider): detail с сигнатурой параметров метода#4082

Merged
nixel2007 merged 2 commits into
developfrom
claude/documentsymbol-detail
Jun 13, 2026
Merged

feat(DocumentSymbolProvider): detail с сигнатурой параметров метода#4082
nixel2007 merged 2 commits into
developfrom
claude/documentsymbol-detail

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Проблема

toDocumentSymbol строил DocumentSymbol только из name/kind/range/selectionRange, поле detail оставалось null. В Outline и breadcrumbs у методов не было краткой подписи параметров.

Решение

При построении символа метода (symbol instanceof MethodSymbol) заполняем detail краткой сигнатурой по именам параметров: (Пар1, Пар2). Необязательные параметры (с значением по умолчанию, ParameterDefinition.isOptional()) помечаются суффиксом =, например (Первое, Второе =). Метод без параметров получает (). Имя метода в detail не дублируется. Переменные оставлены без detail (тип дёшево недоступен).

Тесты

  • testMethodDetailContainsParameterNames — функция с обязательным и необязательным параметром получает detail (Первое, Второе =).
  • testMethodWithoutParametersHasEmptyParenthesesDetail — процедура без параметров получает detail ().
  • Существующие testDocumentSymbol и testIncompleteVariableDeclarationDoesNotBreakSelectionRange проходят без изменений (структура символов не сломана).

Финальный прогон DocumentSymbolProviderTest: 4 теста PASSED, BUILD SUCCESSFUL.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Method symbols in document outlines now show detailed parameter signatures in the symbol "detail" field, with optional parameters clearly indicated.
  • Tests

    • Added regression tests to verify method parameter details, covering optional-parameter marking and methods with no parameters to ensure consistent signature formatting.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 409c7348-8566-4811-9369-773fc9a6774a

📥 Commits

Reviewing files that changed from the base of the PR and between c5ba721 and f5b402b.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProviderTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProviderTest.java

📝 Walkthrough

Walkthrough

The PR enriches DocumentSymbol output for MethodSymbol instances by setting DocumentSymbol.detail to a formatted parameter signature string (parenthesized parameter names; optional parameters marked with =). Two regression tests verify parameter formatting and the empty-parameter case.

Changes

Method Symbol Detail Enhancement

Layer / File(s) Summary
Method detail formatting logic
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java
Adds imports for MethodSymbol and ParameterDefinition and helper logic that builds a parenthesized parameter signature for method symbols, appending = to optional parameters; sets DocumentSymbol.detail when the symbol is a MethodSymbol.
Method detail formatting tests
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProviderTest.java
Adds two JUnit tests: one asserting method detail includes parameter names and marks optional parameters, and one asserting methods with no parameters produce () as detail.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble on code, tidy and neat,
Parameters curled in parentheses sweet,
Optional marks hop with a tiny =,
Tests guard the meadow where symbols play,
Hooray—method details bloom today!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly describes the main change: adding method parameter signatures to the detail field of DocumentSymbol instances in DocumentSymbolProvider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/documentsymbol-detail

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nixel2007

Copy link
Copy Markdown
Member Author

Необязательные параметры имеет смысл помечать знаком вопроса, а не равно. Как в hover

nixel2007 and others added 2 commits June 13, 2026 11:19
По ревью: единообразно с hover (HoverParameters: optional → "?"), а не "=".

Co-Authored-By: Claude Fable 5 <[email protected]>
@nixel2007
nixel2007 force-pushed the claude/documentsymbol-detail branch from c5ba721 to f5b402b Compare June 13, 2026 09:19
@nixel2007

Copy link
Copy Markdown
Member Author

Поправил: необязательные параметры теперь помечаются ? после имени — единообразно с hover (HoverParameters: optional → "?"). Было (Первое, Второе =), стало (Первое, Второе?). Тест обновлён, DocumentSymbolProviderTest зелёный.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 3 276 files   3 276 suites   1h 20m 13s ⏱️
 3 186 tests  3 171 ✅ 15 💤 0 ❌
19 116 runs  19 026 ✅ 90 💤 0 ❌

Results for commit f5b402b.

@nixel2007
nixel2007 merged commit ab64347 into develop Jun 13, 2026
36 of 37 checks passed
@nixel2007
nixel2007 deleted the claude/documentsymbol-detail branch June 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant