Skip to content

Escape from get_func_hover loop#800

Merged
davidanthoff merged 1 commit intomasterfrom
hover-circuit
Jul 15, 2020
Merged

Escape from get_func_hover loop#800
davidanthoff merged 1 commit intomasterfrom
hover-circuit

Conversation

@ZacLN
Copy link
Copy Markdown
Contributor

@ZacLN ZacLN commented Jul 15, 2020

There is a cycle in the links (.prev/.next) between StaticLint.Bindings. The root cause is within StaticLint but there is no reason to allow it to crash the language server. If we have done a complete circuit here (i.e. a loop is detected) then we have all the information we need and can return.

As this is being hit quite a lot, this approach seems best for the user while the StaticLint bug is fixed. Thoughts?

@ZacLN ZacLN added the bug label Jul 15, 2020
@ZacLN ZacLN added this to the Next extension patch release milestone Jul 15, 2020
@ZacLN ZacLN self-assigned this Jul 15, 2020
@aviatesk
Copy link
Copy Markdown
Member

I'm in favor of this -- as far as I understand binding traversal in LanguageServer.jl itself seems to be correct, so I think there won't be anything we can get more from crash report for these lines of code.

function get_signatures(b, tls, sigs, server, visited = nothing) end # Fallback

function get_signatures(b::StaticLint.Binding, tls::StaticLint.Scope, sigs::Vector{SignatureInformation}, server, visited = Base.IdSet{StaticLint.Binding}())
function get_signatures(b::StaticLint.Binding, tls::StaticLint.Scope, sigs::Vector{SignatureInformation}, server, visited = StaticLint.Binding[])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the reason for switching to Vector ?
Well, could I also ask why you used Base.IdSet before instead of usual Set ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using IdSet was a mistake, I had been using them in SymbolServer and forgot it was quite costly

@davidanthoff davidanthoff merged commit 91155cc into master Jul 15, 2020
@davidanthoff davidanthoff deleted the hover-circuit branch July 15, 2020 17:37
@oppo-source oppo-source removed the request for review from a team April 16, 2021 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants