Файли
openidea/src/editor/core/index.ts
T
l0ng-ai 1e00ea5ee2 feat: Third pass aligning core experience with IntelliJ IDEA
Project & files
- Project view modes (Project Files / Open Files / All Changed Files /
  Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go,
  Maven/Gradle jars; read-only jar/zip browsing
- ⌘N New popup with type search and more file kinds; New Project, Rename
  Project, Reload All from Disk, Export/Import Settings, Power Save Mode
- File type associations, extra content roots and exclude patterns (indexed
  and watched without reopening the project)

Editor & navigation
- Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline,
  history; Find in Files: Module scope, custom pattern scopes, multiline
- Search Everywhere filters, Assign Shortcut, settings results; named bookmark
  lists, file/folder bookmarks; Structure filters and Show Inherited; Recent
  Locations timestamps and breadcrumbs; Code Vision author
- Completion options, editor tab placement/layout, inline completion (LSP 3.18)
- Spell checking (Typo inspection, ide-spell) and Inspections settings with
  custom profiles; Code Style schemes, formatter markers, Do not format

Run, VCS, services, database
- Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker,
  Compound), Modify options, Before launch, env dialog, Current File,
  Emulate terminal (PTY)
- Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the
  graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees
- Generic Services host (Docker connections/registries, run sessions); TODO
  scope/changes tabs with changelists; Coverage report import
- Data sources: wire-compatible vendors, URL import, SSL certs, Options,
  Schemas and Advanced tabs, color and comment

Workbench
- Run Anything, Customize Main Toolbar, named tool window layouts, menu
  completeness, Code Cleanup, macros, "Don't Show Again", editor banners
- Chinese translations for the new UI

Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
2026-10-25 21:24:00 +08:00

112 рядки
3.5 KiB
TypeScript

/**
* editor/core: the text editor (CodeMirror 6), document sync with the Rust
* backend, tabs and splits, find/replace, navigation history and the editor
* status bar widgets. See editor/api.ts for the extension contract.
*/
import {
provideEditorArea,
provideEditorService,
registerEditorBanner,
registerOverlay,
registerStatusItem,
} from "@/workbench/contributions";
import { _provideCodePreview, _provideDocumentAttacher, editorsFor } from "@/editor/api";
import { formatDocument } from "@/editor/lsp/format";
import { editorController } from "./controller";
import { attachDocument } from "./model/attachment";
import { previewExtensions } from "./cm/preview";
import { registerEditorActions } from "./actions";
import { installColorScheme } from "./colorSchemeRuntime";
import { documentBanner } from "./view/Banner";
import { EditorAreaView } from "./view/EditorArea";
import { GotoLineDialog } from "./view/GotoLineDialog";
import { NavBarPopup } from "./view/NavBarPopup";
import { installClipboardTracking } from "./clipboardHistory";
import {
Breadcrumbs,
CaretStatus,
EncodingStatus,
IndentStatus,
LineEndingStatus,
ReadOnlyStatus,
} from "./view/StatusItems";
export function activate(): void | (() => void) {
const ctrl = editorController();
ctrl.start();
provideEditorService({
openFile: (path, options) => ctrl.openFile(path, options),
openInput: (input, options) => ctrl.openInput(input, options),
activePath: () => ctrl.activePath(),
activeCursor: () => ctrl.activeCursor(),
saveAll: () => ctrl.saveAll(),
focus: () => ctrl.focus(),
openPaths: () => ctrl.openPaths(),
closePath: (path) => ctrl.closePath(path),
closeInput: (key) => ctrl.closeInput(key),
reformat: async (path) => {
const handle = editorsFor(path)[0];
return !!handle && (await formatDocument(handle.view, { explicit: false, selectionOnly: false })).applied;
},
});
_provideDocumentAttacher((path) => attachDocument(ctrl.manager, path));
_provideCodePreview((path) => previewExtensions(path, ctrl.manager.settings()?.editor));
const disposers = [
installColorScheme(),
provideEditorArea(EditorAreaView),
registerEditorActions(),
registerEditorBanner(documentBanner),
registerOverlay({ id: "editor.gotoLine", component: GotoLineDialog }),
registerOverlay({ id: "editor.navigationBar", component: NavBarPopup }),
installClipboardTracking(),
registerStatusItem({
id: "editor.breadcrumbs",
align: "left",
priority: 0,
component: Breadcrumbs,
title: "Navigation Bar",
}),
registerStatusItem({
id: "editor.caret",
align: "right",
priority: 20,
component: CaretStatus,
title: "Line:Column Number",
}),
registerStatusItem({
id: "editor.lineEnding",
align: "right",
priority: 30,
component: LineEndingStatus,
title: "Line Separator",
}),
registerStatusItem({
id: "editor.encoding",
align: "right",
priority: 40,
component: EncodingStatus,
title: "File Encoding",
}),
registerStatusItem({
id: "editor.indent",
align: "right",
priority: 50,
component: IndentStatus,
title: "Indentation",
}),
registerStatusItem({
id: "editor.readOnly",
align: "right",
priority: 55,
component: ReadOnlyStatus,
title: "Read-only Attribute",
}),
];
return () => {
disposers.reverse().forEach((d) => d());
_provideDocumentAttacher(null);
_provideCodePreview(null);
ctrl.stop();
};
}