(ctx *glsp.Context, params *protocol.HoverParams)
| 13 | ) |
| 14 | |
| 15 | func (s *Server) TextDocumentHover(ctx *glsp.Context, params *protocol.HoverParams) (*protocol.Hover, error) { |
| 16 | doc, err := s.docs.Read(ctx.Context, uri.URI(params.TextDocument.URI)) |
| 17 | if err != nil { |
| 18 | return nil, err |
| 19 | } |
| 20 | defer doc.Close() |
| 21 | switch doc.LanguageIdentifier() { |
| 22 | case protocol.DockerBakeLanguage: |
| 23 | return hcl.Hover(ctx.Context, params, doc.(document.BakeHCLDocument)) |
| 24 | case protocol.DockerComposeLanguage: |
| 25 | if s.composeSupport { |
| 26 | return compose.Hover(ctx.Context, params, doc.(document.ComposeDocument)) |
| 27 | } |
| 28 | return nil, nil |
| 29 | case protocol.DockerfileLanguage: |
| 30 | instruction := doc.(document.DockerfileDocument).Instruction(params.Position) |
| 31 | if instruction != nil && strings.EqualFold(instruction.Value, "FROM") && instruction.Next != nil { |
| 32 | return s.scoutService.Hover(ctx.Context, params.TextDocument.URI, instruction.Next.Value) |
| 33 | } |
| 34 | return nil, nil |
| 35 | } |
| 36 | return nil, errors.New("URI did not map to a recognized document") |
| 37 | } |
no test coverage detected