TypeCobol
TypeCobol copied to clipboard
InvalidOperationException in SelectAllTokensBetween method
Describe the bug
InvalidOperationException
has been thrown by SelectAllTokensBetween
. See following stack trace:
à TypeCobol.Compiler.Scanner.TokensLinesIterator.SelectAllTokensBetween(Token startToken, Token stopToken)
à TypeCobol.Compiler.Preprocessor.PreprocessorStep.CupProcessTokensLinesChanges(CompilationDocument document, ISearchableReadOnlyList`1 documentLines, IList`1 tokensLinesChanges, PrepareDocumentLineForUpdate prepareDocumentLineForUpdate, IDocumentImporter documentImporter, PerfStatsForParserInvocation perfStatsForParserInvocation, List`1& missingCopies)
à TypeCobol.Compiler.CompilationDocument.RefreshProcessedTokensDocumentSnapshot()
à TypeCobol.Compiler.FileCompiler.CompileOnce(Nullable`1 exec2Step, Boolean haltOnMissingCopy)
à TypeCobol.LanguageServer.Workspace.UpdateSourceFile(Uri fileUri, TextChangedEvent textChangedEvent)
à TypeCobol.LanguageServer.TypeCobolServer.OnDidChangeTextDocument(DidChangeTextDocumentParams parameters)
à TypeCobol.LanguageServer.VsCodeProtocol.LanguageServer.CallDidChangeTextDocument(NotificationType notificationType, Object parameters)
To Reproduce Private source code available, check TCOJCM04.cbl file.
Expected behavior No exception.
Message is Invalid start or stop token : line or columns number do not define a valid selection interval
.
Dummy fix: instead of throwing the exception set stopToken
to startToken
and stopLineIndex
to startLineIndex
?