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

Method TextDocumentHover

internal/pkg/server/hover.go:15–37  ·  view source on GitHub ↗
(ctx *glsp.Context, params *protocol.HoverParams)

Source from the content-addressed store, hash-verified

13)
14
15func (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}

Callers 1

HandleMethod · 0.80

Calls 8

HoverFunction · 0.92
HoverFunction · 0.92
URIMethod · 0.65
CloseMethod · 0.65
LanguageIdentifierMethod · 0.65
InstructionMethod · 0.65
HoverMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected