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

hovering over variable in jupyter notebook causes ruff server to crash #14768

Closed
TheOnlyWayUp opened this issue Dec 4, 2024 · 4 comments · Fixed by #15398
Closed

hovering over variable in jupyter notebook causes ruff server to crash #14768

TheOnlyWayUp opened this issue Dec 4, 2024 · 4 comments · Fixed by #15398
Labels
bug Something isn't working notebook Related to (Jupyter) notebooks server Related to the LSP server

Comments

@TheOnlyWayUp
Copy link

https://files.rambhat.la/s/ySXwKiXNSLwcyde

from langchain_core.prompts import ChatPromptTemplate

system = """..."""

prompt = ChatPromptTemplate.from_messages([("system", system), ("human", "{input}")])

prompted_llm = prompt | llm
output = prompted_llm.invoke(texts[1])
print(output)
2024-12-04 09:50:35.199 [info] panicked at crates/ruff_server/src/server/api/requests/hover.rs:36:10:
hover should only be called on text documents or notebook cells

2024-12-04 09:50:35.199 [info]    0: ruff_server::server::Server::run::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}

2024-12-04 09:50:35.200 [info]    3: std::sys::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   
2024-12-04 09:50:35.200 [info] 6: core::option::expect_failed
   7: <ruff_server::server::api::requests::hover::Hover
2024-12-04 09:50:35.200 [info]  as ruff_server::server::api::traits::BackgroundDocumentRequestHandler>::run_with_snapshot
   8: core::
2024-12-04 09:50:35.200 [info] ops::function::FnOnce::call_once{{vtable.shim}}
   9: core::ops
2024-12-04 09:50:35.200 [info] ::function::FnOnce::call_once{{vtable.shim}}
  10: std::sys::backtrace::__rust_begin_short_backtrace
 
2024-12-04 09:50:35.200 [info]  11: core::ops::function::FnOnce::call_once{{vtable.shim}}
  
2024-12-04 09:50:35.200 [info] 12: std::sys::pal::unix::thread::Thread::new::thread_start
  13: 
2024-12-04 09:50:35.200 [info] start_thread
  14: clone
@dhruvmanila
Copy link
Member

This is most likely same as astral-sh/ruff-vscode#644. Can you make sure you're on the latest Ruff version and provide us the detailed logs by turning on server logs using the following config?

{
	"ruff.server.trace": "verbose",
	"ruff.logLevel": "debug",
}

You can find more details here: https://github.com/astral-sh/ruff-vscode#troubleshooting. I'm specifically looking for a message that's been added in #14579.

@dhruvmanila dhruvmanila added bug Something isn't working server Related to the LSP server labels Dec 4, 2024
@dhruvmanila
Copy link
Member

I think even just upgrading the Ruff version should provide us a better message when the panic occurs.

@TheOnlyWayUp
Copy link
Author

{
"ruff.server.trace": "verbose",
"ruff.logLevel": "debug",
}

I've added this to my settings.json, don't see any debug messages in Output yet. I haven't been able to replicate the error (hovering doesn't cause a crash).

I'll leave the debugging enabled incase it pops up again.

@dhruvmanila
Copy link
Member

I'll leave the debugging enabled incase it pops up again.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working notebook Related to (Jupyter) notebooks server Related to the LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants