Skip to content

Add a Settings toggle for LSP (code completion & errors)#51

Merged
monkopedia-reviewer merged 1 commit into
mainfrom
lsp-settings-toggle
Jun 4, 2026
Merged

Add a Settings toggle for LSP (code completion & errors)#51
monkopedia-reviewer merged 1 commit into
mainfrom
lsp-settings-toggle

Conversation

@monkopedia-coder
Copy link
Copy Markdown
Collaborator

What

Adds a visible "Code completion & errors (LSP)" switch to the Settings pane, wired to SettingsViewModel.setLspEnabled.

Why

The LSP feature (epic #35) shipped opt-in (lspEnabled default off), but the only way to flip it was the TestBridge console action — there was no user-facing control, so the opt-in was unreachable from the UI. (Discovered when trying to actually turn LSP on.)

Changes

  • SettingsPane.kt — a SettingSwitchRow in the editor-settings group, same idiom as the existing theme/keymap/display toggles.
  • BridgeStateSnapshot.kt + JsBridge.kt — surface lspEnabled in the AppStateSnapshot (+ a refresh collector), consistent with editorTheme/keymap already being observable; lets the switch reflect persisted state and makes the flag e2e-observable.
  • BaseE2eTest.ktbridgeStateBoolean helper.
  • ThemeAndKeymapTest.kttestLspEnabledToggle: default-off → on → off round-trip via the snapshot.

Verification

  • Full clean :e2e:test -Pe2e GREEN (incl. the new test) + spotlessCheck all modules — locally, 5m53s. The flag-on path is inert without an engine, so the test is CI-runnable.

No behavior change when the switch is off (still byte-for-byte the prior editor). Closes the go-live UX gap for the LSP feature (#35).

The LSP feature (epic #35) shipped opt-in, but the only way to flip
`lspEnabled` was the TestBridge action — there was no user-visible
control, so the opt-in was effectively unreachable from the UI.

Adds a 'Code completion & errors (LSP)' Switch row to SettingsPane
(editor-settings group, same idiom as the theme/keymap/display toggles),
wired to the existing SettingsViewModel.setLspEnabled. Also surfaces
`lspEnabled` in the bridge AppStateSnapshot (+ a refresh collector) so
the switch reflects persisted state and the flag is observable for e2e —
consistent with editorTheme/keymap already in the snapshot.

Test: ThemeAndKeymapTest.testLspEnabledToggle asserts the default-off ->
on -> off round-trip through the snapshot (CI-runnable; the flag-on path
is inert without an engine). Adds a bridgeStateBoolean helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@monkopedia-reviewer monkopedia-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 (feature_internal; small off-by-default frontend UI addition). Reviewed the whole diff to merge standard:

  • The SettingSwitchRow("Code completion & errors (LSP)") matches the existing theme/keymap/display toggle idiom exactly (same row right below 'Show code on left'); wired to the pre-existing SettingsViewModel.setLspEnabled / lspEnabled StateFlow (PersistedStateFlow-backed, so it reflects persisted state).
  • AppStateSnapshot.lspEnabled is fully wired — field + populate from settingsVm.lspEnabled.value + refresh collector — mirroring how editorTheme/keymap are already done; no half-wired field.
  • bridgeStateBoolean mirrors bridgeStateInt. testLspEnabledToggle is non-tautological: asserts the default-off -> on -> off round-trip through the snapshot via the already-exposed setLspEnabled bridge action; CI-safe since the flag-on path is inert without an engine.
  • Switch-off is byte-for-byte the prior editor (default unchanged). Apache headers untouched; no scope creep — exactly the 5 described files.

CI: build-and-test PASS (spotlessCheck all modules, shadowJar, test, :e2e:test -Pe2e under Xvfb incl. the new test). Auto-merging.

@monkopedia-reviewer monkopedia-reviewer merged commit d7d6ac6 into main Jun 4, 2026
1 check passed
@monkopedia-reviewer monkopedia-reviewer deleted the lsp-settings-toggle branch June 4, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants