Add comprehensive rename functionality tests for nimlsp#183
Merged
Conversation
- Add trename.nim test file that tests textDocument/rename requests - Create rename_test_project with test files for cross-file renaming - Test renaming variables, functions, and constants across multiple files - Verify that LSP returns proper WorkspaceEdit responses with text edits - Handle version warnings gracefully in test - Follow existing test patterns from tnimlsp.nim
- Add test case for renaming from importing file perspective - Update nimble file with proper project requirements - Add explanatory note about cross-file rename behavior - Document that rename from usage file works, but from definition file doesn't - This reveals a limitation in nimlsp/nimsuggest symbol resolution
Owner
|
Very nice to have some tests! I have noticed the "Rename from definition file" bug before. But haven't gotten around to fix it. It's probably just a matter of figuring out which nimsuggest commands would give the right list of symbols. |
Contributor
Author
|
yeah, I rarely use rename function in nim project, but likely it doesn't work well every time during these years, so I let AI help me write this test to see what's in the deep. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add comprehensive rename functionality tests for nimlsp
Summary
This PR adds a comprehensive test suite for the
textDocument/renameLSP functionality, including cross-file rename testing and documentation of current limitations.Changes Made
New Test Files
tests/trename.nim- Main test file fortextDocument/renamefunctionalitytests/rename_test_project/- Test project with multiple files for cross-file testingrename_test.nim- Source file with exported variables, functions, and constantsother_file.nim- Importing file that references symbols from the main filerename_test.nimble- Nimble project configurationtests/run_rename_test.nim- Test runner scriptTest Coverage
The test suite covers:
Key Findings
During testing, we discovered an important limitation in the current nimlsp implementation:
Cross-file rename behavior:
This reveals a limitation in nimlsp/nimsuggest symbol resolution where cross-file references are only detected when the rename request originates from the file that imports/uses the symbol.
Test Output
The test includes explanatory output that documents this behavior: