Просмотр исходного кода

Merge pull request #28245 from overleaf/mj-word-count-client-fix

[web] Fix node skipping while waiting for magic comment

GitOrigin-RevId: 8203e7d0779e660d5f6e568b78b0df6d18bfaf58
Mathias Jakobsen 1 год назад
Родитель
Сommit
ce93941cf2

+ 2 - 2
services/web/frontend/js/features/word-count-modal/utils/count-words-in-file.ts

@@ -303,7 +303,7 @@ export const countWordsInFile = (
     to: preambleExtent.to,
     to: preambleExtent.to,
     enter(nodeRef: SyntaxNodeRef) {
     enter(nodeRef: SyntaxNodeRef) {
       if (state.skipping && !nodeRef.type.is('Comment')) {
       if (state.skipping && !nodeRef.type.is('Comment')) {
-        return false
+        return
       }
       }
       return headMatcher(nodeRef.type)?.(nodeRef)
       return headMatcher(nodeRef.type)?.(nodeRef)
     },
     },
@@ -313,7 +313,7 @@ export const countWordsInFile = (
     from: preambleExtent.to,
     from: preambleExtent.to,
     enter(nodeRef: SyntaxNodeRef) {
     enter(nodeRef: SyntaxNodeRef) {
       if (state.skipping && !nodeRef.type.is('Comment')) {
       if (state.skipping && !nodeRef.type.is('Comment')) {
-        return false
+        return
       }
       }
       return bodyMatcher(nodeRef.type)?.(nodeRef)
       return bodyMatcher(nodeRef.type)?.(nodeRef)
     },
     },