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

Function ConvertToHCLPosition

internal/bake/hcl/parser/schema.go:285–293  ·  view source on GitHub ↗
(content string, line, column int)

Source from the content-addressed store, hash-verified

283}
284
285func ConvertToHCLPosition(content string, line, column int) hcl.Pos {
286 lines := strings.Split(content, "\n")
287 offset := 0
288 for i := range line {
289 offset += len(lines[i]) + 1
290 }
291 offset += column
292 return hcl.Pos{Line: line + 1, Column: column + 1, Byte: offset}
293}

Callers 3

HoverFunction · 0.92
CompletionFunction · 0.92
TestConvertToHCLPositionFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestConvertToHCLPositionFunction · 0.68