Skip to content

Commit

Permalink
optimize parse
Browse files Browse the repository at this point in the history
  • Loading branch information
shuxiao9058 committed Jul 21, 2023
1 parent b00b323 commit 7379433
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tabnine-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -649,21 +649,23 @@ PROCESS is the process under watch, OUTPUT is the output received."
(let* ((response
(mapconcat #'identity
(nreverse tabnine--response-chunks) nil))
(ss (s-split "\n" (s-trim response)))
(ss (nreverse (s-split "\n" (s-trim response))))
str
result)

(when (and ss (> (length ss) 0))
(while (and ss (> (length ss) 0)
(or (not result) (equal result 'json-error)))
(setq tabnine--response-chunks nil)
(setq str (car ss))
(when (s-present? str)
(setq result (tabnine-util--read-json str))
(setq ss (cdr ss))
(setq tabnine--response result)
(when (and result (tabnine--valid-response-p result))
(setq tabnine--completion-cache-result result)
(when (equal (point) tabnine--trigger-point)
(tabnine--show-completion-1 result)))))))
(unless (equal result 'json-error)
(setq tabnine--response result)
(when (and result (tabnine--valid-response-p result))
(setq tabnine--completion-cache-result result)
(when (equal (point) tabnine--trigger-point)
(tabnine--show-completion-1 result)))))
(setq ss (cdr ss)))))

;;
;; Interactive functions
Expand Down

0 comments on commit 7379433

Please sign in to comment.