File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
packages/langium/src/parser Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ export class CstNodeBuilder {
6868 current . content . push ( ...nodes ) ;
6969 return ;
7070 }
71+ // Otherwise we are at a newly created node
72+ // Instead of adding the hidden nodes here, we search for the first parent node with content
7173 while ( current . container ) {
7274 const index = current . container . content . indexOf ( current ) ;
7375 if ( index > 0 ) {
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ export class LangiumParser extends AbstractLangiumParser {
275275 } ;
276276 }
277277
278- private getHiddenTokens ( token : IToken ) : IToken [ ] {
278+ private extractHiddenTokens ( token : IToken ) : IToken [ ] {
279279 const hiddenTokens = this . lexerResult ! . hidden ;
280280 if ( ! hiddenTokens . length ) {
281281 return [ ] ;
@@ -293,7 +293,7 @@ export class LangiumParser extends AbstractLangiumParser {
293293 consume ( idx : number , tokenType : TokenType , feature : AbstractElement ) : void {
294294 const token = this . wrapper . wrapConsume ( idx , tokenType ) ;
295295 if ( ! this . isRecording ( ) && this . isValidToken ( token ) ) {
296- const hiddenTokens = this . getHiddenTokens ( token ) ;
296+ const hiddenTokens = this . extractHiddenTokens ( token ) ;
297297 this . nodeBuilder . addHiddenNodes ( hiddenTokens ) ;
298298 const leafNode = this . nodeBuilder . buildLeafNode ( token , feature ) ;
299299 const { assignment, isCrossRef } = this . getAssignment ( feature ) ;
You can’t perform that action at this time.
0 commit comments