Sfoglia il codice sorgente

Add needsRefresh to lint source config (#13050)

GitOrigin-RevId: bc6880f87bc81c7f0f022268a4d070c267421c46
Alf Eaton 3 anni fa
parent
commit
c7544531c1

+ 4 - 1
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 = () =>

+ 0 - 13
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
-    //       }
-    //     },
-    //   }
-    // }),
   ]
 }