Skip to content

Commit

Permalink
refactor(editor): rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Dec 15, 2023
1 parent f43a53a commit 5b6150e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/features/editor/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
setEditorInput,
} from './editorSlice'
import { isTemplate, templateSelection } from './examples'
import { selectHighlightLinePos } from './selectors'
import { selectCurrentStatementLinePos } from './selectors'

const defineViewEffect = identity<ViewEffectCallback>

Expand Down Expand Up @@ -92,7 +92,7 @@ const autoSelectTemplateTitle = defineViewEffect((view) => {
)
})

const syncAssemblerErrorFromState = defineViewEffect((view) => {
const underlineAssemblerError = defineViewEffect((view) => {
const assemblerErrorRange$ = store.onState(selectAssemblerErrorRange)
return observe(
assemblerErrorRange$.pipe(
Expand All @@ -109,9 +109,9 @@ const syncAssemblerErrorFromState = defineViewEffect((view) => {
)
})

const syncHighlightLineFromState = defineViewEffect((view) => {
const highlightLinePos$ = store.onState(curryRight2(selectHighlightLinePos)(view))
return observe(highlightLinePos$, (linePos_M) => {
const highlightLineWithStatement = defineViewEffect((view) => {
const statementLinePos$ = store.onState(curryRight2(selectCurrentStatementLinePos)(view))
return observe(statementLinePos$, (linePos_M) => {
linePos_M
.map((linePos) =>
linePos.map((pos, posIndex) =>
Expand Down Expand Up @@ -220,8 +220,8 @@ export const viewEffects: readonly ViewEffectCallback[] = [
syncInputToState,
syncInputFromState,
autoSelectTemplateTitle,
syncAssemblerErrorFromState,
syncHighlightLineFromState,
underlineAssemblerError,
highlightLineWithStatement,
syncBreakpointsToState,
initialSyncBreakpointsFromState,
toggleVimKeybindings,
Expand Down
2 changes: 1 addition & 1 deletion src/features/editor/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createSelector } from '@reduxjs/toolkit'
import * as Maybe from '@/common/maybe'
import { selectCurrentStatementRange } from '@/features/controller/selectors'

export const selectHighlightLinePos = createSelector(
export const selectCurrentStatementLinePos = createSelector(
[selectCurrentStatementRange, (_, view: EditorView) => view.state.doc],
(statementRange, doc) =>
Maybe.fromNullable(statementRange).chain((range) => {
Expand Down

0 comments on commit 5b6150e

Please sign in to comment.