feat: preview ready sync scene#607
Closed
A-kirami wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a standardized method getSceneLineOrFirstLine within the EditorLineHolder class and updates both the GraphicalEditor and TextEditor components to use it for line synchronization. Feedback suggests further unifying the scenePath used in TextEditor to props.targetPath to ensure consistency with GraphicalEditor and prevent potential synchronization errors in multi-editor scenarios.
Comment on lines
+135
to
137
| const lineNumber = editorLineHolder.getSceneLineOrFirstLine(props.targetPath); | ||
| EditorPreviewClient.sendSyncScene({ | ||
| scenePath: target?.path ?? '', |
Contributor
There was a problem hiding this comment.
在 syncCurrentLine 中,scenePath 使用了 target?.path。这与 GraphicalEditor 的实现不一致,且在多编辑器实例并存(如多页签模式)的情况下,可能会导致非活跃状态的编辑器在响应同步事件时,将自身的行号数据同步到当前活跃页面的路径上,从而引发预览错乱。建议统一使用 props.targetPath 以确保同步路径的准确性。
Suggested change
| const lineNumber = editorLineHolder.getSceneLineOrFirstLine(props.targetPath); | |
| EditorPreviewClient.sendSyncScene({ | |
| scenePath: target?.path ?? '', | |
| const lineNumber = editorLineHolder.getSceneLineOrFirstLine(props.targetPath); | |
| EditorPreviewClient.sendSyncScene({ | |
| scenePath: props.targetPath, |
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.
变更内容
EditorLineHolder中新增getSceneLineOrFirstLine,统一处理场景同步行号回退规则GraphicalEditor在预览 ready 后按记录行号同步当前场景,未记录时同步第 1 行TextEditor在预览 ready 后不再使用 Monaco 默认 position 兜底,避免无明确光标记录时同步到非预期行行为变化
已知边界