Debian Codegraph @

gopls/internal/file/modification.go

raw symbols SCIP
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package file
6
7 import "golang.org/x/tools/gopls/internal/protocol"
8
9 // Modification represents a modification to a file.
10 type Modification struct {
11 URI protocol.DocumentURI
12 Action Action
13
14 // OnDisk is true if a watched file is changed on disk.
15 // If true, Version will be -1 and Text will be nil.
16 OnDisk bool
17
18 // Version will be -1 and Text will be nil when they are not supplied,
19 // specifically on textDocument/didClose and for on-disk changes.
20 Version int32
21 Text []byte
22
23 // LanguageID is only sent from the language client on textDocument/didOpen.
24 LanguageID protocol.LanguageKind
25 }
26
27 // An Action is a type of file state change.
28 type Action int
29
30 const (
31 UnknownAction = Action(iota)
32 Open
33 Change
34 Close
35 Save
36 Create
37 Delete
38 )
39
40 func (a Action) String() string {
41 switch a {
42 case Open:
43 return "Open"
44 case Change:
45 return "Change"
46 case Close:
47 return "Close"
48 case Save:
49 return "Save"
50 case Create:
51 return "Create"
52 case Delete:
53 return "Delete"
54 default:
55 return "Unknown"
56 }
57 }