Skip to content

Commit

Permalink
Bugfix: keep preprocessor buffer contents when skipping text
Browse files Browse the repository at this point in the history
  • Loading branch information
nberth committed Apr 8, 2024
1 parent 39678a0 commit d86179c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lsp/cobol_preproc/preproc_engine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ let rec next_chunk ({ reader; buff; persist = { dialect; _ }; _ } as lp) =
next_chunk (apply_compiler_directive lp compdir)
| Ok Some (text, compdir, _compdir_text, diags) when not emitting ->
let rev_ignored = List.rev_append text lp.rev_ignored in
let lp = add_diags { lp with reader; buff = []; rev_ignored } diags in
let lp = add_diags { lp with reader; rev_ignored } diags in
next_chunk (apply_compiler_directive lp compdir) (* ignore text *)
| Ok Some (text, compdir, _compdir_text, diags) ->
let lp = add_diags { lp with reader; buff = [] } diags in
preprocess_line (apply_compiler_directive lp compdir) (buff @ text)
| Error (text, _compdir_text, diags) when not emitting ->
let rev_ignored = List.rev_append text lp.rev_ignored in
let lp = add_diags { lp with reader; buff = []; rev_ignored } diags in
let lp = add_diags { lp with reader; rev_ignored } diags in
next_chunk lp (* ignore text *)
| Error (text, _compdir_text, diags) ->
let lp = add_diags { lp with reader; buff = [] } diags in
Expand Down

0 comments on commit d86179c

Please sign in to comment.