TypeCobol icon indicating copy to clipboard operation
TypeCobol copied to clipboard

InvalidOperationException in SelectAllTokensBetween method

Open fm-117 opened this issue 2 years ago • 2 comments

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.

fm-117 avatar May 06 '22 07:05 fm-117

Message is Invalid start or stop token : line or columns number do not define a valid selection interval.

fm-117 avatar Sep 14 '23 07:09 fm-117

Dummy fix: instead of throwing the exception set stopToken to startToken and stopLineIndex to startLineIndex ?

fm-117 avatar Nov 14 '23 13:11 fm-117