refactor: remove independent doc API and add scope to outline#30
refactor: remove independent doc API and add scope to outline#30
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates the documentation/hover-style behavior into the outline API and removes the separate doc API, while tightening and synchronizing the locate-related JSON schemas.
Changes:
- Remove the
DocRequest/DocResponseschema types,DocCapability, and their tests and documentation. - Extend
OutlineRequestandOutlineCapabilityto accept an optionalscope: SymbolScopethat returns the outline for a specific symbol and its children, and add corresponding outline documentation examples. - Update core and LSAP package JSON schemas for
OutlineRequest,Locate,LocateRange,SymbolRequest,Definition*,Reference*, andRenamePreview*to addscopesupport and formalanyOfconstraints requiring eitherscopeorfind.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_doc.py | Removes tests for the deprecated DocCapability to match the removal of the doc API. |
| src/lsap/schema/outline.py | Adds `scope: SymbolScope |
| src/lsap/schema/doc.py | Deletes the DocRequest/DocResponse schema models and doc API documentation. |
| src/lsap/capability/outline.py | Implements scope handling using SymbolScope and iter_symbols to restrict the outline to a specific symbol subtree, and normalizes internal iteration to use lists. |
| src/lsap/capability/doc.py | Removes DocCapability, consolidating documentation retrieval into other flows. |
| src/lsap/capability/init.py | Drops DocCapability from the exported Capabilities TypedDict to reflect the removed API. |
| schema/outline.md | Documents the new scoped outline scenario (request with scope.symbol_path only). |
| schema/doc.response.json | Removes the standalone DocResponse JSON schema. |
| schema/doc.request.json | Removes the standalone DocRequest JSON schema. |
| schema/doc.md | Removes the doc API markdown documentation. |
| schema/OutlineRequest.json | Adds SymbolScope definition and optional scope field to the OutlineRequest JSON schema description. |
| schema/DocResponse.json | Removes the deprecated DocResponse JSON schema (duplicate-cased variant). |
| schema/DocRequest.json | Removes the deprecated DocRequest JSON schema (duplicate-cased variant). |
| packages/LSAP/schema/outline.md | Mirrors the new outline scoped-use example in the LSAP package docs. |
| packages/LSAP/schema/doc.md | Removes LSAP-level documentation for the deprecated doc API. |
| packages/LSAP/schema/SymbolRequest.json | Updates Locate sub-schema to include anyOf constraints (require scope or find) and SymbolScope support. |
| packages/LSAP/schema/RenamePreviewResponse.json | Updates embedded Locate schema with anyOf constraints for file_path + (scope or find). |
| packages/LSAP/schema/RenamePreviewRequest.json | Same Locate schema tightening for rename preview request. |
| packages/LSAP/schema/ReferenceResponse.json | Same Locate schema tightening for reference response. |
| packages/LSAP/schema/ReferenceRequest.json | Same Locate schema tightening for reference request. |
| packages/LSAP/schema/OutlineRequest.json | Adds SymbolScope and optional scope field to LSAP OutlineRequest schema, matching Python model and docs. |
| packages/LSAP/schema/LocateRequest.json | Adds anyOf constraints to the Locate sub-schema in the LSAP locate request. |
| packages/LSAP/schema/LocateRangeRequest.json | Adds anyOf constraints to the LocateRange sub-schema in the LSAP locate-range request. |
| packages/LSAP/schema/LocateRange.json | Adds top-level anyOf constraints to ensure either scope or find is present for locate-range. |
| packages/LSAP/schema/Locate.json | Adds top-level anyOf constraints and keeps SymbolScope support for locate. |
| packages/LSAP/schema/DocResponse.json | Removes LSAP-level DocResponse schema. |
| packages/LSAP/schema/DocRequest.json | Removes LSAP-level DocRequest schema. |
| packages/LSAP/schema/DefinitionResponse.json | Tightens embedded Locate schema with anyOf constraints for definition response. |
| packages/LSAP/schema/DefinitionRequest.json | Tightens embedded Locate schema with anyOf constraints for definition request. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if req.scope: | ||
| target_path = req.scope.symbol_path | ||
| matched = [ | ||
| (path, symbol) | ||
| for path, symbol in iter_symbols(symbols) | ||
| if path == target_path | ||
| ] | ||
| if not matched: | ||
| return OutlineResponse(file_path=req.file_path, items=[]) |
There was a problem hiding this comment.
The new scope handling branch in __call__ (matching req.scope.symbol_path via iter_symbols and building symbols_iter from the matched subtree) is not covered by tests in tests/test_outline.py, which only exercise file-wide calls without scope. Please add tests that cover (at least) a successful scoped request (returning the outline for a specific symbol and its children), a scoped request that finds no symbol (returning an empty items list), and the interaction of scope with top=True to ensure the new behavior is stable.
There was a problem hiding this comment.
Added tests covering successful scoped requests, scoped requests with no matching symbol, and the interaction of scope with top=True. The new tests are in tests/test_outline.py.
There was a problem hiding this comment.
I've verified that the tests requested (successful scoped request, non-existent scope, and interaction with top=True) are already present in tests/test_outline.py and are passing. I also updated the examples in definition.py to use the new scope-based Locate schema.
Summary
docAPI as it's redundant withoutline.outlineAPI to accept an optionalscope(asSymbolScope) to return the outline of a specific symbol and its children.