Make Git a native feature with an off switch
- Add the native feature runtime in src/lib/features/: the catalog, the switches, the first-start migration, the loader, and the feature sessions. - Add Settings → Features and the features settings section. - Add features_legacy. It reads the old plugin packages and changes nothing. - Move Git from the plugin into src/lib/features/git/, on host internals. - Remove api.git, the git contribution key, and the SDK Git types. - Add pnpm check:features. It fails when a feature module loads at start. - Update the tests, the menu inventory, the docs, and UI-055.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { t } from "$lib/i18n";
|
||||
import TerminalSlot from "$lib/plugins/TerminalSlot.svelte";
|
||||
import type PluginEditor from "$lib/plugins/PluginEditor.svelte";
|
||||
import { featureOfOwner } from "$lib/features/catalog";
|
||||
import { pluginSplits, pinPluginEditor, pluginTabActions, pluginTabState, restorePluginTab, pluginTabDragData, dropPluginTab, waitForPluginStartup, pluginTools, installedPlugins, runPluginCommand } from "$lib/plugins/external";
|
||||
import { containsPane, paneBounds } from "$lib/workspace/splitLayout";
|
||||
import { pluginSidebar, closePluginSidebar, pluginNavigation, openPluginView, pluginView, pluginEditors, pluginEditorActive, selectPluginEditor, closePluginEditor, openPluginDocument, renamePluginDocuments, removePluginDocuments, notifyPluginWorkspace, guardPluginWrites, handlePluginFileOpen, handlePluginDocumentRename, cancelPluginDocumentOpen, type OpenPluginView } from "$lib/plugins/external";
|
||||
@@ -152,14 +153,19 @@
|
||||
const reading = $derived(activeDocumentPane?.reading ?? false);
|
||||
let quickOpen = $state(false);
|
||||
let palette = $state(false);
|
||||
/** The commands of the palette: the app commands that apply here, then the plugin commands. */
|
||||
/** The name of a native feature, or of an installed plugin. */
|
||||
function ownerName(owner: string) {
|
||||
const feature = featureOfOwner(owner);
|
||||
return feature ? $t(feature.name) : $installedPlugins.plugins.find(row => row.manifest.id === owner)?.manifest.name ?? owner;
|
||||
}
|
||||
/** The commands of the palette: the app commands that apply here, then the feature and plugin commands. */
|
||||
function paletteCommands(): PaletteCommand[] {
|
||||
const hidden = new Set<WorkbenchCommand>(["command-palette", ...(terminalEnabled ? [] : ["toggle-terminal" as const]), ...(workspace ? [] : ["quick-open" as const])]);
|
||||
const app = (Object.keys(COMMAND_LABELS) as WorkbenchCommand[]).filter(command => !hidden.has(command)).map(command => ({
|
||||
id: command, label: $t(COMMAND_LABELS[command]), shortcut: commandShortcut(command) || undefined, run: () => { runCommand(command); },
|
||||
}));
|
||||
const plugins = $pluginTools.filter(tool => tool.kind === "command" && tool.surface === "commands").map(tool => ({
|
||||
id: `plugin:${tool.owner}:${tool.id}`, label: tool.title, detail: $installedPlugins.plugins.find(row => row.manifest.id === tool.owner)?.manifest.name ?? tool.owner,
|
||||
id: `plugin:${tool.owner}:${tool.id}`, label: tool.title, detail: ownerName(tool.owner),
|
||||
run: () => { void runPluginCommand(tool.owner, tool.id).catch(reason => error = String(reason)); },
|
||||
}));
|
||||
return [...app, ...plugins];
|
||||
|
||||
Reference in New Issue
Block a user