Skip to content

Commit

Permalink
change to "setVersion" func
Browse files Browse the repository at this point in the history
  • Loading branch information
njuCZ committed May 29, 2020
1 parent ec60691 commit 90aa33d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/filesystem/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (f *file) Version() int {
return f.version
}

func (f *file) IncrementVersion() {
f.version += 1
func (f *file) SetVersion(version int) {
f.version = version
}

func (f *file) Lines() source.Lines {
Expand Down
3 changes: 1 addition & 2 deletions internal/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ func (fs *fsystem) Change(fh VersionedFileHandler, changes FileChanges) error {
for _, change := range changes {
f.applyChange(change)
}

f.IncrementVersion()
f.SetVersion(fh.Version())
return nil
}

Expand Down
5 changes: 3 additions & 2 deletions internal/lsp/file_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
)

type fileChange struct {
text string
rng hcl.Range
text string
rng hcl.Range
version int
}

func FileChange(chEvent lsp.TextDocumentContentChangeEvent, f File) (*fileChange, error) {
Expand Down

0 comments on commit 90aa33d

Please sign in to comment.