11import { doc } from 'prettier' ;
22import { NonterminalKind } from '@nomicfoundation/slang/cst' ;
3+ import { printSeparatedItem } from '../slang-printers/print-separated-item.js' ;
34import { isLabel } from '../slang-utils/is-label.js' ;
45import { getNodeMetadata , updateMetadata } from '../slang-utils/metadata.js' ;
56import { Expression } from './Expression.js' ;
@@ -10,7 +11,7 @@ import type { AstPath, Doc, ParserOptions } from 'prettier';
1011import type { AstNode } from './types.d.ts' ;
1112import type { PrintFunction , SlangNode } from '../types.d.ts' ;
1213
13- const { group, indent , indentIfBreak, label, softline } = doc . builders ;
14+ const { group, indentIfBreak, label } = doc . builders ;
1415
1516export class IndexAccessExpression implements SlangNode {
1617 readonly kind = NonterminalKind . IndexAccessExpression ;
@@ -43,13 +44,12 @@ export class IndexAccessExpression implements SlangNode {
4344 }
4445
4546 print ( path : AstPath < IndexAccessExpression > , print : PrintFunction ) : Doc {
46- const operandDoc : Doc = path . call ( print , 'operand' ) ;
47- const indexDoc : Doc = group ( [
47+ const operandDoc = path . call ( print , 'operand' ) ;
48+ const indexDoc = [
4849 '[' ,
49- indent ( [ softline , path . call ( print , 'start' ) , path . call ( print , 'end' ) ] ) ,
50- softline ,
50+ printSeparatedItem ( [ path . call ( print , 'start' ) , path . call ( print , 'end' ) ] ) ,
5151 ']'
52- ] ) ;
52+ ] ;
5353
5454 // If we are at the end of a MemberAccessChain we should indent the
5555 // arguments accordingly.
0 commit comments