From 748504149b11fae2b1231c60cb9231e971f65c13 Mon Sep 17 00:00:00 2001 From: Arsam Islami Date: Fri, 8 Jul 2022 15:48:10 +0200 Subject: [PATCH 01/11] feat: Addding buttons to go to the next/previous element of same type and shortcuts for both actions Co-Authored-By: Aclrian <32142988+Aclrian@users.noreply.github.com> --- .../gui/src/features/menuBar/MenuBar.tsx | 59 ++++++++++++++++--- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 1e48554c3..649a7403a 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -17,7 +17,7 @@ import { useToast, } from '@chakra-ui/react'; import React from 'react'; -import { FaArrowLeft, FaArrowRight, FaArrowUp, FaChevronDown, FaRedo, FaUndo } from 'react-icons/fa'; +import { FaAngleDoubleLeft, FaAngleDoubleRight, FaArrowLeft, FaArrowRight, FaArrowUp, FaChevronDown, FaRedo, FaUndo } from 'react-icons/fa'; import { useAppDispatch, useAppSelector, useKeyboardShortcut } from '../../app/hooks'; import { redo, @@ -133,7 +133,15 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) dispatch(toggleComplete(declaration.id)); }; - const goToPreviousMatch = () => { + + const goToPreviousMatchSameType = () => { + goToPreviousMatch(true) + }; + const goToPreviousMatchJumper = () => { + goToPreviousMatch(false) + }; + + const goToPreviousMatch = (onlySameType: boolean) => { if (!declaration || currentUserAction.type !== NoUserAction.type) { return; } @@ -144,6 +152,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, + onlySameType ); if (navStr !== null) { if (wrappedAround) { @@ -164,7 +173,14 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) dispatch(setAllExpandedInTreeView(parents)); } }; - const goToNextMatch = () => { + + const goToNextMatchSameType = () => { + goToNextMatch(true) + }; + const goToNextMatchJumper = () => { + goToNextMatch(false) + }; + const goToNextMatch = (onlySameType: boolean) => { if (!declaration || currentUserAction.type !== NoUserAction.type) { return; } @@ -175,6 +191,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, + onlySameType ); if (navStr !== null) { if (wrappedAround) { @@ -230,8 +247,10 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) useKeyboardShortcut(false, true, false, 'z', () => dispatch(undo())); useKeyboardShortcut(false, true, false, 'y', () => dispatch(redo())); useKeyboardShortcut(false, true, true, 'c', markSelectedElementAsComplete); - useKeyboardShortcut(false, true, false, 'ArrowLeft', goToPreviousMatch); - useKeyboardShortcut(false, true, false, 'ArrowRight', goToNextMatch); + useKeyboardShortcut(false, true, false, 'ArrowLeft', goToPreviousMatchJumper); + useKeyboardShortcut(false, true, false, 'ArrowRight', goToNextMatchJumper); + useKeyboardShortcut(false, true, true, 'ArrowLeft', goToPreviousMatchSameType); + useKeyboardShortcut(false, true, true, 'ArrowRight', goToNextMatchSameType); useKeyboardShortcut(false, true, false, 'ArrowUp', goToParent); useKeyboardShortcut(false, true, false, ',', expandAll); useKeyboardShortcut(false, true, false, '.', collapseAll); @@ -351,7 +370,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) } command="Ctrl+Left" @@ -360,13 +379,31 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) } command="Ctrl+Right" > Go to Next Match + } + command="Ctrl+Alt+Left" + > + Go to Previous Element of same Type + + } + command="Ctrl+Alt+Right" + > + Go to Next Element of same Type + = startIndex; while (current !== null && current !== start) { - if (filter.shouldKeepDeclaration(current, annotations, usages)) { + if ((current.constructor == start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { return { id: current.id, wrappedAround }; } @@ -539,13 +578,15 @@ const getNextElementPath = function ( filter: AbstractPythonFilter, annotations: AnnotationStore, usages: UsageCountStore, + onlySameType: boolean ): { id: string; wrappedAround: boolean } { const startIndex = getIndex(declarations, start); let currentIndex = getNextIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { - if (filter.shouldKeepDeclaration(current, annotations, usages)) { + if ((current.constructor == start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { return { id: current.id, wrappedAround }; } From 97ccefb0d7a0e248e0c93cc5fb315f3331fe0344 Mon Sep 17 00:00:00 2001 From: Arsam Islami Date: Fri, 8 Jul 2022 16:08:12 +0200 Subject: [PATCH 02/11] add two = Co-Authored-By: Aclrian <32142988+Aclrian@users.noreply.github.com> --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 649a7403a..86860db0c 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -557,7 +557,7 @@ const getPreviousElementPath = function ( let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { - if ((current.constructor == start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + if ((current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { return { id: current.id, wrappedAround }; } @@ -585,7 +585,7 @@ const getNextElementPath = function ( let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { - if ((current.constructor == start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + if ((current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { return { id: current.id, wrappedAround }; } From 9b4aab00687bb2606363edbba4f7365c6855a8a2 Mon Sep 17 00:00:00 2001 From: Masara Date: Fri, 8 Jul 2022 14:11:44 +0000 Subject: [PATCH 03/11] style: apply automatic fixes of linters --- .../gui/src/features/menuBar/MenuBar.tsx | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 86860db0c..aa7a40dff 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -17,7 +17,16 @@ import { useToast, } from '@chakra-ui/react'; import React from 'react'; -import { FaAngleDoubleLeft, FaAngleDoubleRight, FaArrowLeft, FaArrowRight, FaArrowUp, FaChevronDown, FaRedo, FaUndo } from 'react-icons/fa'; +import { + FaAngleDoubleLeft, + FaAngleDoubleRight, + FaArrowLeft, + FaArrowRight, + FaArrowUp, + FaChevronDown, + FaRedo, + FaUndo, +} from 'react-icons/fa'; import { useAppDispatch, useAppSelector, useKeyboardShortcut } from '../../app/hooks'; import { redo, @@ -135,10 +144,10 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) }; const goToPreviousMatchSameType = () => { - goToPreviousMatch(true) + goToPreviousMatch(true); }; const goToPreviousMatchJumper = () => { - goToPreviousMatch(false) + goToPreviousMatch(false); }; const goToPreviousMatch = (onlySameType: boolean) => { @@ -152,7 +161,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, - onlySameType + onlySameType, ); if (navStr !== null) { if (wrappedAround) { @@ -175,10 +184,10 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) }; const goToNextMatchSameType = () => { - goToNextMatch(true) + goToNextMatch(true); }; const goToNextMatchJumper = () => { - goToNextMatch(false) + goToNextMatch(false); }; const goToNextMatch = (onlySameType: boolean) => { if (!declaration || currentUserAction.type !== NoUserAction.type) { @@ -191,7 +200,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, - onlySameType + onlySameType, ); if (navStr !== null) { if (wrappedAround) { @@ -550,15 +559,17 @@ const getPreviousElementPath = function ( filter: AbstractPythonFilter, annotations: AnnotationStore, usages: UsageCountStore, - onlySameType: boolean + onlySameType: boolean, ): { id: string; wrappedAround: boolean } { const startIndex = getIndex(declarations, start); let currentIndex = getPreviousIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { - if ((current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || - (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { + if ( + (current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages)) + ) { return { id: current.id, wrappedAround }; } @@ -578,15 +589,17 @@ const getNextElementPath = function ( filter: AbstractPythonFilter, annotations: AnnotationStore, usages: UsageCountStore, - onlySameType: boolean + onlySameType: boolean, ): { id: string; wrappedAround: boolean } { const startIndex = getIndex(declarations, start); let currentIndex = getNextIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { - if ((current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || - (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages))) { + if ( + (current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || + (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages)) + ) { return { id: current.id, wrappedAround }; } From 907650d081d6fac7088fc741d17a9549161cabd3 Mon Sep 17 00:00:00 2001 From: Aclrian <32142988+Aclrian@users.noreply.github.com> Date: Fri, 8 Jul 2022 16:19:00 +0200 Subject: [PATCH 04/11] Update api-editor/gui/src/features/menuBar/MenuCaseBar.tsx Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index aa7a40dff..861b9607f 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -402,7 +402,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) icon={} command="Ctrl+Alt+Left" > - Go to Previous Element of same Type + Go to Previous Element of Same Type Date: Fri, 8 Jul 2022 16:19:12 +0200 Subject: [PATCH 05/11] Update api-editor/gui/src/features/menuBar/MenuBar.tsx Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 861b9607f..29a21f66b 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -411,7 +411,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) icon={} command="Ctrl+Alt+Right" > - Go to Next Element of same Type + Go to Next Element of Same Type Date: Fri, 8 Jul 2022 16:42:13 +0200 Subject: [PATCH 06/11] Update api-editor/gui/src/features/menuBar/MenuBar.tsx Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 29a21f66b..313151a2b 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -402,7 +402,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) icon={} command="Ctrl+Alt+Left" > - Go to Previous Element of Same Type + Go to Previous Match of Same Type Date: Fri, 8 Jul 2022 16:42:24 +0200 Subject: [PATCH 07/11] Update api-editor/gui/src/features/menuBar/MenuBar.tsx Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 313151a2b..7e5cd5da5 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -411,7 +411,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) icon={} command="Ctrl+Alt+Right" > - Go to Next Element of Same Type + Go to Next Match of Same Type Date: Fri, 8 Jul 2022 17:20:05 +0200 Subject: [PATCH 08/11] KV-diagram failure Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 7e5cd5da5..13ae38d5d 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -567,8 +567,7 @@ const getPreviousElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || - (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages)) + (current.constructor === start.constructor || !onlySameType) && filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround }; } From ef5becdc46d7614f113436c4892ee09a468a8f1c Mon Sep 17 00:00:00 2001 From: Aclrian <32142988+Aclrian@users.noreply.github.com> Date: Fri, 8 Jul 2022 17:20:16 +0200 Subject: [PATCH 09/11] KV-diagram failure part 2 Co-authored-by: Lars Reimann --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 13ae38d5d..bcb902474 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -596,8 +596,7 @@ const getNextElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor && filter.shouldKeepDeclaration(current, annotations, usages)) || - (!onlySameType && filter.shouldKeepDeclaration(current, annotations, usages)) + (current.constructor === start.constructor || !onlySameType) && filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround }; } From 6837960087c04bcc2e0624bf6ea9d2272ed3e7c7 Mon Sep 17 00:00:00 2001 From: Aclrian Date: Fri, 8 Jul 2022 15:23:39 +0000 Subject: [PATCH 10/11] style: apply automatic fixes of linters --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index bcb902474..41a6ec356 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -567,7 +567,8 @@ const getPreviousElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor || !onlySameType) && filter.shouldKeepDeclaration(current, annotations, usages) + (current.constructor === start.constructor || !onlySameType) && + filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround }; } @@ -596,7 +597,8 @@ const getNextElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor || !onlySameType) && filter.shouldKeepDeclaration(current, annotations, usages) + (current.constructor === start.constructor || !onlySameType) && + filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround }; } From c750456b03d51f645296e0508e670e4fda0d704d Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 8 Jul 2022 19:24:38 +0200 Subject: [PATCH 11/11] feat(gui): change order and wording of menu items --- .../gui/src/features/menuBar/MenuBar.tsx | 67 ++++++++----------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 41a6ec356..2880f5939 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -143,14 +143,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) dispatch(toggleComplete(declaration.id)); }; - const goToPreviousMatchSameType = () => { - goToPreviousMatch(true); - }; - const goToPreviousMatchJumper = () => { - goToPreviousMatch(false); - }; - - const goToPreviousMatch = (onlySameType: boolean) => { + const goToPreviousMatch = ({ onSameLevel }: { onSameLevel: boolean }) => { if (!declaration || currentUserAction.type !== NoUserAction.type) { return; } @@ -161,7 +154,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, - onlySameType, + onSameLevel, ); if (navStr !== null) { if (wrappedAround) { @@ -183,13 +176,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) } }; - const goToNextMatchSameType = () => { - goToNextMatch(true); - }; - const goToNextMatchJumper = () => { - goToNextMatch(false); - }; - const goToNextMatch = (onlySameType: boolean) => { + const goToNextMatch = ({ onSameLevel }: { onSameLevel: boolean }) => { if (!declaration || currentUserAction.type !== NoUserAction.type) { return; } @@ -200,7 +187,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) pythonFilter, annotations, usages, - onlySameType, + onSameLevel, ); if (navStr !== null) { if (wrappedAround) { @@ -256,11 +243,11 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) useKeyboardShortcut(false, true, false, 'z', () => dispatch(undo())); useKeyboardShortcut(false, true, false, 'y', () => dispatch(redo())); useKeyboardShortcut(false, true, true, 'c', markSelectedElementAsComplete); - useKeyboardShortcut(false, true, false, 'ArrowLeft', goToPreviousMatchJumper); - useKeyboardShortcut(false, true, false, 'ArrowRight', goToNextMatchJumper); - useKeyboardShortcut(false, true, true, 'ArrowLeft', goToPreviousMatchSameType); - useKeyboardShortcut(false, true, true, 'ArrowRight', goToNextMatchSameType); useKeyboardShortcut(false, true, false, 'ArrowUp', goToParent); + useKeyboardShortcut(false, true, false, 'ArrowLeft', () => goToPreviousMatch({ onSameLevel: false })); + useKeyboardShortcut(false, true, false, 'ArrowRight', () => goToNextMatch({ onSameLevel: false })); + useKeyboardShortcut(false, true, true, 'ArrowLeft', () => goToPreviousMatch({ onSameLevel: true })); + useKeyboardShortcut(false, true, true, 'ArrowRight', () => goToNextMatch({ onSameLevel: true })); useKeyboardShortcut(false, true, false, ',', expandAll); useKeyboardShortcut(false, true, false, '.', collapseAll); useKeyboardShortcut(false, true, true, ',', expandSelected); @@ -379,7 +366,16 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) } + command="Ctrl+Up" + > + Go to Parent + + goToPreviousMatch({ onSameLevel: false })} isDisabled={!declaration} icon={} command="Ctrl+Left" @@ -388,7 +384,7 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) goToNextMatch({ onSameLevel: false })} isDisabled={!declaration} icon={} command="Ctrl+Right" @@ -397,30 +393,21 @@ export const MenuBar: React.FC = function ({ displayInferErrors }) goToPreviousMatch({ onSameLevel: true })} isDisabled={!declaration} icon={} command="Ctrl+Alt+Left" > - Go to Previous Match of Same Type + Go to Previous Match on Same Level goToNextMatch({ onSameLevel: true })} isDisabled={!declaration} icon={} command="Ctrl+Alt+Right" > - Go to Next Match of Same Type - - } - command="Ctrl+Up" - > - Go to Parent + Go to Next Match on Same Level @@ -559,7 +546,7 @@ const getPreviousElementPath = function ( filter: AbstractPythonFilter, annotations: AnnotationStore, usages: UsageCountStore, - onlySameType: boolean, + onSameLevel: boolean, ): { id: string; wrappedAround: boolean } { const startIndex = getIndex(declarations, start); let currentIndex = getPreviousIndex(declarations, startIndex); @@ -567,7 +554,7 @@ const getPreviousElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor || !onlySameType) && + (current.constructor === start.constructor || !onSameLevel) && filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround }; @@ -589,7 +576,7 @@ const getNextElementPath = function ( filter: AbstractPythonFilter, annotations: AnnotationStore, usages: UsageCountStore, - onlySameType: boolean, + onSameLevel: boolean, ): { id: string; wrappedAround: boolean } { const startIndex = getIndex(declarations, start); let currentIndex = getNextIndex(declarations, startIndex); @@ -597,7 +584,7 @@ const getNextElementPath = function ( let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { if ( - (current.constructor === start.constructor || !onlySameType) && + (current.constructor === start.constructor || !onSameLevel) && filter.shouldKeepDeclaration(current, annotations, usages) ) { return { id: current.id, wrappedAround };