Skip to content

Commit

Permalink
Fix flicker when typing in notebooks -- aggressive hueristic (#241784)
Browse files Browse the repository at this point in the history
fix flicker when typing in notebooks -- aggressive hueristic
  • Loading branch information
Yoyokrazy authored Feb 24, 2025
1 parent ac0e2ac commit 963c934
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class WordHighlighter {

// ignore typing & other
// need to check if the model is a notebook cell, should not stop if nb
if (e.source !== 'api' && e.reason !== CursorChangeReason.Explicit && this.editor.getModel()?.uri.scheme !== Schemas.vscodeNotebookCell) {
if (e.source !== 'api' && e.reason !== CursorChangeReason.Explicit) {
this._stopAll();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { indentOfLine } from '../../../../../../editor/common/model/textModel.js
import { ITextModelService } from '../../../../../../editor/common/services/resolverService.js';
import { ICoordinatesConverter } from '../../../../../../editor/common/viewModel.js';
import { ViewModelEventsCollector } from '../../../../../../editor/common/viewModelEventDispatcher.js';
import { WordHighlighterContribution } from '../../../../../../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
import { IAccessibilityService } from '../../../../../../platform/accessibility/common/accessibility.js';
import { MenuId, registerAction2 } from '../../../../../../platform/actions/common/actions.js';
import { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.js';
Expand Down Expand Up @@ -886,21 +885,6 @@ export class NotebookMultiCursorController extends Disposable implements INotebo
cell.decorationIds,
newDecorations
);

/**
* TODO: @Yoyokrazy debt
* goal: draw decorations for occurrence higlight on the cursor blink cycle
*
* Trigger WH with delay: x ms (x = cursor blink cycle)
* -> start = Date()
* -> WordHighlighter -> compute
* -> end = Date()
* -> delay = x - ((end - start) % x)
*/
const matchingEditor = this.notebookEditor.codeEditors.find(cellEditor => cellEditor[0] === cell.cellViewModel);
if (matchingEditor) {
WordHighlighterContribution.get(matchingEditor[1])?.wordHighlighter?.trigger();
}
});
}

Expand Down

0 comments on commit 963c934

Please sign in to comment.