Skip to content

Commit

Permalink
Merge pull request #22796 from ccordoba12/issue-22637
Browse files Browse the repository at this point in the history
PR: Restore run actions to the context menu of `CodeEditor` (Editor)
  • Loading branch information
ccordoba12 authored Nov 1, 2024
2 parents 07948d4 + 7eca04a commit c61b936
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test-remoteclient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,3 @@ jobs:
.github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh
- name: Coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
34 changes: 34 additions & 0 deletions spyder/plugins/editor/widgets/codeeditor/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from spyder_kernels.utils.dochelpers import getobj

# Local imports
from spyder.api.plugins import Plugins
from spyder.config.base import _, running_under_pytest
from spyder.plugins.editor.api.decoration import TextDecoration
from spyder.plugins.editor.api.panel import Panel
Expand Down Expand Up @@ -108,6 +109,7 @@ class CodeEditorMenus:


class CodeEditorContextMenuSections:
RunSection = "run_section"
InspectSection = "inspect_section"
UndoRedoSection = "undo_redo_section"
EditSection = "edit_section"
Expand Down Expand Up @@ -3412,6 +3414,23 @@ def setup_context_menu(self):
triggered=self.sig_show_object_info
)

# Run actions
try:
run_cell_action = self.get_action("run cell", plugin=Plugins.Run)
run_cell_and_advance_action = self.get_action(
"run cell and advance", plugin=Plugins.Run
)
rerun_cell_action = self.get_action(
"re-run cell", plugin=Plugins.Run
)
run_selection_action = self.get_action(
"run selection and advance", plugin=Plugins.Run
)
except KeyError:
# This is necessary for our tests because some of them need to run
# independently of other plugins.
run_cell_action = None

# Zoom actions
zoom_in_action = self.create_action(
CodeEditorActions.ZoomIn,
Expand Down Expand Up @@ -3469,6 +3488,20 @@ def setup_context_menu(self):
CodeEditorMenus.ContextMenu, register=False
)

# Run section
if run_cell_action is not None:
for menu_action in [
run_cell_action,
run_cell_and_advance_action,
rerun_cell_action,
run_selection_action,
]:
self.add_item_to_menu(
menu_action,
self.menu,
section=CodeEditorContextMenuSections.RunSection
)

# Inspect section
inspect_actions = [
self.gotodef_action, self.inspect_current_object_action
Expand Down Expand Up @@ -4380,6 +4413,7 @@ def contextMenuEvent(self, event):
self.ipynb_convert_action.setVisible(self.is_json() and
nbformat is not None)
self.gotodef_action.setVisible(self.go_to_definition_enabled)
self.inspect_current_object_action.setVisible(self.enable_hover)

formatter = self.get_conf(
('provider_configuration', 'lsp', 'values', 'formatting'),
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/editor/widgets/codeeditor/lsp_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
handles,
class_register,
)
from spyder.plugins.editor.panels import FoldingPanel
from spyder.plugins.editor.panels.utils import (
merge_folding,
collect_folding_regions,
Expand Down Expand Up @@ -181,7 +180,7 @@ def __init__(self, *args, **kwargs):
self.sync_mode = TextDocumentSyncKind.FULL
self.will_save_notify = False
self.will_save_until_notify = False
self.enable_hover = True
self.enable_hover = False
self.auto_completion_characters = []
self.resolve_completions_enabled = False
self.signature_completion_characters = []
Expand Down

0 comments on commit c61b936

Please sign in to comment.