DanielGavin / ols

Language server for Odin
MIT License
439 stars 67 forks source link

Constant timeouts #389

Closed sudokit closed 4 months ago

sudokit commented 4 months ago

Not sure if its related to helix (editor I am using), but ols seems to constantly time out. Not sure why. Ill add some logs: log is humongous, enabled really verboselogging

DanielGavin commented 4 months ago

Is there a simple repro that causes the timeout? Have you tried other editors, and do they cause the same issue? Helix is not the most stable editor currently with LSP.

sudokit commented 4 months ago

Yeah no as I mentioned I was unable to find any way to reproduce the timeout. Ill be on the lookout. Nop I havent really tried other other editors. I increased the timeout so hopefully that helps

sudokit commented 4 months ago

happened as well today with vscode with the error:

/home/sudokit/langs/ols/src/common/position.odin(152:31) Invalid slice indices -1:1885 is out of range 0..<1885
DanielGavin commented 4 months ago

Maybe it's some partial ast that gives some bad node. I'll add a max(). That should fix the issue with that crash. I'd rather return some wrong position then crash.

DanielGavin commented 4 months ago

Fixed. It'll instead print an error if the token range is invalid.

DanielGavin commented 4 months ago

Closing issue. Make a new issue if you find more errors.

sudokit commented 4 months ago

Thank you! Errors, I think, are better than a crash, since a lsp restart isn't needed. What I think then happens in my case is that the lsp restarts but its still out of range and instantly crashes.

sudokit commented 4 months ago

Hehehe... sorry similar error so same issue... /home/sudokit/langs/ols/src/server/analysis.odin(159:31) Index 60 is out of range 0..<60 how about a upper limit as well ,p

EDIT: sorryyyyy prob should open a new issueee, but it just seems dumb since its the same thing changing the added if to this seems to fix it:

if offset < 0 || offset > end_offset {
        offset := 0
        log.errorf("Failed to find offset in get_token_range: %v", node)
}

Yeah i could make a pull request buuuut only for one simple thing seems inefficient. Besides ill have to see if it actually fixes it! It just seems to have a really bad time with function overloading or with like parametric polymorphism when there are allot of them one after the other. one function has parametric polymorphism and calls another function which has overloads which each has parametric polymorphism and so in ./

DanielGavin commented 4 months ago

Has nothing to do with the previous error. I should have fixed it thought.