initialize codemirror lint styles once (#3185)
* fix diagnostic styles Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * Revert "fixes" This reverts commite7b2411ebc. * Revert "fix diagnostic styles" This reverts commit625099d9c8. * actual fix Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -6,7 +6,11 @@ import { Selections, processCodeMirrorRanges, Selection } from 'lib/selections'
|
|||||||
import { undo, redo } from '@codemirror/commands'
|
import { undo, redo } from '@codemirror/commands'
|
||||||
import { CommandBarMachineEvent } from 'machines/commandBarMachine'
|
import { CommandBarMachineEvent } from 'machines/commandBarMachine'
|
||||||
import { addLineHighlight, addLineHighlightEvent } from './highlightextension'
|
import { addLineHighlight, addLineHighlightEvent } from './highlightextension'
|
||||||
import { Diagnostic, setDiagnosticsEffect } from '@codemirror/lint'
|
import {
|
||||||
|
Diagnostic,
|
||||||
|
setDiagnostics,
|
||||||
|
setDiagnosticsEffect,
|
||||||
|
} from '@codemirror/lint'
|
||||||
|
|
||||||
const updateOutsideEditorAnnotation = Annotation.define<boolean>()
|
const updateOutsideEditorAnnotation = Annotation.define<boolean>()
|
||||||
export const updateOutsideEditorEvent = updateOutsideEditorAnnotation.of(true)
|
export const updateOutsideEditorEvent = updateOutsideEditorAnnotation.of(true)
|
||||||
@ -53,6 +57,12 @@ export default class EditorManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setEditorView(editorView: EditorView) {
|
setEditorView(editorView: EditorView) {
|
||||||
|
if (!this._editorView) {
|
||||||
|
// Initialize lint.
|
||||||
|
// This will initialize all the styles etc.
|
||||||
|
// We only want to do this once.
|
||||||
|
editorView.dispatch(setDiagnostics(editorView.state, []))
|
||||||
|
}
|
||||||
this._editorView = editorView
|
this._editorView = editorView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user