d2lsp

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
)

Directories

Path Synopsis
Package lspserver implements the stdio language server for D2.
Package lspserver implements the stdio language server for D2.

Jump to

Keyboard shortcuts

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