Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 9f9df698c2 fix(editor): keep the run gutter from loading the editor preferences
runGutter, which the Language smoke loads, imported gutterIconsOn from cm/prefs, pulling about
40 editor modules into the smoke's inputs and failing scripts/smoke-paths.test.ts. The gutter icon
groups and the per-editor appearance override (gutterIconsOn, localAppearanceField,
setLocalAppearance) move to cm/localAppearance, which prefs re-exports; the gutter providers
import it directly, and the smoke's paths list the new file.
2026-11-30 10:51:18 +08:00
8 змінених файлів з 71 додано та 53 видалено

No files matched your search

+2 -1
Переглянути файл
@@ -34,6 +34,7 @@ on:
- "src/editor/relatedProviders.ts"
- "src/editor/core/cm/cornerInset.ts"
- "src/editor/core/cm/iconArea.ts"
- "src/editor/core/cm/localAppearance.ts"
- "src/editor/lsp/availability.ts"
- "src/editor/lsp/diagnostics.ts"
- "src/editor/lsp/files.ts"
@@ -108,7 +109,7 @@ jobs:
# ide-lsp/dap/run/sdk/tools.
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/'
# The workflow's paths, less those handled per language below.
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|refactorProviders|relatedProviders|core/cm/(cornerInset|iconArea)|lsp/(availability|diagnostics|files|hint|lsp|positions|snippet))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|refactorProviders|relatedProviders|core/cm/(cornerInset|iconArea|localAppearance)|lsp/(availability|diagnostics|files|hint|lsp|positions|snippet))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
langs=""
while read -r f; do
case "$f" in
+53
Переглянути файл
@@ -0,0 +1,53 @@
/**
* Gutter icon groups and an editor's local appearance overrides, apart from the editor
* preferences so gutter providers can read them without loading the editor setup.
*/
import { StateEffect, StateField, type EditorState } from "@codemirror/state";
import { editorPrefs, type EditorExtras } from "@/platform/editorSettings";
/**
* Gutter icon groups of Settings › Editor › General › Gutter Icons. A hidden group sets
* `cm-openidea-hideGutter-<id>` on the editor (the theme hides the bookmark, color and
* script/compose run columns by it); the icon area's run and inheritance icons read the
* setting themselves.
*/
export const GUTTER_ICON_GROUPS = [
{ id: "run" },
{ id: "bookmarks" },
{ id: "inheritors" },
{ id: "supers" },
{ id: "colors" },
] as const;
export type GutterIconGroup = (typeof GUTTER_ICON_GROUPS)[number]["id"];
/** The four IDEA decoration switches that can be overridden on one editor. */
export interface EffectiveAppearance {
lineNumbers: boolean;
whitespaces: boolean;
gutterIcons: boolean;
indentGuides: boolean;
}
export type LocalAppearanceKey = keyof EffectiveAppearance;
export type LocalAppearanceOverride = Partial<EffectiveAppearance>;
/** Per-editor decoration overrides live in EditorState, outside the reconfigurable compartments. */
export const setLocalAppearance = StateEffect.define<LocalAppearanceOverride | null>();
export const localAppearanceField = StateField.define<LocalAppearanceOverride | null>({
create: () => null,
update(value, tr) {
for (const effect of tr.effects) if (effect.is(setLocalAppearance)) value = effect.value;
return value;
},
});
/** Gutter providers use the editor's effective value, including a local override. */
export function gutterIconsOn(
state: EditorState | undefined,
group?: GutterIconGroup,
prefs: Pick<EditorExtras, "showGutterIcons" | "gutterIconsDisabled"> = editorPrefs(),
): boolean {
const local = state?.field(localAppearanceField, false)?.gutterIcons;
return (local ?? prefs.showGutterIcons) && (!group || !prefs.gutterIconsDisabled.includes(group));
}
+11 -47
Переглянути файл
@@ -72,6 +72,17 @@ import { LINE_INSET } from "./lineInset";
import { codeLensPositions } from "./codeLens";
import { stickyMove } from "./stickySelection";
import { wheelZoomStep } from "@/platform/wheelZoom";
export {
GUTTER_ICON_GROUPS,
gutterIconsOn,
localAppearanceField,
setLocalAppearance,
type EffectiveAppearance,
type GutterIconGroup,
type LocalAppearanceKey,
type LocalAppearanceOverride,
} from "./localAppearance";
import { GUTTER_ICON_GROUPS, type EffectiveAppearance, type LocalAppearanceOverride } from "./localAppearance";
// --- soft wraps ---------------------------------------------------------------
@@ -586,22 +597,6 @@ const noSurround = EditorView.inputHandler.of((view, from, to, text) => {
return true;
});
/**
* Gutter icon groups of Settings › Editor › General › Gutter Icons. A hidden group sets
* `cm-openidea-hideGutter-<id>` on the editor (the theme hides the bookmark, color and
* script/compose run columns by it); the icon area's run and inheritance icons read the
* setting themselves.
*/
export const GUTTER_ICON_GROUPS = [
{ id: "run" },
{ id: "bookmarks" },
{ id: "inheritors" },
{ id: "supers" },
{ id: "colors" },
] as const;
export type GutterIconGroup = (typeof GUTTER_ICON_GROUPS)[number]["id"];
/**
* Languages whose outer parser is `@lezer/html`, plus JSX / TSX, where
* simultaneous `<tag></tag>` editing works from the syntax tree. Angular
@@ -619,37 +614,6 @@ const LINKED_TAG_LANGUAGES = new Set([
"javascriptreact",
]);
/** The four IDEA decoration switches that can be overridden on one editor. */
export interface EffectiveAppearance {
lineNumbers: boolean;
whitespaces: boolean;
gutterIcons: boolean;
indentGuides: boolean;
}
export type LocalAppearanceKey = keyof EffectiveAppearance;
export type LocalAppearanceOverride = Partial<EffectiveAppearance>;
/** Per-editor decoration overrides live in EditorState, outside the reconfigurable compartments. */
export const setLocalAppearance = StateEffect.define<LocalAppearanceOverride | null>();
export const localAppearanceField = StateField.define<LocalAppearanceOverride | null>({
create: () => null,
update(value, tr) {
for (const effect of tr.effects) if (effect.is(setLocalAppearance)) value = effect.value;
return value;
},
});
/** Gutter providers use the editor's effective value, including a local override. */
export function gutterIconsOn(
state: EditorState | undefined,
group?: GutterIconGroup,
prefs: Pick<EditorExtras, "showGutterIcons" | "gutterIconsDisabled"> = editorPrefs(),
): boolean {
const local = state?.field(localAppearanceField, false)?.gutterIcons;
return (local ?? prefs.showGutterIcons) && (!group || !prefs.gutterIconsDisabled.includes(group));
}
/** Editor settings values after applying this editor's optional local overrides. */
export function effectiveAppearance(
prefs: EditorExtras,
+1 -1
Переглянути файл
@@ -18,7 +18,7 @@
import { RangeSet, StateEffect, StateField, type EditorState, type Extension, type Text } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart } from "@/editor/core/cm/iconArea";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/prefs";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { isLibrarySource, shownAgain, type EditorDocContext } from "@/editor/api";
import { docOf, debounce, isUnavailable, lspRequest } from "@/editor/lsp/lsp";
import { featureBackoff, onServerSettled } from "@/editor/lsp/availability";
+1 -1
Переглянути файл
@@ -15,7 +15,7 @@ import {
} from "@/editor/api";
import { onServerSettled } from "@/editor/lsp/availability";
import { comparePos } from "@/editor/lsp/positions";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/prefs";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { editorPrefs } from "@/platform/editorSettings";
import { call, commands, type DocumentColor } from "@/platform/ipc";
import { useProject } from "@/platform/project";
+1 -1
Переглянути файл
@@ -7,7 +7,7 @@
import { RangeSet, StateEffect, StateField, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, rangeToOffsets, registerEditorContribution } from "@/editor/api";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/prefs";
import { gutterIconsOn, localAppearanceField } from "@/editor/core/cm/localAppearance";
import { useProject } from "@/platform/project";
import type { FileMarkers, IndexedMarker, Location } from "@/platform/ipc";
import { markerIcon } from "./lineMarkerGutter";
+1 -1
Переглянути файл
@@ -7,7 +7,7 @@
import { RangeSet, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart, type EditorDocContext } from "@/editor/api";
import { gutterIconsOn } from "@/editor/core/cm/prefs";
import { gutterIconsOn } from "@/editor/core/cm/localAppearance";
import { useProject } from "@/platform/project";
import { isVirtualUri } from "@/platform/virtualDocs";
import { shortcutLabel } from "@/platform/keymap";
+1 -1
Переглянути файл
@@ -6,7 +6,7 @@
import { RangeSet, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import { iconAreaSource, mapLineStart, type EditorDocContext } from "@/editor/api";
import { gutterIconsOn } from "@/editor/core/cm/prefs";
import { gutterIconsOn } from "@/editor/core/cm/localAppearance";
import { executeAction } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { gutterIconMarkup, showContextMenu, type MenuItem } from "@/ui";