Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for_completion: handle end of token situation #1998

Merged
merged 1 commit into from
Jun 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/reason-parser/reason_lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,17 @@ and skip_sharp_bang = parse
let completion_ident_pos = ref Lexing.dummy_pos

let token lexbuf =
let before = lexbuf.Lexing.lex_curr_p.Lexing.pos_cnum in
let space_start = lexbuf.Lexing.lex_curr_p.Lexing.pos_cnum in
let token = token lexbuf in
let after = lexbuf.Lexing.lex_start_p.Lexing.pos_cnum in
let token_start = lexbuf.Lexing.lex_start_p.Lexing.pos_cnum in
let token_stop = lexbuf.Lexing.lex_curr_p.Lexing.pos_cnum in
if !completion_ident_offset > min_int &&
before <= !completion_ident_offset &&
after >= !completion_ident_offset then (
space_start <= !completion_ident_offset &&
token_stop >= !completion_ident_offset then (
match token with
| LIDENT _ | UIDENT _ when after = !completion_ident_offset -> token
| LIDENT _ | UIDENT _ when token_start <= !completion_ident_offset ->
completion_ident_offset := min_int;
token
| _ ->
queued_tokens := save_triple lexbuf token :: !queued_tokens;
completion_ident_offset := min_int;
Expand Down