Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception handling in code editor #1196

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Exception handling in code editor #1196

merged 2 commits into from
Jan 7, 2025

Conversation

nighca
Copy link
Collaborator

@nighca nighca commented Jan 6, 2025

Copy link

qiniu-prow bot commented Jan 6, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

// Case 4: Different user: Discard local cache
await clear(LOCAL_CACHE_KEY)
localProject = null
}

if (localProject?.hasUnsyncedChanges) {
if (!projectName) {
if (await askToOpenCachedVersionForCurrent(localProject.name!)) {
Copy link
Collaborator Author

@nighca nighca Jan 6, 2025

Choose a reason for hiding this comment

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

askToOpenCachedVersionForCurrent 的逻辑已经事实上没生效了,因为目前进入 editor 一定会带上 projectName(router 那里保证了),所以 loadProject 中并不会走到这里

这里先把失效代码删掉,单独记了个 issue 后续再 review 一下这里的逻辑

#1198

@nighca nighca requested a review from Copilot January 6, 2025 04:06
@nighca nighca marked this pull request as ready for review January 6, 2025 04:06

Choose a reason for hiding this comment

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

Copilot reviewed 11 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (15)
  • spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenu.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/hover/HoverCard.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/MonacoEditor.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceItem.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceUI.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/completion/CompletionUI.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/CodeLink.vue: Evaluated as low risk
  • spx-gui/src/pages/editor/index.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/resource-reference/selector/ResourceSelector.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/hover/HoverUI.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenuUI.vue: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/diagnostics/index.ts: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/context-menu/index.ts: Evaluated as low risk
  • spx-gui/src/components/editor/code-editor/ui/code-editor-ui.ts: Evaluated as low risk
Comments suppressed due to low confidence (5)

spx-gui/src/components/editor/code-editor/ui/api-reference/index.ts:41

  • [nitpick] Ensure that the error messages returned by itemsMgr.result.error are clear and helpful.
return this.itemsMgr.result.error

spx-gui/src/components/editor/code-editor/ui/completion/index.ts:100

  • Reset filterPositionRef when stopping the completion to avoid stale positions.
this.completionMgr.stop()

spx-gui/src/components/editor/code-editor/ui/completion/index.ts:70

  • completionError is introduced but not used anywhere. Ensure it is used appropriately to handle errors during the completion process.
return this.completionMgr.result.error

spx-gui/src/components/editor/code-editor/context.ts:2

  • The error message 'Monaco not initialized' could be more descriptive. Consider changing it to 'Monaco instance is not initialized. Please ensure that the Monaco editor is properly set up before calling getMonaco.'
if (monacoRef.value == null) throw new Error('Monaco not initialized')

spx-gui/src/components/editor/code-editor/ui/resource-reference/index.ts:37

  • Add error handling to ensure that any issues with fetching resource references are logged or communicated to the user.
const items = await provider.provideResourceReferences({ textDocument, signal })
@aofei
Copy link
Member

aofei commented Jan 7, 2025

有个 conflict 要解决下

@nighca
Copy link
Collaborator Author

nighca commented Jan 7, 2025

有个 conflict 要解决下

噢好的

@qiniu-ci
Copy link

qiniu-ci commented Jan 7, 2025

This PR has been deployed to the preview environment. You can explore it using the preview URL.

Warning

Please note that deployments in the preview environment are temporary and will be automatically cleaned up after a certain period. Make sure to explore it before it is removed. For any questions, contact the Go+ Builder team.

@nighca nighca merged commit 0b08e87 into goplus:dev Jan 7, 2025
5 checks passed
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.

Exception handling in code editor
3 participants