Add document search support with /doc trigger#47
Merged
Conversation
- /file now triggers the picker immediately without requiring a space; characters typed right after (/filefoo) become the search query - /doc command added for documents: searches by name, and by ID if the query is numeric (ID result shown first, merged with name results) - Document chips use the ⟦doc:ID:TITLE⟧ token format and expand to document title + description when the message is sent - FilePickerDropdown extended with a type prop to render doc items (title + #ID, folder/document icon) alongside existing file items - i18n: added docInput keys in ru and en Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BA6oSYD68zVgMGt7L2QQiU
- Enter / click on picker row now inserts a reference chip (📎) for both files (⟦ref:PATH⟧) and documents (⟦docref:ID:TITLE⟧) - Each picker item gains an "📄 содержимое" button on the right that inserts the full-content token (⟦file:PATH⟧ / ⟦doc:ID:TITLE⟧) - Button is hidden until the row is hovered or keyboard-selected to keep the list uncluttered - fileChips: added makeDocRefToken / parseDocRefToken; TOKEN_RE updated to include docref; expandTokensForSend expands docref to a plain «Title» (#ID) mention without fetching description - Footer hint updated: Enter → "вставить ссылку" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BA6oSYD68zVgMGt7L2QQiU
Showing the button on both :hover and --selected caused two buttons to be visible simultaneously when mousing over a row other than the keyboard-selected one. Button is now shown on hover only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BA6oSYD68zVgMGt7L2QQiU
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.
Summary
Extends the file chip input component to support searching and inserting documents via a new
/doctrigger, alongside the existing/filetrigger for repository files.Key Changes
New
/doctrigger: Added parallel document search functionality using a newdocumentsApimoduleDocument token format: Introduced
⟦doc:ID:TITLE⟧token format with correspondingmakeDocToken()andparseDocToken()functionsUI enhancements:
FilePickerDropdownnow handles both file and document result types with conditional renderingToken expansion: Updated
expandTokensForSend()to fetch and embed document content when sending messagesRefactored trigger detection: Generalized trigger matching to support both
/fileand/doccommands with improved cursor position trackingAPI integration: Created
documentsApi.jswithsearchByName()andgetById()methods supporting abort signals for request cancellationImplementation Details
searchDocsAsync()helper that intelligently routes numeric queries to both name and ID searchestype: 'file' | 'doc'to determine which search and rendering logic to uselastIndexOf()for more robust command boundary detectionhttps://claude.ai/code/session_01BA6oSYD68zVgMGt7L2QQiU