@@ -38,7 +38,7 @@ import { languages } from '@codemirror/language-data';
38
38
import { markdown } from '@codemirror/lang-markdown' ;
39
39
import { highlightNewlines } from 'codecrafters-frontend/utils/code-mirror-highlight-newlines' ;
40
40
import { collapseUnchangedGutter } from 'codecrafters-frontend/utils/code-mirror-collapse-unchanged-gutter' ;
41
- import { lineComments } from 'codecrafters-frontend/utils/code-mirror-line-comments' ;
41
+ import { lineComments , type LineCommentsCollection } from 'codecrafters-frontend/utils/code-mirror-line-comments' ;
42
42
43
43
function generateHTMLElement ( src : string ) : HTMLElement {
44
44
const div = document . createElement ( 'div' ) ;
@@ -54,7 +54,7 @@ enum FoldGutterIcon {
54
54
55
55
type DocumentUpdateCallback = ( newValue : string ) => void ;
56
56
57
- type Argument = boolean | string | number | undefined | Extension | DocumentUpdateCallback ;
57
+ type Argument = boolean | string | number | undefined | Extension | DocumentUpdateCallback | LineCommentsCollection ;
58
58
59
59
type OptionHandler = ( args : Signature [ 'Args' ] [ 'Named' ] ) => Extension [ ] | Promise < Extension [ ] > ;
60
60
@@ -77,7 +77,7 @@ const OPTION_HANDLERS: { [key: string]: OptionHandler } = {
77
77
indentOnInput : ( { indentOnInput : enabled } ) => ( enabled ? [ indentOnInput ( ) ] : [ ] ) ,
78
78
indentUnit : ( { indentUnit : indentUnitText } ) => ( indentUnitText !== undefined ? [ indentUnit . of ( indentUnitText ) ] : [ ] ) ,
79
79
indentWithTab : ( { indentWithTab : enabled } ) => ( enabled ? [ keymap . of ( [ indentWithTab ] ) ] : [ ] ) ,
80
- lineComments : ( { lineComments : enabled } ) => ( enabled ? [ lineComments ( ) ] : [ ] ) ,
80
+ lineCommentsOrComments : ( { comments = [ ] , lineComments : enabled } ) => ( enabled ? [ lineComments ( comments ) ] : [ ] ) ,
81
81
lineNumbers : ( { lineNumbers : enabled } ) => ( enabled ? [ lineNumbers ( ) ] : [ ] ) ,
82
82
foldGutter : ( { foldGutter : enabled } ) =>
83
83
enabled
@@ -202,6 +202,10 @@ export interface Signature {
202
202
* Enable highlighting of matching brackets
203
203
*/
204
204
bracketMatching ?: boolean ;
205
+ /**
206
+ * Comments to show for each line in the editor, if `lineComments` are enabled
207
+ */
208
+ comments ?: LineCommentsCollection ;
205
209
/**
206
210
* Automatically close brackets when typing
207
211
*/
0 commit comments