[rust-api-parser] Update parser to have Stable Line IDs#10535
Merged
HarshaNalluru merged 9 commits intoAzure:mainfrom May 5, 2025
Merged
[rust-api-parser] Update parser to have Stable Line IDs#10535HarshaNalluru merged 9 commits intoAzure:mainfrom
HarshaNalluru merged 9 commits intoAzure:mainfrom
Conversation
* formattign changes and "use name = summary" pattern * replaceCratePath utils * split if glob for "use" * checkpoint - do not show internal details such as generated::* * external module reexports being handled better * formatting changes and upgrade version * refactor common logic - re-export refs * processExternalReferences * linedid utils * checkpoint with a bug * new strategy to isolate the Use items - draft * simple Use item - id fix * template looks great * addExternalReferencesIfNotExists improvement * added a case where use item has not been processed yet, so we process it. * parent info missed * format * bug fix for identity * generic args fix * registerExternalItemReference * changelog * collapse rootModule into top-level * replaceSuperPrefix * line id utils added * update function name * stable lineIds updates
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the Rust API parser to support stable line IDs by introducing a persistent mapping via lineIdMap and updating all relevant processing functions accordingly. Key changes include:
- Introducing and integrating the new lineIdMap into item processing functions.
- Updating functions such as registerExternalItemReference, processUse, and various process* functions to use consistent line IDs.
- Minor refactorings and formatting improvements to support the new stable line IDs.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/apiview/parsers/rust-api-parser/src/process-items/utils/externalReexports.ts | Updated to use lineIdMap and stable line IDs for external re-exports. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processUse.ts | Adjusted processing to include stable line ID mapping and update children accordingly. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processUnion.ts | Integrated lineIdMap for union items. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processTypeAlias.ts | Added lineIdMap usage for type aliases. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processTraitAlias.ts | Enabled stable line IDs via lineIdMap for trait aliases. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processTrait.ts | Updated to set stable line IDs for trait items. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processStructField.ts | Enhanced field processing with stable line IDs through lineIdMap. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processStruct.ts | Modified struct processing to incorporate the new line ID mapping. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processStatic.ts | Updated static item processing with stable line IDs. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processProcMacro.ts | Integrated lineIdMap usage for procedural macros and added related line IDs. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processModule.ts | Incorporated stable line IDs in module processing and re-exports. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processMacro.ts | Adjusted macro processing for stable line ID tracking. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processImpl.ts | Updated implementation processing to append stable suffixes using lineIdMap. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processFunction.ts | Now sets stable line IDs for function items. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processExternType.ts | Added stable line ID mapping for extern types. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processEnum.ts | Updated enum processing to integrate stable line IDs with minor refactoring. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processConstant.ts | Enhanced constant items to use stable line IDs. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processAssocType.ts | Introduced stable line ID mapping for associated types. |
| tools/apiview/parsers/rust-api-parser/src/process-items/processAssocConst.ts | Updated associated constants processing with stable line IDs. |
| tools/apiview/parsers/rust-api-parser/src/main.ts | Updated codeFile building to include an update to stable line IDs on review lines. |
Comments suppressed due to low confidence (1)
tools/apiview/parsers/rust-api-parser/src/process-items/processMacro.ts:21
- [nitpick] The variable 'linedId' is inconsistent with the naming convention used elsewhere (e.g. 'lineId'). Consider renaming it to 'lineId' for consistency across the codebase.
const linedId = item.id.toString();
…sEnum.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…shaNalluru/azure-sdk-tools into harshan/rust-stable-line-ids
HarshaNalluru
commented
May 5, 2025
heaths
approved these changes
May 5, 2025
Member
heaths
left a comment
There was a problem hiding this comment.
A couple of questions/nits, but I see nothing blocking.
chidozieononiwu
approved these changes
May 5, 2025
…shaNalluru/azure-sdk-tools into harshan/rust-stable-line-ids
heaths
approved these changes
May 5, 2025
JoshLove-msft
pushed a commit
to JoshLove-msft/azure-sdk-tools
that referenced
this pull request
May 29, 2025
* Enhance Rust API Parser with Stable Line IDs (Azure#1) * formattign changes and "use name = summary" pattern * replaceCratePath utils * split if glob for "use" * checkpoint - do not show internal details such as generated::* * external module reexports being handled better * formatting changes and upgrade version * refactor common logic - re-export refs * processExternalReferences * linedid utils * checkpoint with a bug * new strategy to isolate the Use items - draft * simple Use item - id fix * template looks great * addExternalReferencesIfNotExists improvement * added a case where use item has not been processed yet, so we process it. * parent info missed * format * bug fix for identity * generic args fix * registerExternalItemReference * changelog * collapse rootModule into top-level * replaceSuperPrefix * line id utils added * update function name * stable lineIds updates * Update tools/apiview/parsers/rust-api-parser/src/process-items/processEnum.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * changelog * Update tools/apiview/parsers/rust-api-parser/CHANGELOG.md * Update tools/apiview/parsers/rust-api-parser/CHANGELOG.md * more descriptive unknown_names - the codepath that doesn't get hit * type --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Enhance Rust API Parser with Stable Line IDs
lineIdMapto map item IDs to stable, meaningful identifiers rather than relying on the dynamic rustdoc ids.updateReviewLinesWithStableLineIdsto ensure consistent review line IDs across modules and external references.New diff