✨ feat(vscode): 代码阅读鼠标停在名字和注释链接上弹出定义所在那块的卡片,别的文件的也行

This commit is contained in:
cruldra committed 2026-10-08 07:17:26 +08:00
1 parent bc7380c716
commit a48b016d73
20 files changed
+1145 -89

No files matched your search

@@ -330,6 +330,54 @@ body:is(.vscode-light, .vscode-high-contrast-light) .cr-colored { color: var(--c
color: var(--vscode-descriptionForeground);
}
/*
* 悬停名字、链接时的定义卡片浮窗:外框同 VS Code 编辑器的悬停框(边框、底色、阴影),标题一行垫悬停框状态栏的底色。
* 落位时按剩下的空间限宽高(行内样式),卡片再大就在下面那块里滚;那块自己也有个上限,大文件的类不至于占满半屏。
* 层级低于悬停提示(z-50),浮窗里名字的提示照样盖在它上面
*/
.cr-peek {
position: fixed;
z-index: 40;
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--vscode-editorHoverWidget-border, var(--vscode-editorWidget-border));
border-radius: 6px;
background: var(--vscode-editorHoverWidget-background, var(--vscode-editorWidget-background));
color: var(--vscode-editorHoverWidget-foreground, var(--vscode-foreground));
box-shadow: 0 2px 8px var(--vscode-widget-shadow, rgb(0 0 0 / 36%));
}
.cr-peek-head {
flex-shrink: 0;
padding: 2px 8px;
border-bottom: 1px solid var(--vscode-editorHoverWidget-border, var(--vscode-editorWidget-border));
background: var(--vscode-editorHoverWidget-statusBarBackground, transparent);
color: var(--vscode-textLink-foreground);
font-family: var(--vscode-editor-font-family, monospace);
font-size: 12px;
line-height: 18px;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.cr-peek-head:hover {
color: var(--vscode-textLink-activeForeground);
text-decoration: underline;
}
.cr-peek-head:focus-visible {
outline: 1px solid var(--vscode-focusBorder);
outline-offset: -1px;
}
.cr-peek-body {
min-height: 0;
max-width: 640px;
max-height: 420px;
overflow: auto;
padding: 6px 8px 6px 0;
}
/* 按住 ⌘ / Ctrl 停在查得到定义的名字上:和编辑器里的链接一样 */
.cr-code [data-link] {
color: var(--vscode-editorLink-activeForeground);