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

Don't stall due to dynamic source location discovery on long lines in repl #2532

Merged
merged 2 commits into from Jan 12, 2019

Conversation

vspinu
Copy link
Contributor

@vspinu vspinu commented Nov 28, 2018

I am observing long hangs when I am hovering on long lines in repl. While the root cause is somewhere down in emacs redisplay or regexp lookup, the cause on the CIDER side is in the dynamic source location sniffing.

In this PR I am disallowing source loc discovery on lines longer than 300 characters (should be more than enough) and improving source locs regexp.

cider-locref-regexp-alist))
(save-excursion
(goto-char (or pos (point)))
(when (< (- (point-at-eol) (point-at-bol)) 300)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should explain that magic number. Or maybe make it a variable.

@bbatsov
Copy link
Member

bbatsov commented Dec 21, 2018

Apart from the failing build and my small remark, the changes look good.

(with-temp-buffer
(insert "\nReflection warning, cider/nrepl/middleware/slurp.clj:103:16 - reference to field getInputStream can't be resolved.")
(move-to-column 20)
(expect (cider-locref-at-point)
:to-equal
'(:type reflection :highlight (22 . 61) :var nil :file "cider/nrepl/middleware/slurp.clj" :line 103)))))
'(:type warning :highlight (22 . 61) :var nil :file "cider/nrepl/middleware/slurp.clj" :line 103))))
(it "works with warnings"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you've got two blocks with the same description - an oversight maybe?

@bbatsov
Copy link
Member

bbatsov commented Jan 8, 2019

@vspinu ping :-)

@vspinu
Copy link
Contributor Author

vspinu commented Jan 11, 2019

Sorry. I got detached for a while and didn't notice your comments. Both issues fixed. I think adding a variable for line length is an overkill. I would think that paths longer than 300 characters are very unlikely. I have added a comprehensive comment.

@bbatsov bbatsov merged commit e78d678 into clojure-emacs:master Jan 12, 2019
@bbatsov
Copy link
Member

bbatsov commented Jan 12, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants