✨ feat(vscode): 代码阅读加「问 AI」,块下面问 Claude Code,问答存进 .spx 挂在块下

This commit is contained in:
cruldra committed 2026-09-26 21:12:47 +08:00
1 parent badc722640
commit fb53bb727c
34 files changed
+2726 -43

No files matched your search

+219 -2
View File
@@ -106,12 +106,13 @@ body:is(.vscode-light, .vscode-high-contrast-light) [data-badge] { --kind: var(-
outline-offset: -1px;
}
/* 层级竖线:悬停一个块时,它子层的竖线换成它的种类色,标出这个块管到哪里为止 */
/* 层级竖线:悬停一个块时,它子层的竖线换成它的种类色,标出这个块管到哪里为止(块和子层中间隔着问答区也算) */
.cr-guide {
background: var(--vscode-editorIndentGuide-background1);
transition: background-color 100ms ease-out;
}
.cr-block:hover + .cr-level > * > .cr-guide {
.cr-block:hover + .cr-level > * > .cr-guide,
.cr-block:hover + .cr-qa + .cr-level > * > .cr-guide {
background: var(--kind);
}
@@ -485,3 +486,219 @@ body:is(.vscode-light, .vscode-high-contrast-light) [data-badge] { --kind: var(-
color: var(--vscode-descriptionForeground);
background: color-mix(in srgb, var(--vscode-focusBorder) 15%, transparent);
}
/* 问 AI:块下面的问答区,左边一条链接色竖线;问过的灰字,当前这一轮照常颜色 */
.cr-qa {
--qa-accent: var(--vscode-textLink-foreground);
--qa-dim: color-mix(in srgb, var(--vscode-descriptionForeground) 75%, transparent);
display: flex;
flex-direction: column;
gap: 8px;
padding: 6px 10px 6px 12px;
border-left: 2px solid color-mix(in srgb, var(--qa-accent) 50%, transparent);
font-family: var(--vscode-font-family, system-ui, sans-serif), "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
font-size: 12.5px;
line-height: 18px;
}
.cr-qa[data-collapsed] {
gap: 6px;
padding-top: 2px;
padding-bottom: 2px;
}
.cr-qa-entry {
display: flex;
flex-direction: column;
gap: 2px;
}
.cr-qa-head {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.cr-qa-icon {
flex-shrink: 0;
color: var(--qa-dim);
}
.cr-qa-entry[data-current] .cr-qa-icon {
color: var(--qa-accent);
}
.cr-qa-question {
min-width: 0;
flex: 1;
text-align: left;
}
.cr-qa-entry[data-history] .cr-qa-question {
overflow: hidden;
color: var(--vscode-descriptionForeground);
text-overflow: ellipsis;
white-space: nowrap;
}
.cr-qa-entry[data-current] .cr-qa-question {
color: var(--vscode-foreground);
font-weight: 500;
}
.cr-qa-when {
flex-shrink: 0;
color: var(--qa-dim);
font-size: 11px;
line-height: 16px;
}
.cr-qa-delete {
display: flex;
width: 22px;
height: 18px;
flex-shrink: 0;
align-items: center;
justify-content: center;
border-radius: 4px;
color: var(--qa-dim);
}
.cr-qa-delete:hover {
color: var(--vscode-foreground);
}
/* 回答的前两行,和回答正文一样往右缩到问题下面 */
.cr-qa-preview {
display: -webkit-box;
overflow: hidden;
padding-left: 18px;
color: var(--qa-dim);
font-size: 12px;
line-height: 18px;
text-align: left;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.cr-qa-answer {
padding-left: 18px;
font-size: 12.5px;
}
.cr-qa .cr-markdown.cr-qa-answer {
color: var(--vscode-foreground);
}
.cr-qa .cr-qa-entry[data-history] .cr-markdown.cr-qa-answer {
color: var(--vscode-descriptionForeground);
}
/* 回答还在长:最后一段末尾一个闪的光标 */
.cr-qa-answer[data-streaming] > :last-child::after {
content: "▍";
margin-left: 1px;
color: var(--qa-accent);
animation: cr-qa-blink 1s steps(1) infinite;
}
@keyframes cr-qa-blink {
50% { opacity: 0; }
}
.cr-qa-status {
display: flex;
align-items: center;
gap: 6px;
padding-left: 18px;
color: var(--vscode-descriptionForeground);
font-size: 11.5px;
}
.cr-qa-spin {
animation: cr-qa-spin 900ms linear infinite;
}
@keyframes cr-qa-spin {
to { transform: rotate(360deg); }
}
.cr-qa-error {
display: flex;
gap: 6px;
margin-left: 18px;
padding: 4px 8px;
border: 1px solid var(--vscode-inputValidation-errorBorder);
border-radius: 4px;
background: var(--vscode-inputValidation-errorBackground);
color: var(--vscode-foreground);
font-size: 12px;
}
.cr-qa-error > svg {
color: var(--vscode-errorForeground);
}
.cr-qa-divider {
border: 0;
border-top: 1px solid color-mix(in srgb, var(--vscode-foreground) 12%, transparent);
}
.cr-qa-input {
display: flex;
align-items: flex-end;
gap: 6px;
padding: 4px 4px 4px 8px;
border: 1px solid var(--vscode-input-border, color-mix(in srgb, var(--vscode-foreground) 20%, transparent));
border-radius: 4px;
background: var(--vscode-input-background);
}
.cr-qa-input:focus-within {
border-color: var(--vscode-focusBorder);
}
.cr-qa-input textarea {
min-width: 0;
max-height: 160px;
flex: 1;
padding: 1px 0;
border: 0;
outline: none;
background: transparent;
color: var(--vscode-input-foreground);
font: inherit;
resize: none;
field-sizing: content;
}
.cr-qa-input textarea::placeholder {
color: var(--vscode-input-placeholderForeground);
}
.cr-qa-input .cr-tool {
display: flex;
width: 24px;
height: 20px;
flex-shrink: 0;
align-items: center;
justify-content: center;
border-radius: 4px;
}
.cr-qa-input .cr-tool:disabled {
opacity: 0.4;
}
.cr-qa-summary {
display: inline-flex;
width: fit-content;
align-items: center;
gap: 4px;
color: var(--vscode-descriptionForeground);
font-size: 12px;
}
.cr-qa-summary:hover {
color: var(--vscode-foreground);
}
.cr-qa-summary:focus-visible,
.cr-qa-question:focus-visible,
.cr-qa-preview:focus-visible {
outline: 1px solid var(--vscode-focusBorder);
outline-offset: 1px;
border-radius: 2px;
}
/* 预览顶上:找不到原来位置的问答 */
.cr-qa-orphans {
display: flex;
flex-direction: column;
gap: 6px;
margin-bottom: 12px;
padding: 6px 10px;
border: 1px dashed color-mix(in srgb, var(--vscode-descriptionForeground) 40%, transparent);
border-radius: 6px;
}
.cr-qa-orphans .cr-qa {
--qa-accent: var(--vscode-descriptionForeground);
}
.cr-qa-where {
color: var(--vscode-descriptionForeground);
font-size: 11.5px;
}
@media (prefers-reduced-motion: reduce) {
.cr-qa-spin,
.cr-qa-answer[data-streaming] > :last-child::after {
animation: none;
}
}