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

fix crash on empty file #217

Merged
merged 2 commits into from
Aug 6, 2024
Merged

fix crash on empty file #217

merged 2 commits into from
Aug 6, 2024

Conversation

Graveflo
Copy link
Contributor

@Graveflo Graveflo commented Jul 7, 2024

Basically, if you CTRL+A -> Backspace it can crash the lang server. contentChanges[0] expecting there to be at least one character seems to be the culprit. I also re-arranged the imports, but feel free to reject that change. Also, there was a . missing but apparently that doesn't matter.

edit:
The changes in the config were steered by me trying to get Kate's settings to transfer. Not sure if I'm doing that right, but that is what I needed to do to get it work.

@jmgomez
Copy link
Collaborator

jmgomez commented Jul 31, 2024

Can you resolve the conflicts? Sorry it took so long

@Graveflo
Copy link
Contributor Author

Graveflo commented Aug 2, 2024

drafting this because on master (and with this PR) I am now getting this error using Kate:

Shutting down due to an error: input(1, 0) Error: { expected
Async traceback:
  /home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(173) nimlangserver
  /home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(163) main
  /usr/lib/nim/lib/pure/asyncdispatch.nim(2022) waitFor
  /usr/lib/nim/lib/pure/asyncdispatch.nim(1711) poll
  /usr/lib/nim/lib/pure/asyncdispatch.nim(1452) runOnce
  /usr/lib/nim/lib/system/threadimpl.nim(269) processPendingCallbacks
  /usr/lib/nim/lib/pure/asyncmacro.nim(133) start (Async)
  /usr/lib/nim/lib/pure/json.nim(1047) parseJson
  /usr/lib/nim/lib/pure/json.nim(962) parseJson
  /usr/lib/nim/lib/pure/json.nim(927) parseJson
  /usr/lib/nim/lib/pure/parsejson.nim(518) raiseParseErr
Exception message: input(1, 0) Error: { expected
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(173) nimlangserver
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(163) main
/usr/lib/nim/lib/pure/asyncdispatch.nim(2022) waitFor
/usr/lib/nim/lib/pure/asyncdispatch.nim(1711) poll
/usr/lib/nim/lib/pure/asyncdispatch.nim(1452) runOnce
/usr/lib/nim/lib/system/threadimpl.nim(269) processPendingCallbacks
/usr/lib/nim/lib/pure/asyncmacro.nim(133) start (Async)
/usr/lib/nim/lib/pure/json.nim(1047) parseJson
/usr/lib/nim/lib/pure/json.nim(962) parseJson
/usr/lib/nim/lib/pure/json.nim(927) parseJson
/usr/lib/nim/lib/pure/parsejson.nim(518) raiseParseErr
[[reraised from:
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(173) nimlangserver
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(163) main
/usr/lib/nim/lib/pure/asyncdispatch.nim(2022) waitFor
/usr/lib/nim/lib/pure/asyncdispatch.nim(1711) poll
/usr/lib/nim/lib/pure/asyncdispatch.nim(1452) runOnce
/usr/lib/nim/lib/system/threadimpl.nim(269) processPendingCallbacks
/usr/lib/nim/lib/std/typedthreads.nim(287) start (Async)
]]
[[reraised from:
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(173) nimlangserver
/home/ryan/Documents/pbuildtmp/langserverworkspace/langserver/nimlangserver.nim(163) main
/usr/lib/nim/lib/pure/asyncdispatch.nim(2024) waitFor
/usr/lib/nim/lib/pure/asyncfutures.nim(381) read
]]

Looks like something buried in a macro, so I'm having some trouble tracing the issue. Going to have to look at it later.

@Graveflo Graveflo marked this pull request as ready for review August 3, 2024 21:54
@Graveflo
Copy link
Contributor Author

Graveflo commented Aug 3, 2024

nvm about the above I had my dependencies messed up

@jmgomez jmgomez merged commit fa3c9bb into nim-lang:master Aug 6, 2024
1 check passed
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.

2 participants