MCPcopy Create free account
hub / github.com/bytebase/bytebase / DidChange

Method DidChange

backend/api/lsp/fs.go:31–44  ·  view source on GitHub ↗

DidChange notifies the file system that a file was changed.

(params *lsp.DidChangeTextDocumentParams)

Source from the content-addressed store, hash-verified

29
30// DidChange notifies the file system that a file was changed.
31func (fs *MemFS) DidChange(params *lsp.DidChangeTextDocumentParams) error {
32 content, found := fs.get(params.TextDocument.URI)
33 if !found {
34 return errors.Errorf("received textDocument/didChange for unknown file %q", params.TextDocument.URI)
35 }
36
37 content, err := applyContentChanges(params.TextDocument.URI, content, params.ContentChanges)
38 if err != nil {
39 return err
40 }
41
42 fs.set(params.TextDocument.URI, content)
43 return nil
44}
45
46func applyContentChanges(uri lsp.DocumentURI, content []byte, changes []lsp.TextDocumentContentChangeEvent) ([]byte, error) {
47 for _, change := range changes {

Callers 1

Calls 4

getMethod · 0.95
setMethod · 0.95
applyContentChangesFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected