Autocomplete#14
Open
Windorain wants to merge 62 commits into
Open
Conversation
…rd boundary resolver
Implements the dropdown popup UI for autocomplete suggestions with scrollable candidate list, selection highlighting, scrollbar, and viewport clamping.
…, and value range - Fix keyboard typing not triggering autocomplete (schedule polluted state) - Fix popup position anchoring to cursor pixel instead of hardcoded offset - Fix popup flip above cursor when insufficient room below - Fix Backspace consumed by navigation instead of forwarded to textarea - Fix modal scroll wheel (popup only when mouse inside) - Fix ItemCandidate icon offset - Fix fallback regex replaceEnd to scan forward for closing quote - Add cursor pixel position API to SceneEditorMultilineTextArea - Add throttled diagnostic logging
- Remove debug printlns - Cache MdAstRoot to skip re-parse on cursor-only moves - Store pendingContext to avoid re-resolve on commit - Preserve popup scroll/selection when candidate list unchanged - Extract getAutocompleteAnchorX/Y(), eliminate magic numbers - Extract SyntaxUtils shared by 3 resolvers - Fix fallback regex for lowercase tags - Fix raw Map type, COWList→ArrayList, skip redundant computeSize
…name completion - Add CompositeResolver to chain Frontmatter→Mdx→WordBoundary resolvers - Add FrontmatterResolver for YAML frontmatter key/value detection - Add MdxValueContext, MdxAttrNameContext, TagStartContext, FrontmatterContext - Extend MdxSyntaxResolver with TAG_START and ATTRIBUTE_NAME detection - Extend AutocompleteProviders with 4-way context dispatch - Add AttributeNameProvider using TagAttributeRegistry - Add ColorCandidate and RegistryCandidate rendering stubs - Wire CompositeResolver into GuideScreen
- Boolean, EnumValue, Color, OreDict, BlockId, EntityName providers - KeyBind, PageReference (stub), Anchor (stub), Command providers - NumericValue, Expression, Domain, FormatPattern providers - RecipeFilter, TagName providers - Fix RegistryCandidate to support ItemStack icon rendering - Register all providers in ClientProxy
…oviders - FrontmatterKeyProvider and FrontmatterValueProvider - MarkdownInlineProvider, MarkdownBlockProvider, FencedBlockLanguageProvider (stubs) - NbtProvider, Vector3Provider, DataProvider for structural template hints - Add autocomplete-test.md guide page for manual testing
…filter, fix registry gaps - Remove Boolean, Vector3, Nbt, Data, MarkdownInline, MarkdownBlock providers - Merge RecipeFilterProvider into ItemIdProvider (add input/output keys) - Simplify ColorProvider to symbolic names only - Add chart tags (Bar/Column/Line/Scatter/PieChart) to TagAttributeRegistry - Add chart child tags (Series, LineSeries, Slice, PieInset) - Add FunctionGraph child tags (Plot, Point) - Extend GameScene/Scene with camera attributes - Extend Function/FunctionGraph with container attributes - Extend Entity with rotation attributes - Extend Latex with sourceScale, showTooltip, offset - Extend ImportStructure, PlaceBlock, ReplaceBlock with bounds attrs - Add Block scene element tag
…, FencedBlockLanguage providers - FencedBlockLanguageProvider: return language list filtered by partial text - PageReferenceProvider: static setPages() wired from GuideScreen, suggests page paths - AnchorProvider: static setDocumentText() wired from GuideScreen, parses headings - FrontmatterValueProvider: contextual hints per frontmatter key
…estions Scans resource pack asset directories for .png/.snbt/.csv/.json/.mmd files. Uses AccessorFMLClientHandler mixin for resource pack access, same pattern as DataDrivenGuideLoader.
…ders - Fix crash-causing format patterns (%d/%f) and domain syntax - Separate Anchor display/replacement, limit Color to Color/id - Filter NumericValueProvider by attr name, add missing tag keys - Handle # inside frontmatter quotes - Disable TagNameProvider, AttributeNameProvider: unreliable until parser supports error-recovery - Remove EnumValueProvider, FencedBlockLanguageProvider registrations - Roll back EntityNameProvider hardcoded aliases
…en throws - FactoryTag: fix recover() token exit order (LIFO), handle EOF vs non-EOF consume, remove crashEol, unify optionalEsWhitespace to always allow lazy lines - FactoryMdxExpression: add recovery token for lazy-line bailout path - MdxMdastExtension: replace 6 ParseException throws with graceful recovery or recursive stack unwind in onErrorRightIsTag/onErrorLeftIsTag - MdastCompiler: replace 3 throws (exit open==null, defaultOnError x2) with recursive unwind + stack restoration; guard onexitlineending against empty stack The tokenizer and mdast compiler now produce a partial AST for any input, ensuring autocomplete can always query syntax context.
…, nested MDX elements - YAML list items with colons in value (e.g. "guidenh:guide_icon") now correctly resolve to their parent key context via isYamlListMarker check before colon-split - Top-level keys with prevIndent=0 now return their own context for list items and empty lines, instead of falling back to plain text - findEnclosingMdxElement: search children first for innermost match, fixing nested MDX element attribute/tag-start autocomplete
- resolveTagStart: extend to detect partial tag names after '<' (e.g. <I|, <Item|) by walking back to '<' and extracting partialText for TagNameProvider filtering. Closing tags (</I) are excluded. - applySmartNewline: when the current line is blank (trimmed empty), move cursor to the next line instead of inserting an extra blank line.
Add unified tick scheduling and Lyt tree host environment: - MasterScheduler: single ClientTick.END entry point with priority queues - WorkItem interface: shouldRun() + tick(deadlineNs) → YIELD/DONE - LytHost: event queue, deferred task queue, NavigationState, ViewportState - LytHostWorkItem: thin WorkItem adapter for MasterScheduler - WarmupWorkItem, SearchIndexWorkItem, DevWatchWorkItem: migrate from GuideWarmupPump, GuideSearch, GuideDevWatcherPump - NavigationState: consolidates GuideScreenMemory, GuideBookmarkState, GuideScreenHomeHistory into single instance - ViewportState: encapsulates scroll/clamp/viewport rect logic - LytNode: add replaceChild(), isAttached() - LytDocument: add replaceChild() override - Wire MasterScheduler + LytHost in ClientProxy - GuideScreen: migrate to LytHost.getNavigation() / getViewport()
…ytHost - Remove GuideWarmupPump.init() and GuideDevWatcherPump.init() calls - WarmupWorkItem and DevWatchWorkItem now fully replace them - Add WarmupWorkItem.clearScheduler() for GuideLightweightReloadService - Connect LytHost.setDocument() on page load in GuideScreen - Clean up unused imports in ClientProxy
…etons - ViewportState.scrollTo() now called from clampScroll() to sync scroll position - Add recallNavigationState, consumeValidLastContentState, isSupportedContentAnchor, isValidContentRoute to NavigationState (migrated from GuideScreenMemory) - Replace last 2 GuideScreenMemory call sites in GuideScreen - Bridge bookmark/history writes to both NavigationState and old singletons - Document known Phase 1 residuals in design doc
- Add MdAstToMdxConverter: convert all MdAst nodes to MdxJsxElement in-place during PageCompiler.parse(), keeping only MdAstText as leaf - Add 14 new TagCompilers for standard elements: Block: p, h1-h6, ul/ol, li, pre, blockquote, table, hr Inline: strong, em, del/u/wavy/dotted, code, img - Simplify PageCompiler: eliminate all instanceof MdAst* branches in compileBlockContext() and compileFlowContent() - Simplify PageIndexer: same treatment — tag dispatch by MdxJsx name - Simplify GuideSiteHtmlCompiler: same treatment for 25+ branches - Adapt helper files: MarkdownRuntimeBlocks, MarkdownListSemantics, GuideTitleHeadings, HomePageSummaryExtractor, GuideMarkdownDefinitions - Add MdAstToMdxConverter.convert() calls after MdAst.fromMarkdown() in SceneEditorMarkdownCodec, SceneEditorMultilineTextArea, MdxSyntaxResolver - Add LytBox.replaceChild() for nested stub node replacement - Register all new TagCompilers in DefaultExtensions
- C1: BlockquoteCompiler — call parseBlockquoteDirective() for alert/quote boxes - C2: ListItemCompiler — call extractTaskMarker() for [x]/[ ] checkboxes - C3: GuideSiteHtmlCompiler — restore code block sub-languages (csv/filetree/mermaid/functiongraph) - D6-1/D6-2: skip <definition> elements (no error block), forward <span> children - Fix navigation: parse frontmatter BEFORE converter removes MdAstYamlFrontmatter - Fix table inline nodes: add phrasing containers (td/th/p/li etc.) to isPhrasingParent - FQN cleanup: replace inline FQNs with proper imports in ListItemCompiler, MdxSyntaxResolver
…d content - buildErrorPage() now creates MdxJsxFlowElement instead of MdAstHeading/MdAstParagraph, so error pages go through the tag-dispatch pipeline correctly. - convertPhrasingChildren() now accepts List<?> and handles both inline phrasing and block-level nodes (e.g. MdAstParagraph inside <td>), fixing ClassCastException that caused pages with table cells containing block content to lose their frontmatter and disappear from the navigation tree.
Table cells with alternating MdAstText and <code> elements (e.g. `billboard`, `smoke`, `largesmoke`) were getting each text fragment wrapped in a separate LytParagraph because the new compileBlockContext lacked the previousLayoutChild optimization. Restored it: adjacent inline elements now merge into one paragraph. Added known-issues memo to phase2 spec for the proper fix (TableCompiler should use compileFlowContext directly).
- MdAstToMdxConverter: convert kramdown {: widths=... } lines to <table-meta>
- TableCompiler: consume <table-meta> elements, apply preferred column widths
- HeadingCompiler: depth default 1, parseIntSafe with NFE protection, clamp 1-6
- ListCompiler: parseIntSafe with NFE protection for start attribute
… removal - Add id/nodeUid/styleClass fields and onAttach/onDetach lifecycle to LytNode - Add isLive/setLive with recursive cascade to LytDocument - Introduce LytScript, ScriptContext, ScriptType interfaces - Add script registry, two-level cache, MOUNT dispatch to LytHost - Migrate 18 impure compilers to pure TagCompiler + LytScript stubs - Delete GuideWarmupPump, GuideWarmupScheduler, WarmupWorkItem, GuideDevWatcherPump - Remove 19 warmup methods from MutableGuide, warmup page cache - Remove 12 dead MdAst compile methods from PageCompiler - Wire LytHostPreheatItem to MasterScheduler with MEDIUM priority
…egistrations - ScenePlaceholder now extends LytParagraph so config data survives - BlockImageCompiler stores extracted attributes in BlockImagePlaceholder - dispatchMountEvents/allocateNodeUids traverse LytParagraph content + LytFlowSpan children - LytFlowContent gets nodeUid field for flow-level node identification - LytScript.onEvent/LytEvent target widened to Object for flow content support - Register missing scripts: BlockImage, CsvTable, Mermaid, Scene, GameScene
…plementations - Fix cascadeLive to call onAttach/onDetach on all nodes (was only LytDocument) - Add lifecycle hooks to LytBox append/removeChild/replaceChild - Handle LytFlowInlineBlock in MOUNT dispatch (penetrate to inner block styleClass) - Support LytFlowContent replacement in ScriptContextImpl.replace() - Wire LytHostPreheatItem to MasterScheduler, setCurrentPageId in GuideScreen - Make CategoryPlaceholder and SpecialPlaceholder public with public fields Implement 9 LytScript: PlayerNameScript — read Minecraft username KeyBindScript — look up key binding mapping CommandLinkScript — set click callback with chat command SoundLinkScript — set click sound spec StructureScript — resolve item stacks via Item.itemRegistry SubPagesScript — query navigation tree, build page link list ItemGridScript — resolve item stacks, build item grid ItemImageScript — resolve item stack, build LytItemImage ItemLinkScript — resolve item stack, set tooltip (index lookup deferred)
…er persistence 7 scripts now have real runtime implementations: - ImageScript/FloatingImageScript: loadAsset → LytImage replacement - MermaidScript: parse .mmd → LytMermaidMindmap - SpecialScript: MediaWiki special page resolution via Guide - RecipeScript: NEI recipe lookup cascade (handler → integration → vanilla) - BlockImageScript: mini 3D block scene construction - SceneScript: re-parse childrenSource → dispatch to 19 element compilers Fixes: - ScriptContextImpl.replace handles LytParagraph parents (not just LytFlowSpan) - Flow content replacement invalidates document layout - LytHostWorkItem stays in scheduler queue (was removed after first DONE) - ScenePlaceholder fields made public, pageDomain stored for runtime compiler - ScriptContext.getPageCollection() added for SpecialScript - SceneScript applies all config (layerSlider, grid, showGrid, explicitCenter)
- QuestCardScript: createQuestGuiLink instead of createQuestLink(null) → NPE - RecipeScript: read ph.limit, always ctx.replace in showFallback, drop stale multi guard - MermaidScript: replaceWithError on all 3 failure paths - ItemLinkScript: ore attribute fallback via OreDictionary.getOres() - FloatingImageCompiler: Random(0) for deterministic borderColor - BlockImageCompiler/Script: Integer.MIN_VALUE sentinel for meta=0 vs unspecified - MasterScheduler: progressive deadlineNs across HIGH/MEDIUM/LOW queues
…rsal replaceChild
- ScriptContextImpl.replace(): when node is LytFlowInlineBlock and newNode
is LytBlock, swap inner block via setBlock() — all block-level scripts
automatically work in paragraph/list-item contexts without wrapper awareness.
- LytNode.replaceChild(): default throws UnsupportedOperationException
instead of silent no-op. Missing overrides added to LytAlignedBlock,
LytDocumentFloat, LytDetailsBlock, LytQuoteBox, and LytTableRow.
- ItemId parsing in ItemImageScript, ItemGridScript, StructureScript:
use IdUtils.parseItemRef() to correctly handle namespace:path format
(was broken by lastIndexOf(':') splitting).
- SceneScript: GuideSceneStructureCompileScope.run(true, ...) to enable
scene element compilation at runtime.
- LytHostWorkItem: always return YIELD to prevent scheduler ejection.
- LytParagraph: PLACEHOLDER_STYLE (amber) and ERROR_STYLE (red) for
consistent placeholder/error display.
- RecipeScript: use ph.limit directly, always ctx.replace() in showFallback.
- FloatingImageCompiler: Random(0) for deterministic border color.
- BlockImageCompiler: meta default Integer.MIN_VALUE sentinel.
- docs/refractor/phase3-two-tree-problem.md: architectural memo.
All scripts: replace "Loading..." spam with clean [TagName] placeholders
and [TagName] error messages on failure paths.
…syntax Keep local architecture (LytHost, MasterScheduler, scripts) while merging remote additions (bridge, semantic providers, StructureLib features). Resolved conflicts: ClientProxy (both fields), MutableGuide (local architecture, Map.copyOf syntax), GuideLightweightReloadService (local log), compiler files (local wins), GuideWarmupScheduler (deleted).
- Remove extra closing brace in MutableGuide.close() - Remove unused GuideDevWatcherPump import in ClientProxy - Replace Collections.emptyMap() with Map.of() in SceneEditorMarkdownCodec
GuideScreen.drawTiledBackground could NPE when mc is null during screen transitions. Added defensive null check with warning log instead of crash.
- Replace setDocument with mountDocument (fresh) and swapDocument (cached) - PageCacheEntry stores GuidePage with mounted flag to distinguish preheated-only from fully materialized cache entries - completePendingContentPageLoadIfNeeded checks cache before compiling - Wire PreheatCompiler, requestPreheatNeighbors, preheatStep to real impl - LytHostPreheatItem: shouldRun → hasPreheatWork, tick → preheatStep - LRU eviction at 32 pages; evict/invalidate clean up preheatScheduled - Null-guard drawPageMissingMessage and drawLoadingMessage against mc==null
- Remove swapDocument/mounted/isPageMounted/markPageMounted - mountDocument resets pageNodeCounters for stable UIDs across remounts - dispatchScript checks node cache before invoking script - ScriptContextImpl.replace records node results on every branch - completePendingContentPageLoadIfNeeded always uses mountDocument
F3+T reload now only extracts YAML frontmatter (~200ns/page) instead of running full Micromark parsing (~161us/page). The AST is lazily parsed on first getAstRoot() call, which happens during page display, preheat pipeline, or background search indexing.
GuideScreen.initGui() did not call super.initGui(), so NEI's Mixin never initialized the GuiContainer.manager field. Calling super.initGui() ensures the NEI manager is properly set up. Also added mc==null guard in updateScreen() as a defensive measure.
- parseFrontmatterFromSource() now strips UTF-8 BOM before extracting YAML frontmatter, fixing "0 navigation entries" in NavigationTree - GuideScreen.initGui() initializes NEI GuiContainerManager via reflection to prevent Mixin NPE from uninitialized manager field - Added null guards: mc==null in updateScreen(), guide==null in rememberNavigationState()
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.
候选框通用框架基本完成,还需要修复解析层的大量问题
需要为搜索建立索引,解决巨量文件情况下搜索无响应