@@ -8,7 +8,7 @@ import { createLogger } from '../logger'
8
8
import { BufferOption , DidChangeTextDocumentParams , HighlightItem , HighlightItemOption , TextDocumentContentChange } from '../types'
9
9
import { isVim } from '../util/constants'
10
10
import { diffLines , getTextEdit } from '../util/diff'
11
- import { disposeAll , getConditionValue , wait , waitNextTick } from '../util/index'
11
+ import { disposeAll , getConditionValue , sha256 , wait , waitNextTick } from '../util/index'
12
12
import { isUrl } from '../util/is'
13
13
import { debounce , path } from '../util/node'
14
14
import { equals , toObject } from '../util/object'
@@ -17,7 +17,7 @@ import { Disposable, Emitter, Event } from '../util/protocol'
17
17
import { byteIndex , byteLength , byteSlice , characterIndex , toText } from '../util/string'
18
18
import { applyEdits , filterSortEdits , getPositionFromEdits , getStartLine , mergeTextEdits , TextChangeItem , toTextChanges } from '../util/textedit'
19
19
import { Chars } from './chars'
20
- import { firstDiffLine , LinesTextDocument } from './textdocument'
20
+ import { LinesTextDocument } from './textdocument'
21
21
const logger = createLogger ( 'document' )
22
22
23
23
export type LastChangeType = 'insert' | 'change' | 'delete'
@@ -627,15 +627,16 @@ export default class Document {
627
627
this . _forceSync ( )
628
628
}
629
629
630
- public async checkLines ( ) : Promise < void > {
630
+ public getSha256 ( ) : string {
631
+ return sha256 ( this . lines . join ( '\n' ) )
632
+ }
633
+
634
+ public async fetchLines ( ) : Promise < void > {
631
635
let lines = await this . nvim . call ( 'getbufline' , [ this . bufnr , 1 , '$' ] ) as ReadonlyArray < string >
632
- let diff = firstDiffLine ( this . lines , lines )
633
- if ( diff ) {
634
- this . lines = lines
635
- fireLinesChanged ( this . bufnr )
636
- this . fireContentChanges ( )
637
- logger . error ( `Buffer ${ this . bufnr } not synchronized on line ${ diff [ 0 ] } \nExpected:${ diff [ 2 ] } \nCurrent:${ diff [ 1 ] } ` )
638
- }
636
+ this . lines = lines
637
+ fireLinesChanged ( this . bufnr )
638
+ this . fireContentChanges ( )
639
+ logger . error ( `Buffer ${ this . bufnr } not synchronized on vim9, consider send bug report!` )
639
640
}
640
641
}
641
642
0 commit comments