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

Исправления в работе с символами переменных #3226

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

nixel2007
Copy link
Member

@nixel2007 nixel2007 commented Jan 12, 2024

Описание

Оптимизация лэйаута символов переменных, исправление вывода дерева символов

Связанные задачи

Closes

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Refactor

    • Improved the handling of variable symbols in the codebase for enhanced performance and maintainability.
  • Bug Fixes

    • Fixed an issue to ensure consistent behavior when querying for variable symbols in documents.

Copy link

coderabbitai bot commented Jan 12, 2024

Walkthrough

The codebase has been refactored to simplify the AbstractVariableSymbol class, removing the concept of 'children' from variable symbols. Now, variable symbols are treated as leaf nodes, not maintaining a hierarchy. This change is reflected across various classes that deal with variable symbols, streamlining how symbols are constructed and represented within the language server.

Changes

File Path Change Summary
.../symbol/AbstractVariableSymbol.java Removed "children" field, getChildren now returns empty list, excluded "parent" field in @ToString.
.../symbol/IntBasedVariableSymbol.java
.../symbol/ShortBasedVariableSymbol.java
Removed children parameter from constructors.
.../providers/DocumentSymbolProvider.java Included VariableKind.LOCAL in supportedVariableKinds, updated toDocumentSymbol method to filter children.

Poem

🐇 Code hops away, no child in its trail,
🌿 Simplified leaves, in the code forest prevail.
📜 A refactor's delight, in the server's deep burrow,
✨ Variables stand alone, as the new code does follow.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@ghost
Copy link

ghost commented Jan 12, 2024

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between abfacae and 1657517.
Files selected for processing (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java (2 hunks)
Additional comments: 6
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java (2)
  • 48-48: The inclusion of VariableKind.LOCAL in the supportedVariableKinds set is consistent with the PR's objective to handle local variable symbols correctly.

  • 68-68: The addition of a filter in the toDocumentSymbol method to check for supported children symbols is a good practice to ensure that only relevant symbols are processed. This change should improve the accuracy of the symbol tree output.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java (1)
  • 78-78: The constructor of IntBasedVariableSymbol has been updated to remove the children parameter, which aligns with the removal of the "children" field in the AbstractVariableSymbol class. This change is consistent with the PR's objective to simplify the variable symbol structure.
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (1)
  • 78-78: The constructor of ShortBasedVariableSymbol has been updated to remove the children parameter, which is consistent with the changes in the AbstractVariableSymbol class and the PR's objective to streamline the representation of variable symbols.
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (2)
  • 49-49: Excluding the "parent" field from the @ToString annotation in AbstractVariableSymbol is a good practice to avoid potential issues with recursive toString calls, which can lead to stack overflow errors.

  • 93-95: The getChildren method now returns an empty list, which is consistent with the removal of the "children" field. This change simplifies the class structure and is in line with the PR's objectives.

Copy link

Qodana Community for JVM

17 new problems were found

Inspection name Severity Problems
Statement with empty body 🔶 Warning 5
'@Serial' annotation could be used 🔶 Warning 4
Constant values 🔶 Warning 3
Mismatched query and update of collection 🔶 Warning 2
Class is exposed outside of its visibility scope 🔶 Warning 1
Nullability and data flow problems 🔶 Warning 1
Mismatched read and write of array 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link

sonarcloud bot commented Jan 12, 2024

@nixel2007 nixel2007 merged commit 8522790 into develop Jan 12, 2024
33 checks passed
@nixel2007 nixel2007 deleted the feature/variable-symbol-fixes branch January 12, 2024 06:49
@nixel2007 nixel2007 added this to the 0.23.0 milestone Jan 12, 2024
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.

2 participants