Skip to content

Commit

Permalink
Add guards for possible null value in cm.state.vim introduced by code…
Browse files Browse the repository at this point in the history
…mirror-vim
  • Loading branch information
firai committed Sep 9, 2024
1 parent f1ed5a8 commit 512a64d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/codemirrorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class VimEditorManager {
// we override `hasFocus` handler to ensure it is taken into account.
const cm = getCM(view)!;
cm.on('vim-mode-change', () => {
if (!cm.state.vim) return;

Check failure on line 102 in src/codemirrorCommands.ts

View workflow job for this annotation

GitHub Actions / build

Expected { after 'if' condition
editor.host.dataset.jpVimModeName = cm.state.vim.mode;
});
mirrorEditor.hasFocus = () => {
Expand Down
1 change: 1 addition & 0 deletions src/labCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export function addNotebookCommands(
return;
}
const vim = cm.state.vim;
if (!vim) return;

Check failure on line 183 in src/labCommands.ts

View workflow job for this annotation

GitHub Actions / build

Expected { after 'if' condition

// Get the current editor state
if (
Expand Down

0 comments on commit 512a64d

Please sign in to comment.