Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit 33d0b7a

Browse files
feat(components): show fullPath when hovering open-in-editor button (#134)
* feat(components): show fullPath when hovering open-in-editor button * chore: update --------- Co-authored-by: webfansplz <[email protected]>
1 parent 9941cf0 commit 33d0b7a

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

playground/src/components/HelloWorld.vue

-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,3 @@ const count = ref(10)
1818

1919
<Child msg="123456" />
2020
</template>
21-
22-
<style scoped>
23-
.read-the-docs {
24-
color: #888;
25-
}
26-
</style>

src/client/logic/global.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { VueDevtoolsHostClient } from '../../types'
22
import { useDevToolsClient } from './client'
33
import { initApp } from './app'
4+
import { rpc } from './rpc'
45

56
export interface VueDevtoolsGlobal {
67
loaded: boolean
@@ -29,3 +30,6 @@ export function createDevToolsClient() {
2930
},
3031
}
3132
}
33+
34+
export const inspectClientUrl = await rpc.inspectClientUrl()
35+
export const rootPath = await rpc.root()

src/client/logic/graph.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const list = ref<ModuleInfo[]>(await rpc.componentGraph())
88
export const searchText = useStorage('vite-inspect-search-text', '')
99
export const includeNodeModules = useStorage('vite-inspect-include-node-modules', false)
1010
export const includeVirtual = useStorage('vite-inspect-include-virtual', false)
11-
export const rootPath = ref(await rpc.root())
1211
export const userCustomGlobPattern = useStorage('__vue-devtools-graph-glob__', '')
1312

1413
function getDepsByExactId(data: typeof list.value, searchId: string) {

src/client/logic/rpc.ts

-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ export const rpc
1212
hookApi.hook.emit('__vue-devtools:terminal:exit__', data)
1313
},
1414
})
15-
16-
export const inspectClientUrl = await rpc.inspectClientUrl()

src/client/pages/components.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Pane, Splitpanes } from 'splitpanes'
44
import { ComponentWalker, getInstanceState } from '../logic/components'
55
import { useDevToolsClient } from '../logic/client'
66
import { instance, onVueInstanceUpdate } from '../logic/app'
7+
import { rootPath } from '../logic/global'
8+
79
import { scrollToComponent, selected, selectedComponentName, selectedComponentNode, selectedComponentNodeFilePath } from '../composables/component'
810
911
const componentTree = ref<ComponentTreeNode[]>([])
@@ -98,7 +100,7 @@ function openInEditor() {
98100
<i carbon-launch cursor-pointer text-sm op70 hover="op100" @click="openInEditor" />
99101
<template #popper>
100102
<p text-xs op-50>
101-
Open component in editor
103+
Open {{ selectedComponentNodeFilePath.replace(rootPath, '') }} in editor
102104
</p>
103105
</template>
104106
</VTooltip>

src/client/pages/graph.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script setup lang="ts">
22
import type { Data, Options } from 'vis-network'
33
import { Network } from 'vis-network'
4-
import { searchResults as modules, rootPath } from '../logic/graph'
4+
import { searchResults as modules } from '../logic/graph'
55
import { useDevToolsClient } from '../logic/client'
6+
import { rootPath } from '../logic/global'
67
import { useGraphSettings } from '../composables/graph'
78
import type { GraphSettingsType } from '../composables/graph'
89
@@ -47,7 +48,7 @@ const data = computed<Data>(() => {
4748
return {
4849
id,
4950
label: isInMain ? `<b>${pathSegments.at(-1)}</b>` : pathSegments.at(-1),
50-
title: getHoverPath(settings.graphSettings.value.hoverPathLevel, path, rootPath.value),
51+
title: getHoverPath(settings.graphSettings.value.hoverPathLevel, path, rootPath),
5152
group: path.match(/\.(\w+)$/)?.[1] || 'unknown',
5253
size: 15 + Math.min(mod.deps.length / 2, 8),
5354
font: {

src/client/pages/inspect.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { inspectClientUrl } from '../logic/rpc'
2+
import { inspectClientUrl } from '../logic/global'
33
</script>
44

55
<template>

0 commit comments

Comments
 (0)