MCPcopy Create free account
hub / github.com/docker/docker-language-server / Overwrite

Method Overwrite

internal/pkg/document/manager.go:187–204  ·  view source on GitHub ↗
(ctx context.Context, u uri.URI, version int32, input []byte)

Source from the content-addressed store, hash-verified

185}
186
187func (m *Manager) Overwrite(ctx context.Context, u uri.URI, version int32, input []byte) (bool, error) {
188 m.mu.Lock()
189 defer m.mu.Unlock()
190
191 if document, found := m.docs[u]; !found {
192 changed, err := m.parse(ctx, u, document.LanguageIdentifier(), version, input)
193 if err != nil {
194 return false, fmt.Errorf("could not parse file %q: %v", u, err)
195 }
196 return changed, nil
197 }
198
199 identifier := protocol.DockerfileLanguage
200 if strings.HasSuffix(string(u), "hcl") {
201 identifier = protocol.DockerBakeLanguage
202 }
203 return m.write(ctx, u, identifier, version, input)
204}
205
206func (m *Manager) Remove(u uri.URI) {
207 m.mu.Lock()

Callers 1

TextDocumentDidChangeMethod · 0.80

Calls 3

parseMethod · 0.95
writeMethod · 0.95
LanguageIdentifierMethod · 0.65

Tested by

no test coverage detected