Skip to content

Commit 130c2f3

Browse files
authored
feat: support indentation markers (#1119)
1 parent 64299d2 commit 130c2f3

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

packages/shared/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@codemirror/search": "^6.5.11",
2929
"@fsegurai/codemirror-theme-vscode-dark": "^6.2.2",
3030
"@fsegurai/codemirror-theme-vscode-light": "^6.2.2",
31+
"@replit/codemirror-indentation-markers": "^6.5.3",
3132
"axios": "^1.12.2",
3233
"csstype": "^3.1.3",
3334
"es-toolkit": "^1.40.0",

packages/shared/src/editor/basicSetup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { lintKeymap } from '@codemirror/lint'
66
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search'
77
import { EditorState } from '@codemirror/state'
88
import { crosshairCursor, drawSelection, dropCursor, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, keymap, rectangularSelection } from '@codemirror/view'
9+
import { indentationMarkers } from '@replit/codemirror-indentation-markers'
910

1011
// (The superfluous function calls around the list of extensions work
1112
// around current limitations in tree-shaking software.)
@@ -63,6 +64,7 @@ export const basicSetup: Extension = (() => [
6364
crosshairCursor(),
6465
highlightActiveLine(),
6566
highlightSelectionMatches(),
67+
indentationMarkers(), // 添加缩进标记
6668
keymap.of([
6769
...closeBracketsKeymap,
6870
...defaultKeymap,

packages/shared/src/editor/markdown.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { languages } from '@codemirror/language-data'
55
import { highlightSelectionMatches } from '@codemirror/search'
66
import { EditorState, Prec } from '@codemirror/state'
77
import { EditorView, keymap, placeholder } from '@codemirror/view'
8+
import { indentationMarkers } from '@replit/codemirror-indentation-markers'
89
import { formatDoc } from '../utils/fileHelpers'
910
import { applyHeading, formatBold, formatCode, formatItalic, formatLink, formatOrderedList, formatStrikethrough, formatUnorderedList, redoAction, undoAction } from './format'
1011

@@ -86,6 +87,9 @@ export function markdownSetup(options?: MarkdownKeymapOptions) {
8687
highlightSelectionMatches(),
8788
closeBrackets(),
8889

90+
// 缩进标记
91+
indentationMarkers(),
92+
8993
// 语言支持
9094
markdown({
9195
base: markdownLanguage,

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)