File tree Expand file tree Collapse file tree 2 files changed +9
-47
lines changed Expand file tree Collapse file tree 2 files changed +9
-47
lines changed Original file line number Diff line number Diff line change @@ -626,6 +626,13 @@ def code_action(
626626 2. Extract variable
627627 3. Extract function
628628 """
629+ # Code actions are not yet supported for notebooks.
630+ notebook = server .workspace .get_notebook_document (
631+ cell_uri = params .text_document .uri
632+ )
633+ if notebook is not None :
634+ return None
635+
629636 document = server .workspace .get_text_document (params .text_document .uri )
630637 jedi_script = jedi_utils .script (server .project , document )
631638 code_actions = []
Original file line number Diff line number Diff line change @@ -546,53 +546,8 @@ def test_lsp_code_action_notebook() -> None:
546546 }
547547 )
548548
549- expected = [
550- {
551- "title" : StringPattern (
552- r"Extract expression into variable 'jls_extract_var'"
553- ),
554- "kind" : "refactor.extract" ,
555- "edit" : {
556- "documentChanges" : [
557- {
558- "textDocument" : {
559- "uri" : uri ,
560- "version" : 1 ,
561- },
562- "edits" : [],
563- }
564- ]
565- },
566- },
567- {
568- "title" : StringPattern (
569- r"Extract expression into function 'jls_extract_def'"
570- ),
571- "kind" : "refactor.extract" ,
572- "edit" : {
573- "documentChanges" : [
574- {
575- "textDocument" : {
576- "uri" : uri ,
577- "version" : 1 ,
578- },
579- "edits" : [],
580- }
581- ]
582- },
583- },
584- ]
585-
586- # Cannot use hamcrest directly for this due to unpredictable
587- # variations in how the text edits are generated.
588-
589- assert_that (len (actual ), is_ (len (expected )))
590-
591- # Remove the edits
592- actual [0 ]["edit" ]["documentChanges" ][0 ]["edits" ] = []
593- actual [1 ]["edit" ]["documentChanges" ][0 ]["edits" ] = []
594-
595- assert_that (actual , is_ (expected ))
549+ # Code actions are not yet supported in notebooks.
550+ assert_that (actual , is_ (None ))
596551
597552
598553def test_lsp_code_action2 () -> None :
You can’t perform that action at this time.
0 commit comments