Documentation
¶
Index ¶
- Variables
- func GetDefaultCapabilities() *lsproto.ClientCapabilities
- func SkipIfFailing(t *testing.T)
- type ApplyCodeActionFromCompletionOptions
- type CompletionsExpectedCodeAction
- type CompletionsExpectedItem
- type CompletionsExpectedItemDefaults
- type CompletionsExpectedItems
- type CompletionsExpectedList
- type EditRange
- type ExpectedCompletionEditRange
- type FoldingRangeLineExpected
- type FourslashTest
- func (f *FourslashTest) Backspace(t *testing.T, count int)
- func (f *FourslashTest) BaselineAutoImportsCompletions(t *testing.T, markerNames []string)
- func (f *FourslashTest) CloseFileOfMarker(t *testing.T, markerName string)
- func (f *FourslashTest) Configure(t *testing.T, config lsutil.UserPreferences)
- func (f *FourslashTest) ConfigureWithReset(t *testing.T, config lsutil.UserPreferences) (reset func())
- func (f *FourslashTest) DeleteAtCaret(t *testing.T, count int)
- func (f *FourslashTest) FormatDocument(t *testing.T, filename string)
- func (f *FourslashTest) FormatSelection(t *testing.T, startMarkerName string, endMarkerName string)
- func (f *FourslashTest) GetCompletions(t *testing.T, userPreferences *lsutil.UserPreferences) *lsproto.CompletionList
- func (f *FourslashTest) GetOptions() lsutil.UserPreferences
- func (f *FourslashTest) GetRangesByText() *collections.MultiMap[string, *RangeMarker]
- func (f *FourslashTest) GoToBOF(t *testing.T)
- func (f *FourslashTest) GoToEOF(t *testing.T)
- func (f *FourslashTest) GoToEachMarker(t *testing.T, markerNames []string, action func(marker *Marker, index int))
- func (f *FourslashTest) GoToEachRange(t *testing.T, action func(t *testing.T, rangeMarker *RangeMarker))
- func (f *FourslashTest) GoToFile(t *testing.T, filename string)
- func (f *FourslashTest) GoToFileNumber(t *testing.T, index int)
- func (f *FourslashTest) GoToMarker(t *testing.T, markerName string)
- func (f *FourslashTest) GoToMarkerOrRange(t *testing.T, markerOrRange MarkerOrRange)
- func (f *FourslashTest) GoToPosition(t *testing.T, position int)
- func (f *FourslashTest) GoToRangeStart(t *testing.T, rangeMarker *RangeMarker)
- func (f *FourslashTest) GoToSelect(t *testing.T, startMarkerName string, endMarkerName string)
- func (f *FourslashTest) GoToSelectRange(t *testing.T, rangeMarker *RangeMarker)
- func (f *FourslashTest) Insert(t *testing.T, text string)
- func (f *FourslashTest) InsertLine(t *testing.T, text string)
- func (f *FourslashTest) MarkTestAsStradaServer()
- func (f *FourslashTest) MarkerByName(t *testing.T, name string) *Marker
- func (f *FourslashTest) MarkerNames() []string
- func (f *FourslashTest) Markers() []*Marker
- func (f *FourslashTest) Paste(t *testing.T, text string)
- func (f *FourslashTest) Ranges() []*RangeMarker
- func (f *FourslashTest) RenameAtCaret(t *testing.T, newName string) lsproto.RenameResponse
- func (f *FourslashTest) Replace(t *testing.T, start int, length int, text string)
- func (f *FourslashTest) ReplaceLine(t *testing.T, lineIndex int, text string)
- func (f *FourslashTest) ResolveCompletionItem(t *testing.T, item *lsproto.CompletionItem) *lsproto.CompletionItem
- func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, markerName *string, ...)
- func (f *FourslashTest) VerifyBaselineCallHierarchy(t *testing.T)
- func (f *FourslashTest) VerifyBaselineClosingTags(t *testing.T)
- func (f *FourslashTest) VerifyBaselineCodeLens(t *testing.T, preferences *lsutil.UserPreferences)
- func (f *FourslashTest) VerifyBaselineDocumentHighlights(t *testing.T, preferences *lsutil.UserPreferences, ...)
- func (f *FourslashTest) VerifyBaselineDocumentHighlightsWithOptions(t *testing.T, preferences *lsutil.UserPreferences, filesToSearch []string, ...)
- func (f *FourslashTest) VerifyBaselineDocumentSymbol(t *testing.T)
- func (f *FourslashTest) VerifyBaselineFindAllReferences(t *testing.T, markers ...string)
- func (f *FourslashTest) VerifyBaselineGoToDefinition(t *testing.T, includeOriginalSelectionRange bool, markers ...string)
- func (f *FourslashTest) VerifyBaselineGoToImplementation(t *testing.T, markerNames ...string)
- func (f *FourslashTest) VerifyBaselineGoToSourceDefinition(t *testing.T, markers ...string)
- func (f *FourslashTest) VerifyBaselineGoToTypeDefinition(t *testing.T, markers ...string)
- func (f *FourslashTest) VerifyBaselineHover(t *testing.T)
- func (f *FourslashTest) VerifyBaselineHoverWithVerbosity(t *testing.T, verbosityLevels map[string][]int)
- func (f *FourslashTest) VerifyBaselineInlayHints(t *testing.T, span *lsproto.Range, testPreferences *lsutil.UserPreferences)
- func (f *FourslashTest) VerifyBaselineLinkedEditing(t *testing.T)
- func (f *FourslashTest) VerifyBaselineNonSuggestionDiagnostics(t *testing.T)
- func (f *FourslashTest) VerifyBaselineRename(t *testing.T, preferences *lsutil.UserPreferences, ...)
- func (f *FourslashTest) VerifyBaselineRenameAtRangesWithText(t *testing.T, preferences *lsutil.UserPreferences, texts ...string)
- func (f *FourslashTest) VerifyBaselineSelectionRanges(t *testing.T)
- func (f *FourslashTest) VerifyBaselineSignatureHelp(t *testing.T)
- func (f *FourslashTest) VerifyBaselineWorkspaceSymbol(t *testing.T, query string)
- func (f *FourslashTest) VerifyCodeFix(t *testing.T, options VerifyCodeFixOptions)
- func (f *FourslashTest) VerifyCodeFixAll(t *testing.T, options VerifyCodeFixAllOptions)
- func (f *FourslashTest) VerifyCodeFixAvailable(t *testing.T, expectedDescriptions []string)
- func (f *FourslashTest) VerifyCodeFixAvailableExact(t *testing.T, expectedDescriptions []string)
- func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, expected *CompletionsExpectedList) VerifyCompletionsResult
- func (f *FourslashTest) VerifyCurrentFileContent(t *testing.T, expectedContent string)
- func (f *FourslashTest) VerifyCurrentLineContent(t *testing.T, expectedContent string)
- func (f *FourslashTest) VerifyDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
- func (f *FourslashTest) VerifyErrorExistsAfterMarker(t *testing.T, markerName string)
- func (f *FourslashTest) VerifyErrorExistsAtRange(t *testing.T, rangeMarker *RangeMarker, code int, message string)
- func (f *FourslashTest) VerifyErrorExistsBeforeMarker(t *testing.T, markerName string)
- func (f *FourslashTest) VerifyErrorExistsBetweenMarkers(t *testing.T, startMarkerName string, endMarkerName string)
- func (f *FourslashTest) VerifyFoldingRangeLines(t *testing.T, expected []FoldingRangeLineExpected)
- func (f *FourslashTest) VerifyImportFixAtPosition(t *testing.T, expectedTexts []string, preferences *lsutil.UserPreferences)
- func (f *FourslashTest) VerifyImportFixModuleSpecifiers(t *testing.T, markerName string, expectedModuleSpecifiers []string, ...)
- func (f *FourslashTest) VerifyIndentation(t *testing.T, numSpaces int)
- func (f *FourslashTest) VerifyJsxClosingTag(t *testing.T, markersToNewText map[string]*string)
- func (f *FourslashTest) VerifyLinkedEditing(t *testing.T, markerNamesToExpected map[string][]lsproto.Range)
- func (f *FourslashTest) VerifyNoErrors(t *testing.T)
- func (f *FourslashTest) VerifyNoSignatureHelp(t *testing.T)
- func (f *FourslashTest) VerifyNoSignatureHelpForMarkers(t *testing.T, markers ...string)
- func (f *FourslashTest) VerifyNoSignatureHelpForMarkersWithContext(t *testing.T, context *lsproto.SignatureHelpContext, markers ...string)
- func (f *FourslashTest) VerifyNoSignatureHelpWithContext(t *testing.T, context *lsproto.SignatureHelpContext)
- func (f *FourslashTest) VerifyNonSuggestionDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
- func (f *FourslashTest) VerifyNotQuickInfoExists(t *testing.T)
- func (f *FourslashTest) VerifyNumberOfErrorsInCurrentFile(t *testing.T, expectedCount int)
- func (f *FourslashTest) VerifyOrganizeImports(t *testing.T, expectedContent string, codeActionKind lsproto.CodeActionKind, ...)
- func (f *FourslashTest) VerifyOutliningSpans(t *testing.T, foldingRangeKind ...lsproto.FoldingRangeKind)
- func (f *FourslashTest) VerifyQuickInfoAt(t *testing.T, marker string, expectedText string, expectedDocumentation string)
- func (f *FourslashTest) VerifyQuickInfoExists(t *testing.T)
- func (f *FourslashTest) VerifyQuickInfoIs(t *testing.T, expectedText string, expectedDocumentation string)
- func (f *FourslashTest) VerifyRename(t *testing.T, markerName string, newName string, ...)
- func (f *FourslashTest) VerifyRenameFailed(t *testing.T, preferences *lsutil.UserPreferences)
- func (f *FourslashTest) VerifyRenameSucceeded(t *testing.T, preferences *lsutil.UserPreferences)
- func (f *FourslashTest) VerifySemanticTokens(t *testing.T, expected []SemanticToken)
- func (f *FourslashTest) VerifySignatureHelp(t *testing.T, expected VerifySignatureHelpOptions)
- func (f *FourslashTest) VerifySignatureHelpPresent(t *testing.T, context *lsproto.SignatureHelpContext)
- func (f *FourslashTest) VerifySignatureHelpPresentForMarkers(t *testing.T, context *lsproto.SignatureHelpContext, markers ...string)
- func (f *FourslashTest) VerifySignatureHelpWithCases(t *testing.T, signatureHelpCases ...*SignatureHelpCase)
- func (f *FourslashTest) VerifySourceFixAll(t *testing.T, expectedContent string)
- func (f *FourslashTest) VerifySuggestionDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
- func (f *FourslashTest) VerifyWillRenameFilesEdits(t *testing.T, oldPath string, newPath string, ...)
- func (f *FourslashTest) VerifyWorkspaceSymbol(t *testing.T, cases []*VerifyWorkspaceSymbolCase)
- func (f *FourslashTest) WillRenameFiles(t *testing.T, files ...*lsproto.FileRename) lsproto.WillRenameFilesResponse
- type Ignored
- type Marker
- type MarkerInput
- type MarkerOrRange
- type MarkerOrRangeOrName
- type RangeMarker
- type SemanticToken
- type SignatureHelpCase
- type TestData
- type TestFileInfo
- type VerifyCodeFixAllOptions
- type VerifyCodeFixOptions
- type VerifyCompletionsResult
- type VerifySignatureHelpOptions
- type VerifyWorkspaceSymbolCase
Constants ¶
This section is empty.
Variables ¶
var AnyTextEdits *[]*lsproto.TextEdit
Functions ¶
func GetDefaultCapabilities ¶
func GetDefaultCapabilities() *lsproto.ClientCapabilities
func SkipIfFailing ¶
SkipIfFailing checks if the current test is in the failingTests.txt file and skips it unless the TSGO_FOURSLASH_IGNORE_FAILING environment variable is set. This allows tests to be marked as failing without modifying the test files themselves.
Types ¶
type ApplyCodeActionFromCompletionOptions ¶
type ApplyCodeActionFromCompletionOptions struct {
Name string
Source string
AutoImportFix *lsproto.AutoImportFix
Description string
NewFileContent *string
NewRangeContent *string
UserPreferences *lsutil.UserPreferences
}
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 *lsutil.UserPreferences
}
type EditRange ¶
type EditRange struct {
Insert *RangeMarker
Replace *RangeMarker
}
type FoldingRangeLineExpected ¶
FoldingRangeLineExpected represents expected start and end lines for a folding range.
type FourslashTest ¶
type FourslashTest struct {
// contains filtered or unexported fields
}
func NewFourslash ¶
func NewFourslash(t *testing.T, capabilities *lsproto.ClientCapabilities, content string) (*FourslashTest, func())
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) CloseFileOfMarker ¶
func (f *FourslashTest) CloseFileOfMarker(t *testing.T, markerName string)
func (*FourslashTest) Configure ¶
func (f *FourslashTest) Configure(t *testing.T, config lsutil.UserPreferences)
func (*FourslashTest) ConfigureWithReset ¶
func (f *FourslashTest) ConfigureWithReset(t *testing.T, config lsutil.UserPreferences) (reset func())
func (*FourslashTest) DeleteAtCaret ¶
func (f *FourslashTest) DeleteAtCaret(t *testing.T, count int)
DeleteAtCaret removes the text at the current caret position as if the user pressed delete `count` times.
func (*FourslashTest) FormatDocument ¶
func (f *FourslashTest) FormatDocument(t *testing.T, filename string)
func (*FourslashTest) FormatSelection ¶
func (f *FourslashTest) FormatSelection(t *testing.T, startMarkerName string, endMarkerName string)
func (*FourslashTest) GetCompletions ¶
func (f *FourslashTest) GetCompletions(t *testing.T, userPreferences *lsutil.UserPreferences) *lsproto.CompletionList
func (*FourslashTest) GetOptions ¶
func (f *FourslashTest) GetOptions() lsutil.UserPreferences
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 (*FourslashTest) GoToEachRange ¶
func (f *FourslashTest) GoToEachRange(t *testing.T, action func(t *testing.T, rangeMarker *RangeMarker))
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) MarkTestAsStradaServer ¶
func (f *FourslashTest) MarkTestAsStradaServer()
func (*FourslashTest) MarkerByName ¶
func (f *FourslashTest) MarkerByName(t *testing.T, name string) *Marker
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) RenameAtCaret ¶ added in v0.0.2
func (f *FourslashTest) RenameAtCaret(t *testing.T, newName string) lsproto.RenameResponse
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) ResolveCompletionItem ¶
func (f *FourslashTest) ResolveCompletionItem(t *testing.T, item *lsproto.CompletionItem) *lsproto.CompletionItem
func (*FourslashTest) VerifyApplyCodeActionFromCompletion ¶
func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, markerName *string, options *ApplyCodeActionFromCompletionOptions)
func (*FourslashTest) VerifyBaselineCallHierarchy ¶
func (f *FourslashTest) VerifyBaselineCallHierarchy(t *testing.T)
func (*FourslashTest) VerifyBaselineClosingTags ¶
func (f *FourslashTest) VerifyBaselineClosingTags(t *testing.T)
VerifyBaselineClosingTags generates a baseline for JSX closing tag completions at all markers.
func (*FourslashTest) VerifyBaselineCodeLens ¶
func (f *FourslashTest) VerifyBaselineCodeLens(t *testing.T, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifyBaselineDocumentHighlights ¶
func (f *FourslashTest) VerifyBaselineDocumentHighlights( t *testing.T, preferences *lsutil.UserPreferences, markerOrRangeOrNames ...MarkerOrRangeOrName, )
func (*FourslashTest) VerifyBaselineDocumentHighlightsWithOptions ¶ added in v0.0.2
func (f *FourslashTest) VerifyBaselineDocumentHighlightsWithOptions( t *testing.T, preferences *lsutil.UserPreferences, filesToSearch []string, markerOrRangeOrNames ...MarkerOrRangeOrName, )
func (*FourslashTest) VerifyBaselineDocumentSymbol ¶
func (f *FourslashTest) VerifyBaselineDocumentSymbol(t *testing.T)
func (*FourslashTest) VerifyBaselineFindAllReferences ¶
func (f *FourslashTest) VerifyBaselineFindAllReferences( t *testing.T, markers ...string, )
func (*FourslashTest) VerifyBaselineGoToDefinition ¶
func (f *FourslashTest) VerifyBaselineGoToDefinition( t *testing.T, includeOriginalSelectionRange bool, markers ...string, )
func (*FourslashTest) VerifyBaselineGoToImplementation ¶
func (f *FourslashTest) VerifyBaselineGoToImplementation(t *testing.T, markerNames ...string)
func (*FourslashTest) VerifyBaselineGoToSourceDefinition ¶
func (f *FourslashTest) VerifyBaselineGoToSourceDefinition( t *testing.T, markers ...string, )
func (*FourslashTest) VerifyBaselineGoToTypeDefinition ¶
func (f *FourslashTest) VerifyBaselineGoToTypeDefinition( t *testing.T, markers ...string, )
func (*FourslashTest) VerifyBaselineHover ¶
func (f *FourslashTest) VerifyBaselineHover(t *testing.T)
func (*FourslashTest) VerifyBaselineHoverWithVerbosity ¶ added in v0.0.2
func (f *FourslashTest) VerifyBaselineHoverWithVerbosity(t *testing.T, verbosityLevels map[string][]int)
func (*FourslashTest) VerifyBaselineInlayHints ¶
func (f *FourslashTest) VerifyBaselineInlayHints( t *testing.T, span *lsproto.Range, testPreferences *lsutil.UserPreferences, )
func (*FourslashTest) VerifyBaselineLinkedEditing ¶
func (f *FourslashTest) VerifyBaselineLinkedEditing(t *testing.T)
func (*FourslashTest) VerifyBaselineNonSuggestionDiagnostics ¶
func (f *FourslashTest) VerifyBaselineNonSuggestionDiagnostics(t *testing.T)
func (*FourslashTest) VerifyBaselineRename ¶
func (f *FourslashTest) VerifyBaselineRename( t *testing.T, preferences *lsutil.UserPreferences, markerOrNameOrRanges ...MarkerOrRangeOrName, )
func (*FourslashTest) VerifyBaselineRenameAtRangesWithText ¶
func (f *FourslashTest) VerifyBaselineRenameAtRangesWithText( t *testing.T, preferences *lsutil.UserPreferences, texts ...string, )
func (*FourslashTest) VerifyBaselineSelectionRanges ¶
func (f *FourslashTest) VerifyBaselineSelectionRanges(t *testing.T)
func (*FourslashTest) VerifyBaselineSignatureHelp ¶
func (f *FourslashTest) VerifyBaselineSignatureHelp(t *testing.T)
func (*FourslashTest) VerifyBaselineWorkspaceSymbol ¶
func (f *FourslashTest) VerifyBaselineWorkspaceSymbol(t *testing.T, query string)
func (*FourslashTest) VerifyCodeFix ¶ added in v0.0.2
func (f *FourslashTest) VerifyCodeFix(t *testing.T, options VerifyCodeFixOptions)
VerifyCodeFix verifies that applying a code fix produces the expected file content.
func (*FourslashTest) VerifyCodeFixAll ¶ added in v0.0.2
func (f *FourslashTest) VerifyCodeFixAll(t *testing.T, options VerifyCodeFixAllOptions)
VerifyCodeFixAll verifies that applying all code fixes with the given fixId produces the expected file content. It gets all quickfix code actions for the file (which includes per-fixId "Fix all" entries when multiple diagnostics match the same provider), finds the fix-all entry, and applies its edits.
func (*FourslashTest) VerifyCodeFixAvailable ¶ added in v0.0.2
func (f *FourslashTest) VerifyCodeFixAvailable(t *testing.T, expectedDescriptions []string)
VerifyCodeFixAvailable verifies that code fixes with the given descriptions are available.
func (*FourslashTest) VerifyCodeFixAvailableExact ¶ added in v0.0.2
func (f *FourslashTest) VerifyCodeFixAvailableExact(t *testing.T, expectedDescriptions []string)
VerifyCodeFixAvailableExact verifies that the exact set of code fix descriptions matches. Unlike VerifyCodeFixAvailable, this checks both that all expected descriptions are present and that no additional unexpected code fixes exist (exact count match).
func (*FourslashTest) VerifyCompletions ¶
func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, expected *CompletionsExpectedList) VerifyCompletionsResult
!!! user preferences param !!! completion context param
func (*FourslashTest) VerifyCurrentFileContent ¶
func (f *FourslashTest) VerifyCurrentFileContent(t *testing.T, expectedContent string)
func (*FourslashTest) VerifyCurrentLineContent ¶
func (f *FourslashTest) VerifyCurrentLineContent(t *testing.T, expectedContent string)
func (*FourslashTest) VerifyDiagnostics ¶
func (f *FourslashTest) VerifyDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
func (*FourslashTest) VerifyErrorExistsAfterMarker ¶
func (f *FourslashTest) VerifyErrorExistsAfterMarker(t *testing.T, markerName string)
VerifyErrorExistsAfterMarker verifies that an error exists after the given marker.
func (*FourslashTest) VerifyErrorExistsAtRange ¶
func (f *FourslashTest) VerifyErrorExistsAtRange(t *testing.T, rangeMarker *RangeMarker, code int, message string)
VerifyErrorExistsAtRange verifies that an error with the given code exists at the given range.
func (*FourslashTest) VerifyErrorExistsBeforeMarker ¶
func (f *FourslashTest) VerifyErrorExistsBeforeMarker(t *testing.T, markerName string)
VerifyErrorExistsBeforeMarker verifies that an error exists before the given marker.
func (*FourslashTest) VerifyErrorExistsBetweenMarkers ¶
func (f *FourslashTest) VerifyErrorExistsBetweenMarkers(t *testing.T, startMarkerName string, endMarkerName string)
VerifyErrorExistsBetweenMarkers verifies that an error exists between the two markers.
func (*FourslashTest) VerifyFoldingRangeLines ¶
func (f *FourslashTest) VerifyFoldingRangeLines(t *testing.T, expected []FoldingRangeLineExpected)
VerifyFoldingRangeLines verifies folding ranges by comparing only start and end lines. This is useful for testing with lineFoldingOnly where character positions are ignored.
func (*FourslashTest) VerifyImportFixAtPosition ¶
func (f *FourslashTest) VerifyImportFixAtPosition(t *testing.T, expectedTexts []string, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifyImportFixModuleSpecifiers ¶
func (f *FourslashTest) VerifyImportFixModuleSpecifiers( t *testing.T, markerName string, expectedModuleSpecifiers []string, preferences *lsutil.UserPreferences, )
func (*FourslashTest) VerifyIndentation ¶
func (f *FourslashTest) VerifyIndentation(t *testing.T, numSpaces int)
func (*FourslashTest) VerifyJsxClosingTag ¶
func (f *FourslashTest) VerifyJsxClosingTag(t *testing.T, markersToNewText map[string]*string)
func (*FourslashTest) VerifyLinkedEditing ¶
func (*FourslashTest) VerifyNoErrors ¶
func (f *FourslashTest) VerifyNoErrors(t *testing.T)
VerifyNoErrors verifies that no errors exist in any open files.
func (*FourslashTest) VerifyNoSignatureHelp ¶
func (f *FourslashTest) VerifyNoSignatureHelp(t *testing.T)
VerifyNoSignatureHelp verifies that no signature help is available at the current position.
func (*FourslashTest) VerifyNoSignatureHelpForMarkers ¶
func (f *FourslashTest) VerifyNoSignatureHelpForMarkers(t *testing.T, markers ...string)
VerifyNoSignatureHelpForMarkers verifies that no signature help is available at the given markers.
func (*FourslashTest) VerifyNoSignatureHelpForMarkersWithContext ¶
func (f *FourslashTest) VerifyNoSignatureHelpForMarkersWithContext(t *testing.T, context *lsproto.SignatureHelpContext, markers ...string)
VerifyNoSignatureHelpForMarkersWithContext verifies that no signature help is available at the given markers with a given context.
func (*FourslashTest) VerifyNoSignatureHelpWithContext ¶
func (f *FourslashTest) VerifyNoSignatureHelpWithContext(t *testing.T, context *lsproto.SignatureHelpContext)
VerifyNoSignatureHelpWithContext verifies that no signature help is available at the current position with a given context.
func (*FourslashTest) VerifyNonSuggestionDiagnostics ¶
func (f *FourslashTest) VerifyNonSuggestionDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
Similar to `VerifyDiagnostics`, but excludes suggestion diagnostics returned from server.
func (*FourslashTest) VerifyNotQuickInfoExists ¶
func (f *FourslashTest) VerifyNotQuickInfoExists(t *testing.T)
func (*FourslashTest) VerifyNumberOfErrorsInCurrentFile ¶
func (f *FourslashTest) VerifyNumberOfErrorsInCurrentFile(t *testing.T, expectedCount int)
VerifyNumberOfErrorsInCurrentFile verifies that the current file has the expected number of errors.
func (*FourslashTest) VerifyOrganizeImports ¶
func (f *FourslashTest) VerifyOrganizeImports(t *testing.T, expectedContent string, codeActionKind lsproto.CodeActionKind, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifyOutliningSpans ¶
func (f *FourslashTest) VerifyOutliningSpans(t *testing.T, foldingRangeKind ...lsproto.FoldingRangeKind)
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) VerifyRename ¶ added in v0.0.2
func (*FourslashTest) VerifyRenameFailed ¶
func (f *FourslashTest) VerifyRenameFailed(t *testing.T, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifyRenameSucceeded ¶
func (f *FourslashTest) VerifyRenameSucceeded(t *testing.T, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifySemanticTokens ¶ added in v0.0.2
func (f *FourslashTest) VerifySemanticTokens(t *testing.T, expected []SemanticToken)
func (*FourslashTest) VerifySignatureHelp ¶
func (f *FourslashTest) VerifySignatureHelp(t *testing.T, expected VerifySignatureHelpOptions)
VerifySignatureHelp verifies signature help at the current position matches the expected options.
func (*FourslashTest) VerifySignatureHelpPresent ¶
func (f *FourslashTest) VerifySignatureHelpPresent(t *testing.T, context *lsproto.SignatureHelpContext)
VerifySignatureHelpPresent verifies that signature help is available at the current position with a given context.
func (*FourslashTest) VerifySignatureHelpPresentForMarkers ¶
func (f *FourslashTest) VerifySignatureHelpPresentForMarkers(t *testing.T, context *lsproto.SignatureHelpContext, markers ...string)
VerifySignatureHelpPresentForMarkers verifies that signature help is available at the given markers with a given context.
func (*FourslashTest) VerifySignatureHelpWithCases ¶
func (f *FourslashTest) VerifySignatureHelpWithCases(t *testing.T, signatureHelpCases ...*SignatureHelpCase)
VerifySignatureHelpWithCases verifies signature help using detailed SignatureHelpCase structs. This is useful for more complex tests that need to verify the full signature help response.
func (*FourslashTest) VerifySourceFixAll ¶ added in v0.0.2
func (f *FourslashTest) VerifySourceFixAll(t *testing.T, expectedContent string)
VerifySourceFixAll verifies that requesting a source.fixAll code action produces the expected file content. This tests the on-save code path where VS Code requests source.fixAll.
func (*FourslashTest) VerifySuggestionDiagnostics ¶
func (f *FourslashTest) VerifySuggestionDiagnostics(t *testing.T, expected []*lsproto.Diagnostic)
Similar to `VerifyDiagnostics`, but includes only suggestion diagnostics returned from server.
func (*FourslashTest) VerifyWillRenameFilesEdits ¶ added in v0.0.2
func (f *FourslashTest) VerifyWillRenameFilesEdits(t *testing.T, oldPath string, newPath string, expectedFileContents map[string]string, preferences *lsutil.UserPreferences)
func (*FourslashTest) VerifyWorkspaceSymbol ¶
func (f *FourslashTest) VerifyWorkspaceSymbol(t *testing.T, cases []*VerifyWorkspaceSymbolCase)
`verify.navigateTo` in Strada.
func (*FourslashTest) WillRenameFiles ¶ added in v0.0.2
func (f *FourslashTest) WillRenameFiles(t *testing.T, files ...*lsproto.FileRename) lsproto.WillRenameFilesResponse
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) MakerWithSymlink ¶
type MarkerOrRange ¶
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) LSLocation ¶
func (r *RangeMarker) LSLocation() lsproto.Location
func (*RangeMarker) LSPos ¶
func (r *RangeMarker) LSPos() lsproto.Position
type SemanticToken ¶ added in v0.0.2
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
}
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 lsconv.Script.
type VerifyCodeFixAllOptions ¶ added in v0.0.2
VerifyCodeFixAllOptions are the options for VerifyCodeFixAll.
type VerifyCodeFixOptions ¶ added in v0.0.2
type VerifyCodeFixOptions struct {
Description string
NewFileContent string
Index int
ApplyChanges bool
}
VerifyCodeFixOptions are the options for VerifyCodeFix.
type VerifyCompletionsResult ¶
type VerifyCompletionsResult struct {
AndApplyCodeAction func(t *testing.T, expectedAction *CompletionsExpectedCodeAction)
AndHasNoCodeAction func(t *testing.T, unexpectedAction *CompletionsExpectedCodeAction)
}
type VerifySignatureHelpOptions ¶
type VerifySignatureHelpOptions struct {
// Text is the full signature text (e.g., "fn(x: string, y: number): void")
Text string
// DocComment is the documentation comment for the signature
DocComment string
// ParameterCount is the expected number of parameters
ParameterCount int
// ParameterName is the expected name of the active parameter
ParameterName string
// ParameterSpan is the expected label of the active parameter (e.g., "x: string")
ParameterSpan string
// ParameterDocComment is the documentation for the active parameter
ParameterDocComment string
// OverloadsCount is the expected number of overloads (signatures)
OverloadsCount int
// OverrideSelectedItemIndex overrides which signature to check (default: ActiveSignature)
OverrideSelectedItemIndex int
// IsVariadic indicates if the signature has a rest parameter
IsVariadic bool
// IsVariadicSet is true when IsVariadic was explicitly set (to distinguish from default false)
IsVariadicSet bool
}
VerifySignatureHelpOptions contains options for verifying signature help. All fields are optional - only specified fields will be verified.
type VerifyWorkspaceSymbolCase ¶
type VerifyWorkspaceSymbolCase struct {
Pattern string
Includes *[]*lsproto.SymbolInformation
Exact *[]*lsproto.SymbolInformation
Preferences *lsutil.UserPreferences
}