From c7544531c19c9ca4a5efc0e2f40d725b0e02126c Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 16 May 2023 13:21:10 +0100 Subject: [PATCH] Add needsRefresh to lint source config (#13050) GitOrigin-RevId: bc6880f87bc81c7f0f022268a4d070c267421c46 --- .../source-editor/extensions/annotations.ts | 5 ++++- .../source-editor/languages/latex/linting.ts | 13 ------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/extensions/annotations.ts b/services/web/frontend/js/features/source-editor/extensions/annotations.ts index f28a1b66f8..a1611ddaa8 100644 --- a/services/web/frontend/js/features/source-editor/extensions/annotations.ts +++ b/services/web/frontend/js/features/source-editor/extensions/annotations.ts @@ -1,4 +1,4 @@ -import { EditorView } from '@codemirror/view' +import { EditorView, ViewUpdate } from '@codemirror/view' import { Diagnostic, linter, lintGutter } from '@codemirror/lint' import { Compartment, @@ -36,6 +36,9 @@ export const lintSourceConfig = { tooltipFilter() { return [] }, + needsRefresh(update: ViewUpdate) { + return update.selectionSet + }, } const compileLogLintSource = () => diff --git a/services/web/frontend/js/features/source-editor/languages/latex/linting.ts b/services/web/frontend/js/features/source-editor/languages/latex/linting.ts index a1e5d6e79a..8f6201a0d7 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/linting.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/linting.ts @@ -24,18 +24,5 @@ export const linting = () => { return null }), - - // TODO: enable this once https://github.com/overleaf/internal/issues/10055 is fixed - // ViewPlugin.define(view => { - // return { - // update(update) { - // // force the linter to run if the selection has changed - // if (update.selectionSet) { - // // note: no timeout needed as this is already asynchronous - // forceLinting(view, true) // TODO: true to force run even if doc hasn't changed - // } - // }, - // } - // }), ] }