@@ -38,7 +38,7 @@ import { languages } from '@codemirror/language-data';
3838import { markdown } from '@codemirror/lang-markdown' ;
3939import { highlightNewlines } from 'codecrafters-frontend/utils/code-mirror-highlight-newlines' ;
4040import { 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' ;
4242
4343function generateHTMLElement ( src : string ) : HTMLElement {
4444 const div = document . createElement ( 'div' ) ;
@@ -54,7 +54,7 @@ enum FoldGutterIcon {
5454
5555type DocumentUpdateCallback = ( newValue : string ) => void ;
5656
57- type Argument = boolean | string | number | undefined | Extension | DocumentUpdateCallback ;
57+ type Argument = boolean | string | number | undefined | Extension | DocumentUpdateCallback | LineCommentsCollection ;
5858
5959type OptionHandler = ( args : Signature [ 'Args' ] [ 'Named' ] ) => Extension [ ] | Promise < Extension [ ] > ;
6060
@@ -77,7 +77,7 @@ const OPTION_HANDLERS: { [key: string]: OptionHandler } = {
7777 indentOnInput : ( { indentOnInput : enabled } ) => ( enabled ? [ indentOnInput ( ) ] : [ ] ) ,
7878 indentUnit : ( { indentUnit : indentUnitText } ) => ( indentUnitText !== undefined ? [ indentUnit . of ( indentUnitText ) ] : [ ] ) ,
7979 indentWithTab : ( { indentWithTab : enabled } ) => ( enabled ? [ keymap . of ( [ indentWithTab ] ) ] : [ ] ) ,
80- lineComments : ( { lineComments : enabled } ) => ( enabled ? [ lineComments ( ) ] : [ ] ) ,
80+ lineCommentsOrComments : ( { comments = [ ] , lineComments : enabled } ) => ( enabled ? [ lineComments ( comments ) ] : [ ] ) ,
8181 lineNumbers : ( { lineNumbers : enabled } ) => ( enabled ? [ lineNumbers ( ) ] : [ ] ) ,
8282 foldGutter : ( { foldGutter : enabled } ) =>
8383 enabled
@@ -202,6 +202,10 @@ export interface Signature {
202202 * Enable highlighting of matching brackets
203203 */
204204 bracketMatching ?: boolean ;
205+ /**
206+ * Comments to show for each line in the editor, if `lineComments` are enabled
207+ */
208+ comments ?: LineCommentsCollection ;
205209 /**
206210 * Automatically close brackets when typing
207211 */
0 commit comments