Skip to content

Commit 4cd60e1

Browse files
Refine editor, auth, and git sidebar flows
1 parent 338de70 commit 4cd60e1

31 files changed

Lines changed: 582 additions & 439 deletions

src/features/athas-editor/components/inline-edit-model-selector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Button } from "@/ui/button";
1212
import Command, {
1313
CommandEmpty,
1414
CommandFooter,
15+
CommandFooterAction,
1516
CommandHeader,
1617
CommandInput,
1718
CommandItem,
@@ -243,14 +244,13 @@ export const InlineEditModelSelector = ({
243244
</CommandList>
244245
{providerNeedsApiKey && (
245246
<CommandFooter>
246-
<Button
247+
<CommandFooterAction
247248
type="button"
248-
variant="ghost"
249249
onClick={() => setIsApiKeyOpen(true)}
250250
className="px-1.5 text-text-lighter hover:text-text"
251251
>
252252
Add API key
253-
</Button>
253+
</CommandFooterAction>
254254
</CommandFooter>
255255
)}
256256
</>

src/features/command-palette/constants/git-actions.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
GitCommit,
88
HardDrives as Server,
99
Tag,
10-
TreeStructure,
1110
ArrowClockwise as RefreshCw,
1211
} from "@phosphor-icons/react";
1312
import type { GitRemoteActionResult } from "@/features/git/api/git-remotes-api";
@@ -107,14 +106,6 @@ export const createGitActions = (params: GitActionsParams): Action[] => {
107106
category: "Git",
108107
action: () => openGitAction({ type: "show-tab", tab: "history" }),
109108
},
110-
{
111-
id: "git-show-worktrees",
112-
label: "Git: Show Worktrees",
113-
description: "Open worktree manager",
114-
icon: <TreeStructure />,
115-
category: "Git",
116-
action: () => openGitAction({ type: "show-tab", tab: "worktrees" }),
117-
},
118109
{
119110
id: "git-manage-remotes",
120111
label: "Git: Manage Remotes",

src/features/database/components/database-sidebar.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import { extractDroppedFilePaths } from "@/features/file-system/utils/file-syste
1616
import { useUIState } from "@/features/window/stores/ui-state-store";
1717
import { Button } from "@/ui/button";
1818
import Checkbox from "@/ui/checkbox";
19-
import { CommandFooter, CommandInput, CommandItem, CommandList } from "@/ui/command";
19+
import {
20+
CommandFooter,
21+
CommandFooterAction,
22+
CommandInput,
23+
CommandItem,
24+
CommandList,
25+
} from "@/ui/command";
2026
import Input from "@/ui/input";
2127
import { LoadingIndicator } from "@/ui/loading";
2228
import {
@@ -613,17 +619,16 @@ export function DatabaseSidebar() {
613619

614620
{mode === "network-provider" ? (
615621
<CommandFooter>
616-
<Button
622+
<CommandFooterAction
617623
type="button"
618624
variant="default"
619-
compact
620-
className="w-full gap-1.5"
625+
className="w-full justify-center gap-1.5"
621626
disabled={busyConnectionId !== null}
622627
onClick={() => void saveNetworkConnection()}
623628
>
624629
<FilePlus />
625630
Add Database
626-
</Button>
631+
</CommandFooterAction>
627632
</CommandFooter>
628633
) : null}
629634

src/features/database/components/table-sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ export default function TableSidebar({
8181
variant="ghost"
8282
compact
8383
className={cn(
84-
"flex h-auto w-full items-start justify-start gap-1.5 rounded-lg px-2.5 py-1.5 text-left ui-text-xs hover:bg-hover",
84+
"flex h-auto w-full items-start justify-start gap-1.5 rounded-lg px-2.5 py-1.5 text-left ui-text-xs leading-[1.35] hover:bg-hover",
8585
selectedTable === t.name && "bg-selected text-text",
8686
)}
8787
aria-label={`Select ${group.kind} ${t.name}`}
8888
>
8989
<Icon className="mt-0.5 shrink-0" />
90-
<span className="flex min-w-0 flex-col items-start">
90+
<span className="flex min-w-0 flex-col items-start leading-[1.35]">
9191
<span className="max-w-full truncate">{t.name}</span>
9292
{owner && (
9393
<span className="max-w-full truncate text-text-lighter">on {owner}</span>

src/features/database/providers/mongodb/mongodb-viewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default function MongoDBViewer({ connectionId }: MongoDBViewerProps) {
9393
variant="ghost"
9494
compact
9595
className={cn(
96-
"block h-auto w-full justify-start rounded-lg px-2 py-1 text-left ui-text-xs",
96+
"block h-auto w-full justify-start rounded-lg px-2 py-1 text-left ui-text-xs leading-[1.35]",
9797
store.selectedCollection === col.name && "bg-selected",
9898
)}
9999
aria-label={`Select collection ${col.name}`}

src/features/database/providers/redis/redis-viewer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default function RedisViewer({ connectionId }: RedisViewerProps) {
145145
variant="ghost"
146146
onClick={() => actions.selectKey(keyInfo.key)}
147147
className={cn(
148-
"h-auto w-full justify-start gap-1.5 px-2 py-1",
148+
"h-auto w-full justify-start gap-1.5 px-2 py-1 leading-[1.35]",
149149
store.selectedKey === keyInfo.key && "bg-selected",
150150
)}
151151
aria-label={`Select key ${keyInfo.key}`}
@@ -158,7 +158,7 @@ export default function RedisViewer({ connectionId }: RedisViewerProps) {
158158
>
159159
{keyInfo.type.substring(0, 3)}
160160
</Badge>
161-
<span className="flex-1 truncate">{keyInfo.key}</span>
161+
<span className="flex-1 truncate leading-[1.35]">{keyInfo.key}</span>
162162
{keyInfo.ttl > 0 && (
163163
<span className="flex items-center gap-0.5 text-text-lighter">
164164
<Clock />

src/features/editor/components/monaco-editor.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,32 @@ function defineMonacoTheme(themeId: string): string {
206206
["comment", "comment"],
207207
["keyword", "keyword"],
208208
["string", "string"],
209+
["string.escape", "string"],
209210
["number", "number"],
211+
["number.float", "number"],
212+
["number.hex", "number"],
210213
["regexp", "regex"],
214+
["regexp.escape", "regex"],
215+
["regexp.escape.control", "regex"],
216+
["identifier", "variable"],
217+
["type.identifier", "type"],
211218
["function", "function"],
219+
["method", "function"],
212220
["variable", "variable"],
221+
["parameter", "variable"],
213222
["constant", "constant"],
223+
["enumMember", "constant"],
224+
["boolean", "boolean"],
225+
["keyword.other", "keyword"],
214226
["type", "type"],
227+
["typeParameter", "type"],
215228
["class", "type"],
229+
["enum", "type"],
216230
["interface", "type"],
217231
["namespace", "type"],
232+
["module", "type"],
233+
["property", "property"],
234+
["decorator", "attribute"],
218235
["tag", "tag"],
219236
["attribute.name", "attribute"],
220237
["delimiter", "punctuation"],
@@ -630,7 +647,8 @@ export function MonacoBackedEditor({
630647
cursorBlinking: vimModeEnabled && vimCurrentMode === "normal" ? "solid" : "blink",
631648
contextmenu: false,
632649
overviewRulerLanes: 0,
633-
fixedOverflowWidgets: true,
650+
fixedOverflowWidgets: false,
651+
"semanticHighlighting.enabled": true,
634652
scrollbar: {
635653
vertical: scrollable ? "auto" : "hidden",
636654
horizontal: scrollable ? "auto" : "hidden",
@@ -906,6 +924,7 @@ export function MonacoBackedEditor({
906924
parameterHints: { enabled: parameterHints },
907925
cursorStyle: vimModeEnabled && vimCurrentMode === "normal" ? "block" : "line",
908926
cursorBlinking: vimModeEnabled && vimCurrentMode === "normal" ? "solid" : "blink",
927+
"semanticHighlighting.enabled": true,
909928
scrollbar: {
910929
vertical: scrollable ? "auto" : "hidden",
911930
horizontal: scrollable ? "auto" : "hidden",

src/features/editor/monaco/language-contributions.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { languages } from "monaco-editor";
1+
import { languages, typescript } from "monaco-editor";
22

33
import "monaco-editor/esm/vs/basic-languages/cpp/cpp.contribution";
44
import "monaco-editor/esm/vs/basic-languages/css/css.contribution";
@@ -36,6 +36,20 @@ import "monaco-editor/esm/vs/language/html/monaco.contribution";
3636
import "monaco-editor/esm/vs/language/json/monaco.contribution";
3737
import "monaco-editor/esm/vs/language/typescript/monaco.contribution";
3838

39+
const jsxCompilerOptions = {
40+
jsx: typescript.JsxEmit.Preserve,
41+
} satisfies typescript.CompilerOptions;
42+
43+
typescript.typescriptDefaults.setCompilerOptions({
44+
...typescript.typescriptDefaults.getCompilerOptions(),
45+
...jsxCompilerOptions,
46+
});
47+
48+
typescript.javascriptDefaults.setCompilerOptions({
49+
...typescript.javascriptDefaults.getCompilerOptions(),
50+
...jsxCompilerOptions,
51+
});
52+
3953
function ensureLanguage(id: string, extensions: string[], aliases: string[], filenames?: string[]) {
4054
if (languages.getLanguages().some((language) => language.id === id)) return;
4155
languages.register({ id, extensions, aliases, filenames });

src/features/file-explorer/components/file-explorer-tree.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,15 +1248,14 @@ function FileExplorerTreeComponent({
12481248
? rowVirtualizer.getTotalSize() - items[items.length - 1].end
12491249
: 0;
12501250
const densityConfig = FILE_TREE_DENSITY_CONFIG[fileTreeDensity];
1251+
const stickyViewportStart =
1252+
(rowVirtualizer.scrollOffset ?? 0) +
1253+
FILE_TREE_HEADER_HEIGHT -
1254+
FILE_TREE_CONTAINER_INSET;
1255+
const stickyMarkerItem = items.find((item) => item.end > stickyViewportStart);
12511256
const stickyMarkerIndex =
1252-
items.length && visibleRows.length
1253-
? Math.min(
1254-
visibleRows.length - 1,
1255-
Math.max(
1256-
0,
1257-
Math.floor((rowVirtualizer.scrollOffset ?? 0) / densityConfig.rowHeight),
1258-
),
1259-
)
1257+
stickyMarkerItem && visibleRows.length
1258+
? Math.min(visibleRows.length - 1, Math.max(0, stickyMarkerItem.index))
12601259
: -1;
12611260
const stickyAncestors =
12621261
stickyMarkerIndex >= 0 ? getStickyAncestorRows(visibleRows, stickyMarkerIndex) : [];
@@ -1283,16 +1282,13 @@ function FileExplorerTreeComponent({
12831282
stickyAncestor.depth * settings.fileTreeIndentSize;
12841283

12851284
return (
1286-
<button
1285+
<div
12871286
key={stickyAncestor.file.path}
1288-
type="button"
1289-
data-file-path={stickyAncestor.file.path}
1290-
data-is-dir={stickyAncestor.file.isDir}
12911287
data-path={stickyAncestor.file.path}
12921288
data-depth={stickyAncestor.depth}
12931289
title={stickyAncestor.file.path}
12941290
className={cn(
1295-
"file-tree-row ui-font ui-text-sm flex w-full min-w-max cursor-pointer select-none items-center whitespace-nowrap rounded-none border-none bg-transparent text-left text-text outline-none transition-colors duration-150 hover:bg-hover focus:outline-none",
1291+
"file-tree-row ui-font ui-text-sm flex w-full min-w-max select-none items-center whitespace-nowrap rounded-none border-none bg-transparent text-left text-text outline-none",
12961292
densityConfig.rowClassName,
12971293
)}
12981294
style={{ paddingLeft: `${stickyAncestorPaddingLeft}px` }}
@@ -1312,7 +1308,7 @@ function FileExplorerTreeComponent({
13121308
>
13131309
{stickyAncestorLabel}
13141310
</span>
1315-
</button>
1311+
</div>
13161312
);
13171313
})}
13181314
</div>

src/features/file-explorer/styles/file-explorer-tree.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
overflow: hidden;
153153
background-color: var(--color-primary-bg);
154154
box-shadow: 0 -1px 0 0 var(--color-primary-bg);
155-
pointer-events: auto;
155+
pointer-events: none;
156156
}
157157

158158
.file-tree-sticky-ancestor-stack::after {

0 commit comments

Comments
 (0)