d2lsp

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Completion implements lsp autocomplete features Currently handles: - Complete dot and inside maps for reserved keyword holders (style, labels, etc) - Complete discrete values for keywords like shape - Complete suggestions for formats for keywords like opacity

d2lsp contains functions useful for IDE clients

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoardAtPosition

func GetBoardAtPosition(text string, pos d2ast.Position) ([]string, error)

func GetRefRanges

func GetRefRanges(path string, fs map[string]string, boardPath []string, key string) (ranges []d2ast.Range, importRanges []d2ast.Range, _ error)

Types

type CompletionItem

type CompletionItem struct {
	Label      string
	Kind       CompletionKind
	Detail     string
	InsertText string
}

func GetCompletionItems

func GetCompletionItems(text string, line, column int) ([]CompletionItem, error)

func GetCompletionItemsUTF16 added in v0.8.2

func GetCompletionItemsUTF16(text string, line, column int) ([]CompletionItem, error)

GetCompletionItemsUTF16 returns completions for a position whose column is measured in UTF-16 code units, as required by browser and LSP clients.

type CompletionKind

type CompletionKind int
const (
	KeywordCompletion CompletionKind = iota
	StyleCompletion
	ShapeCompletion
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL