From ec72800b00520b098151755857e0bc0144f9274e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 11 May 2025 12:10:28 +0300 Subject: [PATCH] chore(code): reintroduce highlight active line & selection --- packages/codemirror/package.json | 1 + packages/codemirror/src/index.ts | 5 +++- pnpm-lock.yaml | 40 +++++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index fdf431927..f56d2affe 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -21,6 +21,7 @@ "dependencies": { "@codemirror/commands": "6.8.1", "@codemirror/legacy-modes": "6.5.1", + "@codemirror/search": "6.5.10", "@codemirror/view": "6.36.7", "codemirror-lang-hcl": "0.1.0" } diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts index a56829a1e..1e821c535 100644 --- a/packages/codemirror/src/index.ts +++ b/packages/codemirror/src/index.ts @@ -1,7 +1,8 @@ import { defaultKeymap, indentWithTab } from "@codemirror/commands"; -import { EditorView, keymap, lineNumbers, placeholder, ViewUpdate, type EditorViewConfig } from "@codemirror/view"; +import { EditorView, highlightActiveLine, keymap, lineNumbers, placeholder, ViewUpdate, type EditorViewConfig } from "@codemirror/view"; import { defaultHighlightStyle, StreamLanguage, syntaxHighlighting, indentUnit } from "@codemirror/language"; import { Compartment } from "@codemirror/state"; +import { highlightSelectionMatches } from "@codemirror/search"; import byMimeType from "./syntax_highlighting.js"; type ContentChangedListener = () => void; @@ -26,6 +27,8 @@ export default class CodeMirror extends EditorView { ]), languageCompartment.of([]), syntaxHighlighting(defaultHighlightStyle), + highlightActiveLine(), + highlightSelectionMatches(), lineNumbers(), indentUnit.of(" ".repeat(4)) ]; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8fc0ba49c..5fcec2fed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1160,6 +1160,9 @@ importers: '@codemirror/legacy-modes': specifier: 6.5.1 version: 6.5.1 + '@codemirror/search': + specifier: 6.5.10 + version: 6.5.10 '@codemirror/view': specifier: 6.36.7 version: 6.36.7 @@ -2160,6 +2163,9 @@ packages: '@codemirror/legacy-modes@6.5.1': resolution: {integrity: sha512-DJYQQ00N1/KdESpZV7jg9hafof/iBNp9h7TYo1SLMk86TWl9uDsVdho2dzd81K+v4retmK6mdC7WpuOQDytQqw==} + '@codemirror/search@6.5.10': + resolution: {integrity: sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg==} + '@codemirror/state@6.5.2': resolution: {integrity: sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==} @@ -6593,6 +6599,9 @@ packages: create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + crelt@1.0.6: + resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==} + cross-dirname@0.1.0: resolution: {integrity: sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==} @@ -15020,6 +15029,15 @@ snapshots: - supports-color - utf-8-validate + '@ckeditor/ckeditor5-autoformat@45.0.0': + dependencies: + '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-engine': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-heading': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-typing': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-utils': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) + '@ckeditor/ckeditor5-autoformat@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -15666,6 +15684,14 @@ snapshots: - supports-color - utf-8-validate + '@ckeditor/ckeditor5-highlight@45.0.0': + dependencies: + '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-icons': 45.0.0 + '@ckeditor/ckeditor5-ui': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-utils': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ckeditor5: 45.0.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) + '@ckeditor/ckeditor5-highlight@45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)': dependencies: '@ckeditor/ckeditor5-core': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -16261,7 +16287,7 @@ snapshots: '@ckeditor/ckeditor5-find-and-replace': 45.0.0 '@ckeditor/ckeditor5-font': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-heading': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-highlight': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-highlight': 45.0.0 '@ckeditor/ckeditor5-icons': 45.0.0 '@ckeditor/ckeditor5-image': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-link': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) @@ -16404,6 +16430,12 @@ snapshots: dependencies: '@codemirror/language': 6.11.0 + '@codemirror/search@6.5.10': + dependencies: + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.36.7 + crelt: 1.0.6 + '@codemirror/state@6.5.2': dependencies: '@marijn/find-cluster-break': 1.0.2 @@ -21577,7 +21609,7 @@ snapshots: dependencies: '@ckeditor/ckeditor5-adapter-ckfinder': 45.0.0 '@ckeditor/ckeditor5-alignment': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-autoformat': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-autoformat': 45.0.0 '@ckeditor/ckeditor5-autosave': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-basic-styles': 45.0.0 '@ckeditor/ckeditor5-block-quote': 45.0.0 @@ -21602,7 +21634,7 @@ snapshots: '@ckeditor/ckeditor5-font': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-fullscreen': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) '@ckeditor/ckeditor5-heading': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) - '@ckeditor/ckeditor5-highlight': 45.0.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ckeditor/ckeditor5-highlight': 45.0.0 '@ckeditor/ckeditor5-horizontal-line': 45.0.0 '@ckeditor/ckeditor5-html-embed': 45.0.0 '@ckeditor/ckeditor5-html-support': 45.0.0 @@ -22024,6 +22056,8 @@ snapshots: create-require@1.1.1: {} + crelt@1.0.6: {} + cross-dirname@0.1.0: {} cross-env@7.0.3: