Skip to content

refactor: remove independent doc API and add scope to outline#30

Merged
observerw merged 3 commits intomainfrom
refactor-doc-outline
Jan 24, 2026
Merged

refactor: remove independent doc API and add scope to outline#30
observerw merged 3 commits intomainfrom
refactor-doc-outline

Conversation

@observerw
Copy link
Contributor

Summary

  • Removed the independent doc API as it's redundant with outline.
  • Enhanced outline API to accept an optional scope (as SymbolScope) to return the outline of a specific symbol and its children.
  • Synchronized all JSON schemas and documentation.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/DocResponse schema types, DocCapability, and their tests and documentation.
  • Extend OutlineRequest and OutlineCapability to accept an optional scope: SymbolScope that 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*, and RenamePreview* to add scope support and formal anyOf constraints requiring either scope or find.

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.

Comment on lines +37 to +45
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=[])
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@observerw observerw changed the title refactor: remove independent doc API and add --scope to outline refactor: remove independent doc API and add scope to outline Jan 23, 2026
@observerw observerw merged commit ccdbc81 into main Jan 24, 2026
@observerw observerw deleted the refactor-doc-outline branch January 24, 2026 04:18
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