| 220 | } |
| 221 | |
| 222 | func (m *Manager) readAndParse(ctx context.Context, u uri.URI) (bool, error) { |
| 223 | identifier := protocol.DockerfileLanguage |
| 224 | if strings.HasSuffix(string(u), "hcl") { |
| 225 | identifier = protocol.DockerBakeLanguage |
| 226 | } else if strings.HasSuffix(string(u), "yml") || strings.HasSuffix(string(u), "yaml") { |
| 227 | identifier = protocol.DockerComposeLanguage |
| 228 | } |
| 229 | |
| 230 | if _, found := m.docs[u]; !found { |
| 231 | contents, err := m.readDocFunc(u) |
| 232 | if err != nil { |
| 233 | return false, err |
| 234 | } |
| 235 | return m.parse(ctx, u, identifier, 1, contents) |
| 236 | } |
| 237 | return m.parse(ctx, u, identifier, 1, nil) |
| 238 | } |
| 239 | |
| 240 | func (m *Manager) parse(_ context.Context, uri uri.URI, identifier protocol.LanguageIdentifier, version int32, input []byte) (bool, error) { |
| 241 | doc, loaded := m.docs[uri] |