fourslash

package
v0.0.0-...-c0ef09c Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionsExpectedItem

type CompletionsExpectedItem = any

*lsproto.CompletionItem | string

type CompletionsExpectedItemDefaults

type CompletionsExpectedItemDefaults struct {
	CommitCharacters *[]string
	EditRange        ExpectedCompletionEditRange
}

type CompletionsExpectedItems

type CompletionsExpectedItems struct {
	Includes []CompletionsExpectedItem
	Excludes []string
	Exact    []CompletionsExpectedItem
	Unsorted []CompletionsExpectedItem
}

type CompletionsExpectedList

type CompletionsExpectedList struct {
	IsIncomplete    bool
	ItemDefaults    *CompletionsExpectedItemDefaults
	Items           *CompletionsExpectedItems
	UserPreferences *ls.UserPreferences // !!! allow user preferences in fourslash
}

type EditRange

type EditRange struct {
	Insert  *RangeMarker
	Replace *RangeMarker
}

type ExpectedCompletionEditRange

type ExpectedCompletionEditRange = any

*EditRange | Ignored

type FourslashTest

type FourslashTest struct {
	// contains filtered or unexported fields
}

func NewFourslash

func NewFourslash(t *testing.T, capabilities *lsproto.ClientCapabilities, content string) *FourslashTest

func (*FourslashTest) Backspace

func (f *FourslashTest) Backspace(t *testing.T, count int)

Removes the text at the current caret position as if the user pressed backspace `count` times.

func (*FourslashTest) BaselineAutoImportsCompletions

func (f *FourslashTest) BaselineAutoImportsCompletions(t *testing.T, markerNames []string)

func (*FourslashTest) GetRangesByText

func (f *FourslashTest) GetRangesByText() *collections.MultiMap[string, *RangeMarker]

func (*FourslashTest) GoToBOF

func (f *FourslashTest) GoToBOF(t *testing.T)

func (*FourslashTest) GoToEOF

func (f *FourslashTest) GoToEOF(t *testing.T)

func (*FourslashTest) GoToEachMarker

func (f *FourslashTest) GoToEachMarker(t *testing.T, markerNames []string, action func(marker *Marker, index int))

func (*FourslashTest) GoToEachRange

func (f *FourslashTest) GoToEachRange(t *testing.T, action func(t *testing.T, rangeMarker *RangeMarker))

func (*FourslashTest) GoToFile

func (f *FourslashTest) GoToFile(t *testing.T, filename string)

func (*FourslashTest) GoToFileNumber

func (f *FourslashTest) GoToFileNumber(t *testing.T, index int)

func (*FourslashTest) GoToMarker

func (f *FourslashTest) GoToMarker(t *testing.T, markerName string)

func (*FourslashTest) GoToMarkerOrRange

func (f *FourslashTest) GoToMarkerOrRange(t *testing.T, markerOrRange MarkerOrRange)

func (*FourslashTest) GoToPosition

func (f *FourslashTest) GoToPosition(t *testing.T, position int)

func (*FourslashTest) GoToRangeStart

func (f *FourslashTest) GoToRangeStart(t *testing.T, rangeMarker *RangeMarker)

func (*FourslashTest) GoToSelect

func (f *FourslashTest) GoToSelect(t *testing.T, startMarkerName string, endMarkerName string)

func (*FourslashTest) GoToSelectRange

func (f *FourslashTest) GoToSelectRange(t *testing.T, rangeMarker *RangeMarker)

func (*FourslashTest) Insert

func (f *FourslashTest) Insert(t *testing.T, text string)

Insert text at the current caret position.

func (*FourslashTest) InsertLine

func (f *FourslashTest) InsertLine(t *testing.T, text string)

Insert text and a new line at the current caret position.

func (*FourslashTest) MarkerNames

func (f *FourslashTest) MarkerNames() []string

func (*FourslashTest) Markers

func (f *FourslashTest) Markers() []*Marker

func (*FourslashTest) Paste

func (f *FourslashTest) Paste(t *testing.T, text string)

Enters text as if the user had pasted it.

func (*FourslashTest) Ranges

func (f *FourslashTest) Ranges() []*RangeMarker

func (*FourslashTest) Replace

func (f *FourslashTest) Replace(t *testing.T, start int, length int, text string)

func (*FourslashTest) ReplaceLine

func (f *FourslashTest) ReplaceLine(t *testing.T, lineIndex int, text string)

Selects a line and replaces it with a new text.

func (*FourslashTest) VerifyBaselineFindAllReferences

func (f *FourslashTest) VerifyBaselineFindAllReferences(
	t *testing.T,
	markers ...string,
)

func (*FourslashTest) VerifyBaselineGoToDefinition

func (f *FourslashTest) VerifyBaselineGoToDefinition(
	t *testing.T,
	markers ...string,
)

func (*FourslashTest) VerifyBaselineHover

func (f *FourslashTest) VerifyBaselineHover(t *testing.T)

func (*FourslashTest) VerifyBaselineRename

func (f *FourslashTest) VerifyBaselineRename(
	t *testing.T,
	preferences *ls.UserPreferences,
	markerOrNameOrRanges ...MarkerOrRangeOrName,
)

func (*FourslashTest) VerifyBaselineRenameAtRangesWithText

func (f *FourslashTest) VerifyBaselineRenameAtRangesWithText(
	t *testing.T,
	preferences *ls.UserPreferences,
	texts ...string,
)

func (*FourslashTest) VerifyBaselineSignatureHelp

func (f *FourslashTest) VerifyBaselineSignatureHelp(t *testing.T)

func (*FourslashTest) VerifyCompletions

func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, expected *CompletionsExpectedList)

!!! user preferences param !!! completion context param

func (*FourslashTest) VerifyNotQuickInfoExists

func (f *FourslashTest) VerifyNotQuickInfoExists(t *testing.T)

func (*FourslashTest) VerifyQuickInfoAt

func (f *FourslashTest) VerifyQuickInfoAt(t *testing.T, marker string, expectedText string, expectedDocumentation string)

!!! expected tags

func (*FourslashTest) VerifyQuickInfoExists

func (f *FourslashTest) VerifyQuickInfoExists(t *testing.T)

func (*FourslashTest) VerifyQuickInfoIs

func (f *FourslashTest) VerifyQuickInfoIs(t *testing.T, expectedText string, expectedDocumentation string)

func (*FourslashTest) VerifyRenameFailed

func (f *FourslashTest) VerifyRenameFailed(t *testing.T, preferences *ls.UserPreferences)

func (*FourslashTest) VerifyRenameSucceeded

func (f *FourslashTest) VerifyRenameSucceeded(t *testing.T, preferences *ls.UserPreferences)

func (*FourslashTest) VerifySignatureHelp

func (f *FourslashTest) VerifySignatureHelp(t *testing.T, signatureHelpCases ...*SignatureHelpCase)

type Ignored

type Ignored = struct{}

type Marker

type Marker struct {
	Position   int
	LSPosition lsproto.Position
	Name       *string // `nil` for anonymous markers such as `{| "foo": "bar" |}`
	Data       map[string]any
	// contains filtered or unexported fields
}

func (*Marker) FileName

func (m *Marker) FileName() string

func (*Marker) GetName

func (m *Marker) GetName() *string

func (*Marker) LSPos

func (m *Marker) LSPos() lsproto.Position

type MarkerInput

type MarkerInput = any

string | *Marker | []string | []*Marker

type MarkerOrRange

type MarkerOrRange interface {
	FileName() string
	LSPos() lsproto.Position
	GetName() *string
}

type MarkerOrRangeOrName

type MarkerOrRangeOrName = any

string | *Marker | *RangeMarker

type RangeMarker

type RangeMarker struct {
	Range   core.TextRange
	LSRange lsproto.Range
	Marker  *Marker
	// contains filtered or unexported fields
}

Inserted in source files by surrounding desired text in a range with `[|` and `|]`. For example,

[|text in range|]

is a range with `text in range` "selected".

func (*RangeMarker) FileName

func (r *RangeMarker) FileName() string

func (*RangeMarker) GetName

func (r *RangeMarker) GetName() *string

func (*RangeMarker) LSPos

func (r *RangeMarker) LSPos() lsproto.Position

type SignatureHelpCase

type SignatureHelpCase struct {
	Context     *lsproto.SignatureHelpContext
	MarkerInput MarkerInput
	Expected    *lsproto.SignatureHelp
}

type TestData

type TestData struct {
	Files           []*TestFileInfo
	MarkerPositions map[string]*Marker
	Markers         []*Marker
	Symlinks        map[string]string
	GlobalOptions   map[string]string
	Ranges          []*RangeMarker
}

func ParseTestData

func ParseTestData(t *testing.T, contents string, fileName string) TestData

type TestFileInfo

type TestFileInfo struct {

	// The contents of the file (with markers, etc stripped out)
	Content string
	// contains filtered or unexported fields
}

func (*TestFileInfo) FileName

func (t *TestFileInfo) FileName() string

FileName implements ls.Script.

func (*TestFileInfo) Text

func (t *TestFileInfo) Text() string

Text implements ls.Script.

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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