diff --git a/spx-gui/src/components/editor/code-editor/common.ts b/spx-gui/src/components/editor/code-editor/common.ts
index 57d8c3a02..eed8b3d56 100644
--- a/spx-gui/src/components/editor/code-editor/common.ts
+++ b/spx-gui/src/components/editor/code-editor/common.ts
@@ -48,8 +48,10 @@ export enum ResourceReferenceKind {
*/
export type ResourceURI = string
+const resourceURIPrefix = 'spx://resources/'
+
export function isResourceUri(uri: string): uri is ResourceURI {
- return uri.startsWith('spx://resources/')
+ return uri.startsWith(resourceURIPrefix)
}
export type ResourceIdentifier = {
@@ -468,8 +470,7 @@ export type ResourceNameWithType = {
export function parseResourceURI(uri: string): ResourceNameWithType[] {
if (!isResourceUri(uri)) throw new Error(`Invalid resource URI: ${uri}`)
- const url = new URL(uri)
- const parts = url.pathname.slice(1).split('/').map(decodeURIComponent)
+ const parts = uri.slice(resourceURIPrefix.length).split('/').map(decodeURIComponent)
const parsed: ResourceNameWithType[] = []
for (let i = 0; i < parts.length; ) {
const type = (
diff --git a/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue b/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
index b17e23538..45f6f13f7 100644
--- a/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
+++ b/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
@@ -61,6 +61,7 @@ import APIReferenceUI from './api-reference/APIReferenceUI.vue'
import HoverUI from './hover/HoverUI.vue'
import CompletionUI from './completion/CompletionUI.vue'
import CopilotUI from './copilot/CopilotUI.vue'
+import CopilotTrigger from './copilot/CopilotTrigger.vue'
import DiagnosticsUI from './diagnostics/DiagnosticsUI.vue'
import ResourceReferenceUI from './resource-reference/ResourceReferenceUI.vue'
import ContextMenuUI from './context-menu/ContextMenuUI.vue'
@@ -248,25 +249,7 @@ function zoomReset() {
@@ -316,25 +299,6 @@ function zoomReset() {
padding: 12px 16px;
display: flex;
border-top: 1px solid var(--ui-color-dividing-line-2);
-
- .copilot-trigger {
- flex: 1 1 0;
- padding: 8px 12px;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 12px;
- border-radius: var(--ui-border-radius-1);
- background-color: var(--ui-color-grey-300);
- cursor: pointer;
- transition: 0.2s;
-
- &:hover {
- // TODO: confirm hover style
- color: var(--ui-color-title);
- background-color: var(--ui-color-grey-400);
- }
- }
}
.copilot {
diff --git a/spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceItem.vue b/spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceItem.vue
index 4bca7c2ec..08a96f7d6 100644
--- a/spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceItem.vue
+++ b/spx-gui/src/components/editor/code-editor/ui/api-reference/APIReferenceItem.vue
@@ -68,7 +68,7 @@ const handleExplain = useMessageHandle(
diff --git a/spx-gui/src/components/editor/code-editor/ui/copilot/CopilotTrigger.vue b/spx-gui/src/components/editor/code-editor/ui/copilot/CopilotTrigger.vue
new file mode 100644
index 000000000..c7b5e41c2
--- /dev/null
+++ b/spx-gui/src/components/editor/code-editor/ui/copilot/CopilotTrigger.vue
@@ -0,0 +1,39 @@
+
+
+
+
{{ $t({ - en: 'TODO', - zh: 'TODO' + en: 'Copilot may help you write or understand code, find and fix problems', + zh: 'Copilot 可以帮助你编写或理解代码,发现并修复问题' }) }}
@@ -236,6 +153,8 @@ watch( margin-top: 16px; font-size: 13px; line-height: 20px; + text-align: center; + color: var(--ui-color-grey-800); } } } diff --git a/spx-gui/src/components/editor/code-editor/ui/copilot/logo.svg b/spx-gui/src/components/editor/code-editor/ui/copilot/logo.svg new file mode 100644 index 000000000..1ba6235ad --- /dev/null +++ b/spx-gui/src/components/editor/code-editor/ui/copilot/logo.svg @@ -0,0 +1,91 @@ + \ No newline at end of file diff --git a/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionItem.vue b/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionItem.vue index 401d56b69..afa9d1d32 100644 --- a/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionItem.vue +++ b/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionItem.vue @@ -21,4 +21,8 @@ const props = defineProps<{ flex-direction: column; gap: 2px; } + +.definition-item + .definition-item { + margin-top: 8px; +} diff --git a/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionOverviewWrapper.vue b/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionOverviewWrapper.vue index 854735a5a..624a078b7 100644 --- a/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionOverviewWrapper.vue +++ b/spx-gui/src/components/editor/code-editor/ui/definition/DefinitionOverviewWrapper.vue @@ -12,10 +12,10 @@ const childrenText = useSlotText('default', true) -