fakeapi

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 21 Imported by: 0 modules, 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

Package fakeapi is an extension.API for the tests of the extensions under extensions/: a fake that does what the host does in memory, so a test runs the Activate of an extension and then looks at what it contributed (the views and their content, the Output channels, the Problems markers, the commands, the status bar items), triggers what the user does (run a command, change a setting, publish an event) and lets the work the extension posted to the UI thread run. It is never compiled into Emetos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRangeEdits

func ApplyRangeEdits(text string, edits []extension.RangeEdit) (string, error)

ApplyRangeEdits applies edits whose ranges (lines and byte columns from 0) are in the text, as the window does: the edits do not overlap, and the ones at the same place keep their order.

func OnRequestValue

func OnRequestValue[P any](a *API, topic string, fn func(ctx context.Context, p P) (any, error))

OnRequestValue is OnRequest for a double that answers at once, with a function of the payload decoded into a P. A payload that does not decode into a P is answered with the error of the decoding.

Types

type API

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

API is the fake. Make one with New; every method of extension.API is implemented, and the fields below are what a test looks at. It is safe for use from several goroutines, as the real API is.

func New

New makes a fake API for a test. info is the scope the extension runs in; with a Folder, Workspace() reads that folder from disk and lists its files.

func (*API) AllBanners

func (a *API) AllBanners() []*FakeBanner

AllBanners are the banners the extension showed, the first first, the disposed ones included (see FakeBanner.Shown).

func (*API) AnnotationKeys

func (a *API) AnnotationKeys() []string

AnnotationKeys are the keys that hold a set, sorted.

func (*API) Annotations

func (a *API) Annotations(uri string) []extension.LineAnnotation

Annotations are the annotations the editors of the document would draw, sorted by line (the sets in the order of their keys).

func (*API) AnswerFileChooser

func (a *API) AnswerFileChooser(path string, err error)

AnswerFileChooser queues the answer of the next call of FileChooser().Open: the path chosen ("" for a dialog that was closed), or the error.

func (*API) AnswerLocations

func (a *API) AnswerLocations(feature string, fn func(uri string, pos extension.Position) ([]extension.Location, error))

AnswerLocations sets what Languages().References (feature "references") or Implementations ("implementations") answers: fn is called on the goroutine of the request with the URI and the position, and its answer reaches the extension's done function on the next Pump, as the window hands it over on the UI thread. Without it the feature fails with ExtensionNoProvider, as a language with no server does.

func (*API) Applied

func (a *API) Applied() []extension.WorkspaceEdit

Applied are the edits that were applied with Documents().Apply, the first first.

func (*API) Ask

func (a *API) Ask(ctx context.Context, topic string, value any) (extension.Event, error)

Ask makes a request of the extension's own handler of the topic (set with Events().Handle) as another extension would, and returns the reply or the error. The handler runs on the caller's goroutine, which stands for the UI thread. It fails with EventNoHandler when the extension handles no such topic.

func (*API) AskAs

func (a *API) AskAs(ctx context.Context, publisher, topic string, value any) (extension.Event, error)

AskAs is Ask for a request made by the extension with the id publisher, which the handler reads in Event.Publisher (the terminal reads who asked from it: any extension is what the bus says it is).

func (*API) Banners

func (a *API) Banners() extension.Banners

Banners implements extension.API.

func (*API) Channel

func (a *API) Channel(name string) *Channel

Channel returns the Output channel with the name, or nil.

func (*API) Clipboard

func (a *API) Clipboard() extension.Clipboard

Clipboard implements extension.API: the text is recorded (ClipboardTexts).

func (*API) ClipboardTexts

func (a *API) ClipboardTexts() []string

ClipboardTexts are the texts the extension wrote to the clipboard, the first first.

func (*API) CloseWindowTab

func (a *API) CloseWindowTab()

CloseWindowTab ends the tab as the window does when the user closes it: OnClose is called.

func (*API) ClosedHow

func (a *API) ClosedHow() []extension.TabClose

ClosedHow is the TabClose each closed tab was closed with, in the order of ClosedTabs.

func (*API) ClosedTabs

func (a *API) ClosedTabs() []string

ClosedTabs are the ids of the tabs CloseTabs closed, in order.

func (*API) CodeActionCalls

func (a *API) CodeActionCalls() []CodeActionCall

CodeActionCalls are the code actions the extension asked servers to apply, the first first.

func (*API) CodeLensRefreshes

func (a *API) CodeLensRefreshes() int

CodeLensRefreshes is how many times the extension asked for its code lenses to be asked again.

func (*API) Commands

func (a *API) Commands() extension.Commands

Commands implements extension.API.

func (*API) ContentLabel

func (a *API) ContentLabel(uri string) string

ContentLabel is the label the provider of the URI gives the document ("" when there is no provider).

func (*API) ContentLanguage

func (a *API) ContentLanguage(uri string) string

ContentLanguage is the language the provider of the URI gives the document ("" when there is no provider or it says none).

func (*API) ContentProviderFor

func (a *API) ContentProviderFor(scheme string) *FakeContent

ContentProviderFor is the registered provider of a scheme, nil when none is.

func (*API) ContentText

func (a *API) ContentText(ctx context.Context, uri string) (string, error)

ContentText asks the provider of the URI's scheme for the text, as the window does when it opens the document; it fails with ExtContentUnknown when no provider has the scheme.

func (*API) Context

func (a *API) Context() extension.ContextKeys

Context implements extension.API.

func (*API) ContextKey

func (a *API) ContextKey(key string) any

ContextKey is the value of a context key the extension set, or nil.

func (*API) ContextKeyFor

func (a *API) ContextKeyFor(origin extension.Origin, key string) any

ContextKeyFor is the value of a context key the extension set for one screen with SetFor, or nil.

func (*API) Deactivate

func (a *API) Deactivate()

Deactivate ends the activation as closing the window tab does: the source controls go, and the calls of the API that change something fail with ExtensionDeactivated or do nothing.

func (*API) Debug

func (a *API) Debug() extension.Debug

Debug implements extension.API.

func (*API) DebugAdapter

func (a *API) DebugAdapter(ctx context.Context, debugType string, s extension.DebugSession, def *extension.DebugAdapter) (adapter *extension.DebugAdapter, err error)

DebugAdapter asks the factory of the debug type for the adapter of the session, as the host does when a session starts; def is the executable the manifest names, or nil. A panic takes the extension off. A debug type with no factory gives def.

func (*API) DebugConsoleText

func (a *API) DebugConsoleText() string

DebugConsoleText is what the extension wrote to the Debug Console.

func (*API) DebugCustomEvent

func (a *API) DebugCustomEvent(s *FakeDebugSession, event string, body json.RawMessage)

DebugCustomEvent makes the adapter of a session send an event the protocol does not define.

func (*API) DebugFactoryTypes

func (a *API) DebugFactoryTypes() []string

DebugFactoryTypes are the debug types that have a descriptor factory.

func (*API) DebugStarts

func (a *API) DebugStarts() []DebugStart

DebugStarts are the calls of StartDebugging, the first first.

func (*API) DebugTrackers

func (a *API) DebugTrackers(ctx context.Context, debugType string, s extension.DebugSession) []*extension.DebugAdapterTracker

DebugTrackers makes the trackers of a session as the host does: the factories of the type and of "*", in the order they were registered; a factory that fails or gives nil leaves its tracker out.

func (*API) Decorations

func (a *API) Decorations() extension.Decorations

Decorations implements extension.API.

func (*API) Dialogs

func (a *API) Dialogs() extension.Dialogs

Dialogs implements extension.API.

func (*API) DocumentText

func (a *API) DocumentText(uri string) (string, bool)

DocumentText is the text of an open document (one SetDocument made, or Apply opened or created), and whether it is open.

func (*API) Documents

func (a *API) Documents() extension.Documents

Documents implements extension.API.

func (*API) Drags

func (a *API) Drags() []*Drag

Drags are the drags the extension began, in order.

func (*API) EditorDecorations

func (a *API) EditorDecorations() extension.EditorDecorations

EditorDecorations implements extension.API.

func (*API) EditorTabs

func (a *API) EditorTabs() []*Tab

EditorTabs are the tabs the fake holds, in the order they were made.

func (*API) Editors

func (a *API) Editors() extension.Editors

Editors implements extension.API.

func (*API) Emit

func (a *API) Emit(topic string, value any)

Emit delivers an event to the subscribers whose pattern matches, at once, on the caller's goroutine (a test calls it on its own, which stands for the UI thread).

func (*API) EmitAs

func (a *API) EmitAs(publisher, topic string, value any)

EmitAs delivers an event to the subscribers whose pattern matches, at once, as if the extension with the id publisher had published it in this scope (Emit says the core did). It is how a test plays the other extension that publishes the events this one listens to, and checks that the subscriber reads Event.Publisher.

func (*API) EmitFrom

func (a *API) EmitFrom(from extension.ScopeInfo, topic string, value any)

EmitFrom delivers an event as if the scope published it: to the subscribers of the topic that listen to other window tabs (extension.FromOtherScopes), the way a link that the user allowed does.

func (*API) EndDebugSession

func (a *API) EndDebugSession(s *FakeDebugSession)

EndDebugSession ends a session, and the listeners of OnDidTerminateSession hear about it.

func (*API) Events

func (a *API) Events() extension.Events

Events implements extension.API.

func (*API) FailClipboard

func (a *API) FailClipboard(err error)

FailClipboard makes the clipboard fail with err from now on; nil makes it work again.

func (*API) FailEditorOpen

func (a *API) FailEditorOpen(fail bool)

FailEditorOpen makes Editors().Open fail after the content of the tab was made, as when the window cannot show the tab.

func (*API) FailHeadlessViews

func (a *API) FailHeadlessViews(err error)

FailHeadlessViews makes NewHeadlessView fail with err from now on; nil makes it work again.

func (*API) FailNotifications

func (a *API) FailNotifications(id string, err error)

FailNotifications makes the notifications the extension sends to the server with LanguageServers().Notify fail with err (nil stops failing).

func (*API) FailOpen

func (a *API) FailOpen(err error)

FailOpen makes OpenDiff and OpenDocument fail with err; nil makes them work again.

func (*API) FailOpenURI

func (a *API) FailOpenURI(err error)

FailOpenURI makes Workspace().OpenURI fail with err from now on; nil makes it work again.

func (*API) FailProvideContent

func (a *API) FailProvideContent(err error)

FailProvideContent makes Documents().ProvideContent fail with err (ExtensionDocumentUnavailable is what a scope that cannot show provided documents answers); nil makes it work again.

func (*API) FailSave

func (a *API) FailSave(err error)

FailSave makes SaveAll fail with err; nil makes it work again.

func (*API) FailShow

func (a *API) FailShow(err error)

FailShow makes Documents().Show fail with err (nil makes it succeed again); the call is still recorded, with the error.

func (*API) FailState

func (a *API) FailState(err error)

FailState makes State().Set fail with err from now on; nil makes it work again.

func (*API) FailTrash

func (a *API) FailTrash(err error)

FailTrash makes the next calls of Workspace().TrashFiles fail with err (nil makes them work again); FailUndoTrash does the same for the functions they returned.

func (*API) FailUndoTrash

func (a *API) FailUndoTrash(err error)

FailUndoTrash makes the undo functions of TrashFiles fail with err.

func (*API) FailUntitled

func (a *API) FailUntitled(err error)

FailUntitled makes Documents().OpenUntitled fail with err; nil makes it work again.

func (*API) FailWatches

func (a *API) FailWatches(err error)

FailWatches makes the next calls of Workspace().Watch fail with err (nil makes them work again).

func (*API) Failed

func (a *API) Failed() bool

Failed tells whether the fake took the extension off because of a panic in one of its callbacks, as the host does (SPEC §10.15 "Containment").

func (*API) FileChooser

func (a *API) FileChooser() extension.FileChooser

FileChooser implements extension.API.

func (*API) FileChooserCalls

func (a *API) FileChooserCalls() []ChooserCall

FileChooserCalls are the calls of FileChooser().Open so far.

func (*API) FileDecoration

func (a *API) FileDecoration(uri string) (extension.FileDecoration, bool)

FileDecoration is the decoration of a file as the views would get it from the newest provider that has a valid one.

func (*API) FileDecorationProviders

func (a *API) FileDecorationProviders() []*FakeDecorations

FileDecorationProviders are the providers that are registered (not disposed, and not ended with the activation), the newest first.

func (*API) FileViewOpens

func (a *API) FileViewOpens() []FileViewOpen

FileViewOpens are the calls of FileViews().Open.

func (*API) FileViewRefreshes

func (a *API) FileViewRefreshes() int

FileViewRefreshes is how many times a file view asked to be built again.

func (*API) FileViews

func (a *API) FileViews() extension.FileViews

FileViews implements extension.API.

func (a *API) FollowAnnotationLink(uri string, line int, dest string)

FollowAnnotationLink clicks the link dest in the hover of the annotation at the line of the document, as the editor does: a link to a command of the extension (declared by its manifest or registered by it, with a handler) runs it; everything else is ignored. It does nothing when the document has no annotation at the line with a hover. The command runs on this goroutine, as the UI thread would.

func (*API) HasHandler

func (a *API) HasHandler(id string) bool

HasHandler tells whether a command has a handler.

func (*API) HeadlessViews

func (a *API) HeadlessViews() []*HeadlessView

HeadlessViews are the views the extension made, in order.

func (*API) InputBox

func (a *API) InputBox() extension.InputBox

InputBox implements extension.API.

func (*API) Inputs

func (a *API) Inputs() []*Input

Inputs are the input boxes the extension showed, the first first.

func (*API) Keybindings

func (a *API) Keybindings() extension.Keybindings

Keybindings implements extension.API.

func (*API) LanguageServers

func (a *API) LanguageServers() extension.LanguageServers

LanguageServers implements extension.API. The servers are those of the manifest; each is idle until SetServerStatus.

func (*API) Languages

func (a *API) Languages() extension.Languages

Languages implements extension.API.

func (*API) LastInput

func (a *API) LastInput() *Input

LastInput is the input box shown last, or nil.

func (*API) LastPick

func (a *API) LastPick() *Pick

LastPick is the quick pick shown last, or nil.

func (*API) Launch

func (a *API) Launch(ctx context.Context, id string) (extension.ServerLaunch, error)

Launch runs the launcher of the server as the host does at a start: with the folder of the scope and the settings of the fake (the values a test set and the defaults of the settings the manifest declares), from the calling goroutine. It fails the test when the extension set no launcher; the answer and the error are the launcher's.

func (*API) Launcher

func (a *API) Launcher(id string) extension.ServerLauncher

Launcher is the launcher the extension gave the server, or nil.

func (*API) LocationRequests

func (a *API) LocationRequests() []LocationRequest

LocationRequests are the calls of References and Implementations so far, the first first.

func (*API) Log

func (a *API) Log() *slog.Logger

Log implements extension.API.

func (*API) MarkerCount

func (a *API) MarkerCount() int

MarkerCount is the number of markers of all owners.

func (*API) Markers

func (a *API) Markers(owner string) map[string][]extension.Marker

Markers are the markers of an owner by URI.

func (*API) Menus

func (a *API) Menus() extension.Menus

Menus implements extension.API.

func (*API) MultiDiffFiles

func (a *API) MultiDiffFiles(ctx context.Context, kind, key string) (files []extension.MultiDiffResource, err error)

MultiDiffFiles asks the provider of the kind for the files of the set with the key, as the window does when it opens the set; it fails with ExtMultiDiffKindUnknown when no provider has the kind.

func (*API) MultiDiffProviderFor

func (a *API) MultiDiffProviderFor(kind string) *FakeMultiDiff

MultiDiffProviderFor is the registered provider of a kind, nil when none is.

func (*API) NewDebugSession

func (a *API) NewDebugSession(id, debugType, name string, cfg extension.DebugConfiguration) *FakeDebugSession

NewDebugSession makes a session. It is not running until StartDebugSession.

func (*API) Notes

func (a *API) Notes() []Note

Notes are the notifications shown so far.

func (*API) Notifications

func (a *API) Notifications() extension.Notifications

Notifications implements extension.API.

func (*API) OnCodeAction

func (a *API) OnCodeAction(fn func(CodeActionCall) (string, error))

OnCodeAction sets what a server answers to ApplyCodeAction: the title of the action it applied (empty for none) and the error. The function may call Documents().Apply. Without one the server offers no action.

func (*API) OnDebugStart

func (a *API) OnDebugStart(fn func(DebugStart) (bool, error))

OnDebugStart sets the function that answers StartDebugging; without one it answers true. It is called with the lock released.

func (*API) OnRequest

func (a *API) OnRequest(topic string, fn RequestDouble)

OnRequest makes fn answer the requests of the extension for the topic. It is how a test fakes the core request topics of Emetos (extension.TopicFilesList, extension.TopicDocumentEdit, extension.TopicCommandsExecute and the others, SPEC §10.19 "Core request topics") and the handled topics of other extensions: the fake has no core and no other extension. A second call for the topic replaces the first.

func (*API) OnServerCommand

func (a *API) OnServerCommand(fn func(ServerCall) error)

OnServerCommand sets what happens when the extension executes a command of a server: the function runs on the goroutine of the call and returns the error the extension is told (nil is success). It may call Documents().Apply, as a server that sends workspace/applyEdit does. Without one every command succeeds and changes nothing.

func (*API) OnServerRequest

func (a *API) OnServerRequest(id string, fn func(ServerRequest) (json.RawMessage, error))

OnServerRequest sets what the server answers to the requests of the extension: the JSON of the result, or an error. The function runs on the calling goroutine, which may be one of the extension (a request is made off the UI thread).

func (*API) OpenDialogs

func (a *API) OpenDialogs() []*FakeDialog

OpenDialogs are the dialogs that wait for an answer, in the order they were asked.

func (*API) OpenFileView

func (a *API) OpenFileView(viewID string, doc extension.DocumentHandle) (extension.FileViewContent, error)

OpenFileView makes the content of the file view the extension provided, as the window does when a tab shows it.

func (*API) OpenedDiffs

func (a *API) OpenedDiffs() []extension.DiffSpec

OpenedDiffs are the calls of OpenDiff, in order.

func (*API) OpenedDocuments

func (a *API) OpenedDocuments() []extension.OpenSpec

OpenedDocuments are the calls of OpenDocument, in order.

func (*API) OpenedFolders

func (a *API) OpenedFolders() []OpenedFolder

OpenedFolders are the calls of Workspace().OpenFolder, in order.

func (*API) OpenedMultiDiffs

func (a *API) OpenedMultiDiffs() []extension.MultiDiffSpec

OpenedMultiDiffs are the calls of OpenMultiDiff, in order.

func (*API) OpenedURIs

func (a *API) OpenedURIs() []string

OpenedURIs are the URIs the extension opened with Workspace().OpenURI.

func (*API) OpenedWindowTabs

func (a *API) OpenedWindowTabs() []string

OpenedWindowTabs are the kinds the extension opened with Workspace().OpenWindowTab.

func (*API) Origins

func (a *API) Origins() extension.Origins

Origins implements extension.API.

func (*API) Output

func (a *API) Output() extension.Output

Output implements extension.API.

func (*API) Picks

func (a *API) Picks() []*Pick

Picks are the quick picks the extension showed, the first first.

func (*API) Post

func (a *API) Post(fn func())

Post implements extension.API: the function waits for Pump.

func (*API) Problems

func (a *API) Problems() extension.Problems

Problems implements extension.API.

func (*API) ProblemsShown

func (a *API) ProblemsShown() int

ProblemsShown is how many times the extension asked for the Problems panel.

func (*API) Progresses

func (a *API) Progresses() []*FakeProgress

Progresses are the notifications with a progress bar shown so far.

func (*API) Proposals

func (a *API) Proposals() []*Proposal

Proposals are the proposed changes the extension has asked for, in order.

func (*API) ProvideDebugConfigurations

func (a *API) ProvideDebugConfigurations(ctx context.Context, debugType, folder string, trigger extension.DebugProviderTrigger) ([]extension.DebugConfiguration, error)

ProvideDebugConfigurations plays the listing of the configurations of a type for a trigger.

func (*API) Providers

func (a *API) Providers() []*ProviderRegistration

Providers lists the providers registered so far, in order, with the ones that were disposed of.

func (*API) PublishedEvents

func (a *API) PublishedEvents() []Published

PublishedEvents are the events the extension published, the first first.

func (*API) Pump

func (a *API) Pump() bool

Pump runs what the extension posted, and what that posts, as the UI thread does between two frames; it reports whether it ran anything.

func (*API) QuickPick

func (a *API) QuickPick() extension.QuickPick

QuickPick implements extension.API.

func (*API) RanCommands

func (a *API) RanCommands() []RanCommand

RanCommands are the commands that quick pick items ran.

func (*API) ReplaceCalls

func (a *API) ReplaceCalls() [][]extension.FileReplacement

ReplaceCalls are the files the extension passed to ReplaceInFiles, the first first.

func (*API) Requests

func (a *API) Requests() []RequestCall

Requests are the requests the extension made, the first first.

func (*API) RescanFiles

func (a *API) RescanFiles()

RescanFiles reads the list of files of the folder from disk, as the file index would: the paths relative to the folder, with forward slashes, in the order of a walk, leaving out the folders that start with a dot.

func (*API) ResolveDebugConfiguration

func (a *API) ResolveDebugConfiguration(ctx context.Context, debugType, folder string, cfg extension.DebugConfiguration) (extension.DebugConfiguration, error)

ResolveDebugConfiguration plays resolveDebugConfiguration of the host: the providers of the type, each with the result of the one before; a provider that gives nil ends it with nil (the launch is cancelled).

func (*API) ResolveDebugConfigurationSubstituted

func (a *API) ResolveDebugConfigurationSubstituted(ctx context.Context, debugType, folder string, cfg extension.DebugConfiguration) (extension.DebugConfiguration, error)

ResolveDebugConfigurationSubstituted plays resolveDebugConfigurationWithSubstitutedVariables: the providers of the type, then those of "*".

func (*API) RestoreTab

func (a *API) RestoreTab(kindID, id string, state json.RawMessage) *Tab

RestoreTab makes a tab as the window does for a tab that came back from the last session: Create gets the state the tab saved.

func (*API) RevealedFiles

func (a *API) RevealedFiles() []Revealed

RevealedFiles are the calls of Workspace().RevealFile, in order.

func (*API) Run

func (a *API) Run(id string, args any) error

Run runs the handler a command was given, as the palette does.

func (*API) RunAs

func (a *API) RunAs(origin extension.Origin, f func())

RunAs calls f with Origins().Current() returning origin, as a command that a client ran in its view would: the handlers of the extension run inside it.

func (*API) RunCtx

func (a *API) RunCtx(ctx context.Context, id string, args any) error

RunCtx is Run with the context of the command.

func (*API) RunNoteAction

func (a *API) RunNoteAction(note int, label string)

RunNoteAction presses the button with the label on the notification with the index, as the user does; it fails the test when there is no such button.

func (*API) SavedAll

func (a *API) SavedAll() [][]string

SavedAll are the files each call of SaveAll saved, in order.

func (*API) Scope

func (a *API) Scope() extension.ScopeInfo

Scope implements extension.API.

func (*API) SearchCalls

func (a *API) SearchCalls() []SearchCall

SearchCalls are the calls of FindTextInFiles, the first first.

func (*API) ServerCalls

func (a *API) ServerCalls() []ServerCall

ServerCalls are the commands the extension asked servers to execute, the first first.

func (*API) ServerNotify

func (a *API) ServerNotify(id, method string, params any)

ServerNotify delivers a notification of the server to the listeners of its method, on the calling goroutine, as the host does on the UI thread. params must encode to JSON.

func (*API) ServerOutputShown

func (a *API) ServerOutputShown(id string) int

ServerOutputShown is how many times the extension showed the Output channel of the server.

func (*API) ServerRequests

func (a *API) ServerRequests(id string) []ServerRequest

ServerRequests are the requests the extension sent to the server, the first first.

func (*API) ServerRestarts

func (a *API) ServerRestarts(id string) int

ServerRestarts is how many times the extension restarted the server.

func (*API) SetActive

func (a *API) SetActive(doc *extension.ActiveDocument)

SetActive makes the document the active text editor with the selections, as the window reports it (Documents().Active); nil for none.

func (*API) SetActiveDebugSession

func (a *API) SetActiveDebugSession(s *FakeDebugSession)

SetActiveDebugSession focuses a session (nil: none), and the listeners of OnDidChangeActiveSession hear about it.

func (*API) SetActiveMergeEditor

func (a *API) SetActiveMergeEditor(m *extension.ActiveMerge)

SetActiveMergeEditor puts a merge editor in front, as Documents().ActiveMergeEditor reports it; nil takes it away.

func (*API) SetComplete

func (a *API) SetComplete(complete bool)

SetComplete says whether the walk of the folder has finished.

func (*API) SetDebugUnavailable

func (a *API) SetDebugUnavailable(unavailable bool)

SetDebugUnavailable makes the registrations and StartDebugging fail with ExtensionDebugUnavailable, as they do in a host with no debug service.

func (*API) SetDirty

func (a *API) SetDirty(uris ...string)

SetDirty sets the files Documents().Dirty lists.

func (*API) SetDocument

func (a *API) SetDocument(uri, text string)

SetDocument makes the document with the URI open with the text, as an editor with unsaved changes has it: Documents().Read answers with it, and Apply changes it.

func (*API) SetEditorDecorationsUnavailable

func (a *API) SetEditorDecorationsUnavailable(unavailable bool)

SetEditorDecorationsUnavailable makes Set fail as the host does in a scope that has no editors (a host without a workbench), with the tag ExtensionEditorDecorationsUnavailable.

func (*API) SetHistoryUnavailable

func (a *API) SetHistoryUnavailable(unavailable bool)

SetHistoryUnavailable makes SetHistoryProvider fail as the host does in a scope that has no Graph view (a host without a workbench), with the tag ExtensionHistoryUnavailable.

func (*API) SetLogger

func (a *API) SetLogger(l *slog.Logger)

SetLogger replaces the logger of the extension, which the API gives it with Log. Call it before the extension is activated; a test uses it to see what the extension logs.

func (*API) SetProblemsUnavailable

func (a *API) SetProblemsUnavailable(off bool)

SetProblemsUnavailable makes Problems().Set, Read and Show fail as a scope with no Problems panel does (a headless host).

func (*API) SetQuickDiffUnavailable

func (a *API) SetQuickDiffUnavailable(unavailable bool)

SetQuickDiffUnavailable makes AddQuickDiffProvider and Documents().QuickDiffOriginal fail as the host does in a scope that has no editors (a host without a workbench), with the tag ExtensionQuickDiffUnavailable.

func (*API) SetServerCommands

func (a *API) SetServerCommands(server string, commands []string)

SetServerCommands sets what LanguageServers().Commands answers for the server: the commands the running server announced.

func (*API) SetServerEncoding

func (a *API) SetServerEncoding(id, encoding string)

SetServerEncoding sets the position encoding PositionEncoding reports ("utf-8", "utf-16" or "utf-32").

func (*API) SetServerStatus

func (a *API) SetServerStatus(id string, status extension.ServerStatus)

SetServerStatus changes the status of a server of the manifest and calls its listeners, on the test's goroutine, as the host does on the UI thread.

func (*API) SetSetting

func (a *API) SetSetting(key string, value any)

SetSetting changes a setting as the user does and tells the listeners, on the test's goroutine.

func (*API) SetState

func (a *API) SetState(key string, value any)

SetState keeps a value as the host would have, before the extension is activated (the choice a user made in an earlier session).

func (*API) SetTabs

func (a *API) SetTabs(tabs ...extension.DocumentTab)

SetTabs sets the tabs Documents().Tabs lists.

func (*API) SetTestingUnavailable

func (a *API) SetTestingUnavailable(unavailable bool)

SetTestingUnavailable makes CreateTestController fail with ExtensionTestingUnavailable, as it does in a host with no testing service.

func (*API) SetTimelineUnavailable

func (a *API) SetTimelineUnavailable(unavailable bool)

SetTimelineUnavailable makes RegisterProvider fail with ExtensionTimelineUnavailable, as it does in a host with no workbench.

func (*API) SetTokenizer

func (a *API) SetTokenizer(fn func(languageID, text string) ([][]extension.Token, error))

SetTokenizer sets the function Languages().Tokenize calls.

func (*API) SetViewState

func (a *API) SetViewState(viewID string, raw json.RawMessage)

SetViewState gives a view the state it saved in an earlier session: Provide hands it to RestoreState, as the host does.

func (*API) SettingUpdates

func (a *API) SettingUpdates() []SettingUpdate

SettingUpdates are the calls of Settings().Update.

func (*API) Settings

func (a *API) Settings() extension.Settings

Settings implements extension.API.

func (*API) ShareOrigins

func (a *API) ShareOrigins(m *OriginMemory)

ShareOrigins makes the fake remember in the memory, so that what it keeps is what Recall of the fakes that share it answers.

func (*API) ShareTerminalEnvironment

func (a *API) ShareTerminalEnvironment(s *TerminalSources)

ShareTerminalEnvironment makes the fake use the registry of sources, so that what it contributes reaches the Contributions of the fakes that share it. A fake has a registry of its own until then; what it contributed already moves to the shared one.

func (*API) ShownBanners

func (a *API) ShownBanners() []*FakeBanner

ShownBanners are the banners that are up now.

func (*API) ShownDocuments

func (a *API) ShownDocuments() []Shown

ShownDocuments are the calls of Documents().Show.

func (*API) SourceControl

func (a *API) SourceControl() extension.SourceControls

SourceControl implements extension.API.

func (*API) SourceControlByHandle

func (a *API) SourceControlByHandle(handle string) *FakeSource

SourceControlByHandle returns the source control with the handle, or nil.

func (*API) SourceControls

func (a *API) SourceControls() []*FakeSource

SourceControls are the source controls that are shown (not disposed, and not ended with the activation), in the order they were created.

func (*API) StartDebugSession

func (a *API) StartDebugSession(s *FakeDebugSession)

StartDebugSession makes the session run, and the listeners of OnDidStartSession hear about it.

func (*API) StartWindowTab

func (a *API) StartWindowTab(id string, state json.RawMessage) *WindowTab

StartWindowTab makes the tab of the kind the extension provided, as the window does when the tab opens or comes back: Create gets the state the tab saved (nil for a new tab).

func (*API) State

func (a *API) State() extension.State

State implements extension.API.

func (*API) StateKeys

func (a *API) StateKeys() []string

StateKeys are the keys that have a value, sorted.

func (*API) StatusBar

func (a *API) StatusBar() extension.StatusBar

StatusBar implements extension.API.

func (*API) StatusItem

func (a *API) StatusItem(id string) *StatusItem

StatusItem returns the status bar item with the id, or nil.

func (*API) TerminalEnvironment

func (a *API) TerminalEnvironment() extension.TerminalEnvironment

TerminalEnvironment implements extension.API.

func (*API) TerminalSourceCount

func (a *API) TerminalSourceCount() int

TerminalSourceCount is how many sources of terminal variables the registry of the fake holds, from all the fakes that share it.

func (*API) TestController

func (a *API) TestController(id string) *FakeTestController

TestController returns the controller the extension made with the id, or nil.

func (*API) TestControllers

func (a *API) TestControllers() []*FakeTestController

TestControllers lists the controllers, in the order they were made.

func (*API) Tests

func (a *API) Tests() extension.Tests

Tests implements extension.API.

func (*API) Timeline

func (a *API) Timeline() extension.Timelines

Timeline implements extension.API.

func (*API) TimelineProvider

func (a *API) TimelineProvider(id string) *FakeTimeline

TimelineProvider is the registered provider with the ID, or nil.

func (*API) TimelineProviders

func (a *API) TimelineProviders() []*FakeTimeline

TimelineProviders are the providers that are registered (not disposed, and not ended with the activation).

func (*API) TrashedFiles

func (a *API) TrashedFiles() []*Trashed

TrashedFiles are the calls of Workspace().TrashFiles, in order.

func (*API) UntitledDocuments

func (a *API) UntitledDocuments() []Untitled

UntitledDocuments are the calls of Documents().OpenUntitled, in order.

func (*API) View

func (a *API) View(id string) *View

View returns the view the extension provided with the id, or nil.

func (*API) ViewIDs

func (a *API) ViewIDs() []string

ViewIDs lists the ids of the views the extension provided.

func (*API) Views

func (a *API) Views() extension.Views

Views implements extension.API.

func (*API) WaitFor

func (a *API) WaitFor(what string, cond func() bool)

WaitFor pumps until cond holds, or fails the test after the timeout. cond runs on the test's goroutine, as the UI thread.

func (*API) Watches

func (a *API) Watches() []*FakeWatch

Watches are the watches that are on, in the order they were made.

func (*API) WindowTabs

func (a *API) WindowTabs() extension.WindowTabs

WindowTabs implements extension.API.

func (*API) Workspace

func (a *API) Workspace() extension.Workspace

Workspace implements extension.API.

type Channel

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

Channel is an Output channel the extension made.

func (*Channel) AppendLine

func (c *Channel) AppendLine(text string)

AppendLine implements extension.OutputChannel.

func (*Channel) Clear

func (c *Channel) Clear()

Clear implements extension.OutputChannel.

func (*Channel) Dispose

func (c *Channel) Dispose()

Dispose implements extension.OutputChannel.

func (*Channel) Lines

func (c *Channel) Lines() []string

Lines are the lines written to the channel.

func (*Channel) Name

func (c *Channel) Name() string

Name implements extension.OutputChannel.

func (*Channel) Show

func (c *Channel) Show(bool)

Show implements extension.OutputChannel.

func (*Channel) Shown

func (c *Channel) Shown() int

Shown is how many times Show was called.

type ChooserCall

type ChooserCall struct {
	Options extension.FileChooserOptions
}

ChooserCall is a call of FileChooser().Open or Save (Options.Save tells which).

type CodeActionCall

type CodeActionCall struct {
	Server, URI string
	Req         extension.CodeActionRequest
}

CodeActionCall is a call of LanguageServers().ApplyCodeAction.

type DebugStart

type DebugStart struct {
	Folder  string
	Target  extension.DebugTarget
	Options extension.DebugStartOptions
}

DebugStart is a call of StartDebugging.

type Document

type Document struct {

	// Edits are the batches the view applied, and Opened the files it opened.
	Edits  [][]extension.TextEdit
	Opened []string
	// contains filtered or unexported fields
}

Document is a document handle for a test of a file view: it holds a text, records the calls and lets the test change the text and scroll the editor.

func NewDocument

func NewDocument(uri, lang, folder, text string) *Document

NewDocument makes a document with a URI, a language, the folder of the workspace and a text.

func (*Document) Edit

func (d *Document) Edit(edits []extension.TextEdit) error

Edit implements extension.DocumentHandle: the batch is recorded.

func (*Document) Folder

func (d *Document) Folder() string

Folder implements extension.DocumentHandle.

func (*Document) LanguageID

func (d *Document) LanguageID() string

LanguageID implements extension.DocumentHandle.

func (*Document) Listeners

func (d *Document) Listeners() (change, scroll int)

Listeners are how many callbacks of OnChange and OnScroll are still registered.

func (*Document) OnChange

func (d *Document) OnChange(fn func(extension.ViewDocumentChange)) func()

OnChange implements extension.DocumentHandle.

func (*Document) OnScroll

func (d *Document) OnScroll(fn func(int)) func()

OnScroll implements extension.DocumentHandle.

func (*Document) OpenFile

func (d *Document) OpenFile(path string) error

OpenFile implements extension.DocumentHandle: the path is recorded.

func (*Document) ReadOnly

func (d *Document) ReadOnly() bool

ReadOnly implements extension.DocumentHandle.

func (*Document) Scroll

func (d *Document) Scroll(line int)

Scroll scrolls the Text view to a line and tells the listeners.

func (*Document) SetText

func (d *Document) SetText(text string)

SetText changes the text and tells the listeners, as an edit of the editor does.

func (*Document) Text

func (d *Document) Text() string

Text implements extension.DocumentHandle.

func (*Document) TopLine

func (d *Document) TopLine() int

TopLine implements extension.DocumentHandle.

func (*Document) URI

func (d *Document) URI() string

URI implements extension.DocumentHandle.

func (*Document) Version

func (d *Document) Version() int

Version implements extension.DocumentHandle.

type Drag

type Drag struct {
	// Kind, Label and State are what BeginDrag was given.
	Kind, Label string
	State       json.RawMessage
	// Moves are the positions Move was called with; Ended and Dropped say how the drag ended.
	Moves          []ui.Offset
	Ended, Dropped bool
	// Tab is the tab that was opened by the drop.
	Tab *Tab
	// Refuse makes the drop open nothing, as a drop over something that takes no tab does.
	Refuse bool
	// contains filtered or unexported fields
}

Drag is a drag the extension began with Editors().BeginDrag: the fake records the pointer and, when the extension ends it with a drop, opens the tab as a window that accepts the drop would (a test makes the window refuse with Refuse).

func (*Drag) End

func (d *Drag) End(_ ui.Offset, drop bool) (bool, error)

End implements extension.EditorDrag.

func (*Drag) Move

func (d *Drag) Move(pos ui.Offset)

Move implements extension.EditorDrag.

type FakeBanner

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

FakeBanner is a banner the extension showed: a test reads what it shows and presses its buttons.

func (*FakeBanner) Banner

func (b *FakeBanner) Banner() extension.Banner

Banner is what the banner shows now.

func (*FakeBanner) Dispose

func (b *FakeBanner) Dispose()

Dispose implements extension.BannerHandle.

func (*FakeBanner) Press

func (b *FakeBanner) Press(label string)

Press presses the button with the label, as the user does; it fails the test when there is none.

func (*FakeBanner) Shown

func (b *FakeBanner) Shown() bool

Shown tells whether the banner is still up (it was not disposed).

func (*FakeBanner) Update

func (b *FakeBanner) Update(banner extension.Banner)

Update implements extension.BannerHandle.

type FakeContent

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

FakeContent is a provider the extension registered: a test reads the text it makes, and what the extension said changed.

func (*FakeContent) Changed

func (f *FakeContent) Changed(uris ...string)

Changed implements extension.ContentRegistration: it is recorded (ContentChanges).

func (*FakeContent) ContentChanges

func (f *FakeContent) ContentChanges() [][]string

ContentChanges are the calls of Changed of the provider, in order.

func (*FakeContent) Dispose

func (f *FakeContent) Dispose()

Dispose implements extension.ContentRegistration.

type FakeDebugSession

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

FakeDebugSession is a debug session that a test made start; it implements extension.DebugSession.

func (*FakeDebugSession) Configuration

func (s *FakeDebugSession) Configuration() extension.DebugConfiguration

Configuration implements extension.DebugSession.

func (*FakeDebugSession) CustomRequest

func (s *FakeDebugSession) CustomRequest(_ context.Context, command string, args any) (json.RawMessage, error)

CustomRequest implements extension.DebugSession.

func (*FakeDebugSession) CustomRequests

func (s *FakeDebugSession) CustomRequests() []string

CustomRequests are the commands of the custom requests the extension sent to the session.

func (*FakeDebugSession) Folder

func (s *FakeDebugSession) Folder() string

Folder implements extension.DebugSession.

func (*FakeDebugSession) ID

func (s *FakeDebugSession) ID() string

ID implements extension.DebugSession.

func (*FakeDebugSession) Name

func (s *FakeDebugSession) Name() string

Name implements extension.DebugSession.

func (*FakeDebugSession) OnCustomRequest

func (s *FakeDebugSession) OnCustomRequest(fn func(command string, args any) (json.RawMessage, error))

OnCustomRequest sets the function that answers CustomRequest; without one the answer is null.

func (*FakeDebugSession) Parent

Parent implements extension.DebugSession.

func (*FakeDebugSession) SetFolder

func (s *FakeDebugSession) SetFolder(folder string)

SetFolder and SetParent set the folder and the parent session of the session.

func (*FakeDebugSession) SetParent

func (s *FakeDebugSession) SetParent(p extension.DebugSession)

SetParent sets the parent session.

func (*FakeDebugSession) Type

func (s *FakeDebugSession) Type() string

Type implements extension.DebugSession.

type FakeDecorations

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

FakeDecorations is a provider the extension registered: a test asks it what the views would, and reads what the extension fired.

func (*FakeDecorations) Decoration

func (f *FakeDecorations) Decoration(uri string) (d extension.FileDecoration, ok bool)

Decoration asks the provider as the host does: an invalid decoration is not given, and a panic takes the extension off.

func (*FakeDecorations) Dispose

func (f *FakeDecorations) Dispose()

Dispose implements extension.FileDecorations.

func (*FakeDecorations) Disposed

func (f *FakeDecorations) Disposed() bool

Disposed says that the provider was disposed or the activation ended.

func (*FakeDecorations) Fire

func (f *FakeDecorations) Fire(uris ...string)

Fire implements extension.FileDecorations.

func (*FakeDecorations) Fired

func (f *FakeDecorations) Fired() [][]string

Fired are the calls of Fire, each with its URIs (none for "everything").

type FakeDialog

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

FakeDialog is a dialog the extension asked: it waits until the test answers it with Press or Cancel, in the order asked (the host shows one dialog at a time).

func (*FakeDialog) Cancel

func (d *FakeDialog) Cancel()

Cancel closes the dialog as Escape does: the answer is the cancel button, or -1.

func (*FakeDialog) Press

func (d *FakeDialog) Press(label string)

Press presses the button with the label (the answer comes when the test pumps). It fails the test when there is none.

func (*FakeDialog) Spec

func (d *FakeDialog) Spec() extension.DialogSpec

Spec is the dialog as the extension described it.

type FakeGroup

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

FakeGroup is a group of resources of a FakeSource.

func (*FakeGroup) ContextValue

func (g *FakeGroup) ContextValue() string

ContextValue is the value of scmResourceGroupState.

func (*FakeGroup) Dispose

func (g *FakeGroup) Dispose()

Dispose implements extension.ResourceGroup.

func (*FakeGroup) HideWhenEmpty

func (g *FakeGroup) HideWhenEmpty() bool

HideWhenEmpty tells whether the group is hidden while it has no resources.

func (*FakeGroup) ID

func (g *FakeGroup) ID() string

ID implements extension.ResourceGroup.

func (*FakeGroup) Label

func (g *FakeGroup) Label() string

Label is the title of the group.

func (*FakeGroup) Resources

func (g *FakeGroup) Resources() []extension.ResourceState

Resources are the resources of the group.

func (*FakeGroup) SetHideWhenEmpty

func (g *FakeGroup) SetHideWhenEmpty(hide bool)

SetHideWhenEmpty implements extension.ResourceGroup.

func (*FakeGroup) SetLabel

func (g *FakeGroup) SetLabel(label string)

SetLabel implements extension.ResourceGroup.

func (*FakeGroup) SetResources

func (g *FakeGroup) SetResources(resources []extension.ResourceState)

SetResources implements extension.ResourceGroup: the fake keeps its own copy of the list.

type FakeHistory

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

FakeHistory is the history provider the extension set on a source control.

func (*FakeHistory) CommonAncestor

func (h *FakeHistory) CommonAncestor(ctx context.Context, refs []string) (id string, err error)

CommonAncestor asks the provider for the common ancestor.

func (*FakeHistory) CurrentRefs

func (h *FakeHistory) CurrentRefs() (current, remote, base *extension.HistoryItemRef)

CurrentRefs are the references the extension set last: the current branch, the one it tracks and the base.

func (*FakeHistory) Dispose

func (h *FakeHistory) Dispose()

Dispose implements extension.HistoryRegistration.

func (*FakeHistory) Disposed

func (h *FakeHistory) Disposed() bool

Disposed tells whether the provider was disposed, or went with its source control or the activation.

func (*FakeHistory) Items

Items asks the provider for a page, as the Graph does.

func (*FakeHistory) OpenCommand

func (h *FakeHistory) OpenCommand() string

OpenCommand is the command the Graph runs when a row is opened.

func (*FakeHistory) Refs

func (h *FakeHistory) Refs(ctx context.Context, ids []string) (refs []extension.HistoryItemRef, err error)

Refs asks the provider for the references.

func (*FakeHistory) RefsChanged

func (h *FakeHistory) RefsChanged(c extension.HistoryRefsChange)

RefsChanged implements extension.HistoryRegistration.

func (*FakeHistory) RefsChanges

func (h *FakeHistory) RefsChanges() []extension.HistoryRefsChange

RefsChanges are the changes of references the extension told, in order.

func (*FakeHistory) SetCurrentRefs

func (h *FakeHistory) SetCurrentRefs(current, remote, base *extension.HistoryItemRef)

SetCurrentRefs implements extension.HistoryRegistration.

type FakeInput

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

FakeInput is the commit message box of a FakeSource.

func (*FakeInput) Enabled

func (in *FakeInput) Enabled() bool

Enabled tells whether the box accepts text.

func (*FakeInput) Focus

func (in *FakeInput) Focus()

Focus implements extension.SCMInput.

func (*FakeInput) FocusRequests

func (in *FakeInput) FocusRequests() int

FocusRequests counts the calls of Focus.

func (*FakeInput) OnChange

func (in *FakeInput) OnChange(fn func(value string)) (cancel func())

OnChange implements extension.SCMInput.

func (*FakeInput) Placeholder

func (in *FakeInput) Placeholder() string

Placeholder is the text shown while the box is empty.

func (*FakeInput) SetEnabled

func (in *FakeInput) SetEnabled(enabled bool)

SetEnabled implements extension.SCMInput.

func (*FakeInput) SetPlaceholder

func (in *FakeInput) SetPlaceholder(placeholder string)

SetPlaceholder implements extension.SCMInput.

func (*FakeInput) SetValidation

func (in *FakeInput) SetValidation(fn func(value string) *extension.Validation)

SetValidation implements extension.SCMInput.

func (*FakeInput) SetValue

func (in *FakeInput) SetValue(value string)

SetValue implements extension.SCMInput: the listeners are called later, when the test pumps, as the host calls them on the UI thread.

func (*FakeInput) SetVisible

func (in *FakeInput) SetVisible(visible bool)

SetVisible implements extension.SCMInput.

func (*FakeInput) Type

func (in *FakeInput) Type(text string)

Type is the user typing in the box: the text becomes the text of the box and the listeners are called when the test pumps.

func (*FakeInput) Validate

func (in *FakeInput) Validate(text string) (v *extension.Validation)

Validate is the view asking for the message under the box: what the validation function says for the text, nil when there is none. A panic in the function takes the extension off and gives no message.

func (*FakeInput) Value

func (in *FakeInput) Value() string

Value implements extension.SCMInput.

func (*FakeInput) Visible

func (in *FakeInput) Visible() bool

Visible tells whether the box is shown.

type FakeMultiDiff

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

FakeMultiDiff is a provider of sets of files the extension registered: a test asks it for the files of a key, and reads what the extension said changed.

func (*FakeMultiDiff) Changed

func (f *FakeMultiDiff) Changed(keys ...string)

Changed implements extension.MultiDiffRegistration: it is recorded (MultiDiffChanges).

func (*FakeMultiDiff) Dispose

func (f *FakeMultiDiff) Dispose()

Dispose implements extension.MultiDiffRegistration.

func (*FakeMultiDiff) MultiDiffChanges

func (f *FakeMultiDiff) MultiDiffChanges() [][]string

MultiDiffChanges are the calls of Changed of the provider, in order.

type FakeProgress

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

FakeProgress is a notification with a progress bar that the extension showed with Notifications().Progress.

func (*FakeProgress) Cancel

func (p *FakeProgress) Cancel()

Cancel presses the Cancel button, as the user does: OnCancel runs and the notification is gone (Ended is true afterwards). It fails the test when the progress is not cancellable.

func (*FakeProgress) Cancellable

func (p *FakeProgress) Cancellable() bool

Cancellable says that the progress has a Cancel button.

func (*FakeProgress) Done

func (p *FakeProgress) Done()

Done implements extension.NotificationProgress.

func (*FakeProgress) Ended

func (p *FakeProgress) Ended() bool

Ended says that Done was called.

func (*FakeProgress) Report

func (p *FakeProgress) Report(message string, percent float64)

Report implements extension.NotificationProgress.

func (*FakeProgress) Reports

func (p *FakeProgress) Reports() []ProgressReport

Reports are the calls of Report, in order.

func (*FakeProgress) Title

func (p *FakeProgress) Title() string

Title is the title the progress was shown with.

type FakeQuickDiff

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

FakeQuickDiff is a quick diff provider the extension registered on a source control.

func (*FakeQuickDiff) Dispose

func (q *FakeQuickDiff) Dispose()

Dispose implements extension.QuickDiffRegistration.

func (*FakeQuickDiff) Disposed

func (q *FakeQuickDiff) Disposed() bool

Disposed tells whether the provider was disposed, or went with its source control or the activation.

func (*FakeQuickDiff) Kind

Kind is the kind of the provider.

func (*FakeQuickDiff) Label

func (q *FakeQuickDiff) Label() string

Label is the label of the provider.

func (*FakeQuickDiff) Original

func (q *FakeQuickDiff) Original(ctx context.Context, uri string) (original string, err error)

Original asks the provider for the original of the file, as the window does, contained as the host contains a panic: the extension is off and the caller gets an error.

func (*FakeQuickDiff) Root

func (q *FakeQuickDiff) Root() string

Root is the root of the source control the provider is on (file:///path).

type FakeSource

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

FakeSource is a source control the extension created: a test reads what the view would show and does what the user does.

func (*FakeSource) AcceptInputCommand

func (s *FakeSource) AcceptInputCommand() extension.Command

AcceptInputCommand is the command of Ctrl+Enter, with an empty ID for none.

func (*FakeSource) ActionButton

func (s *FakeSource) ActionButton() *extension.ActionButton

ActionButton is the button under the input, nil for none.

func (*FakeSource) ActiveRepositoryName

func (s *FakeSource) ActiveRepositoryName() string

ActiveRepositoryName is the name set for the active repository, empty for none.

func (*FakeSource) AddQuickDiffProvider

AddQuickDiffProvider implements extension.SourceControl with the errors of the host: ExtensionDeactivated, ExtensionQuickDiffInvalid, ExtensionQuickDiffUnavailable, ExtensionSCMDisposed and ExtensionQuickDiffDuplicate.

func (*FakeSource) BadgeCount

func (s *FakeSource) BadgeCount() int

BadgeCount is the count of the badge of the repository: the count, else the number of resources of the groups.

func (*FakeSource) Busy

func (s *FakeSource) Busy() bool

Busy tells whether the progress bar is shown.

func (*FakeSource) ContextValue

func (s *FakeSource) ContextValue() string

ContextValue is the value of scmProviderContext.

func (*FakeSource) Count

func (s *FakeSource) Count() int

Count is the count the extension set, -1 for none.

func (*FakeSource) CreateGroup

CreateGroup implements extension.SourceControl with the errors of the host: ExtensionDeactivated, ExtensionSCMGroupInvalid, ExtensionSCMDisposed and ExtensionSCMGroupDuplicate.

func (*FakeSource) Dispose

func (s *FakeSource) Dispose()

Dispose implements extension.SourceControl.

func (*FakeSource) Group

func (s *FakeSource) Group(id string) *FakeGroup

Group returns the group with the id, or nil.

func (*FakeSource) Groups

func (s *FakeSource) Groups() []*FakeGroup

Groups are the groups that are shown, in the order they were created.

func (*FakeSource) Handle

func (s *FakeSource) Handle() string

Handle implements extension.SourceControl.

func (*FakeSource) History

func (s *FakeSource) History() *FakeHistory

History is the history provider of the source control, or nil when it has none (or it was disposed).

func (*FakeSource) ID

func (s *FakeSource) ID() string

ID is the id of the provider.

func (*FakeSource) Input

func (s *FakeSource) Input() extension.SCMInput

Input implements extension.SourceControl.

func (*FakeSource) Label

func (s *FakeSource) Label() string

Label is the label of the source control.

func (*FakeSource) QuickDiffProviders

func (s *FakeSource) QuickDiffProviders() []*FakeQuickDiff

QuickDiffProviders are the providers of the source control that are not disposed, in the order they were added.

func (*FakeSource) QuickDiffRefreshes

func (s *FakeSource) QuickDiffRefreshes() int

QuickDiffRefreshes is the number of RefreshQuickDiff calls of the source control.

func (*FakeSource) RefreshQuickDiff

func (s *FakeSource) RefreshQuickDiff()

RefreshQuickDiff implements extension.SourceControl: the call is counted (QuickDiffRefreshes).

func (*FakeSource) RootURI

func (s *FakeSource) RootURI() string

RootURI is the root of the repository.

func (*FakeSource) SetAcceptInputCommand

func (s *FakeSource) SetAcceptInputCommand(c extension.Command)

SetAcceptInputCommand implements extension.SourceControl.

func (*FakeSource) SetActionButton

func (s *FakeSource) SetActionButton(b *extension.ActionButton)

SetActionButton implements extension.SourceControl: the fake keeps its own copy, as the host does.

func (*FakeSource) SetActiveRepositoryName

func (s *FakeSource) SetActiveRepositoryName(name string)

SetActiveRepositoryName implements extension.SourceControl.

func (*FakeSource) SetBusy

func (s *FakeSource) SetBusy(busy bool)

SetBusy implements extension.SourceControl.

func (*FakeSource) SetCount

func (s *FakeSource) SetCount(count int)

SetCount implements extension.SourceControl.

func (*FakeSource) SetHistoryProvider

SetHistoryProvider implements extension.SourceControl with the errors of the host: ExtensionDeactivated, ExtensionHistoryInvalid, ExtensionHistoryUnavailable, ExtensionSCMDisposed and ExtensionHistoryDuplicate.

func (*FakeSource) SetStatusBarCommands

func (s *FakeSource) SetStatusBarCommands(commands []extension.StatusCommand)

SetStatusBarCommands implements extension.SourceControl.

func (*FakeSource) StatusBarCommands

func (s *FakeSource) StatusBarCommands() []extension.StatusCommand

StatusBarCommands are the items of the header.

type FakeTestController

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

FakeTestController is a test controller of the extension, with the means for a test to play Emetos.

func (*FakeTestController) Changes

Changes lists the changes of the controller's tree, in order.

func (*FakeTestController) CreateRunProfile

CreateRunProfile implements extension.TestController with the errors of the host.

func (*FakeTestController) CreateTestItem

func (c *FakeTestController) CreateTestItem(id, label, uri string) *extension.TestItem

CreateTestItem implements extension.TestController.

func (*FakeTestController) CreateTestRun

func (c *FakeTestController) CreateTestRun(request *extension.TestRunRequest, name string, persist bool) (extension.TestRun, error)

CreateTestRun implements extension.TestController with the errors of the host.

func (*FakeTestController) Dispose

func (c *FakeTestController) Dispose()

Dispose implements extension.TestController.

func (*FakeTestController) Disposed

func (c *FakeTestController) Disposed() bool

Disposed reports whether the controller was disposed, by the extension or by the end of the activation.

func (*FakeTestController) ID

func (c *FakeTestController) ID() string

ID implements extension.TestController.

func (*FakeTestController) InvalidateTestResults

func (c *FakeTestController) InvalidateTestResults(items ...*extension.TestItem)

InvalidateTestResults implements extension.TestController.

func (*FakeTestController) Invalidated

func (c *FakeTestController) Invalidated() [][]*extension.TestItem

Invalidated lists the calls of InvalidateTestResults with the items they named.

func (*FakeTestController) Items

Items implements extension.TestController.

func (*FakeTestController) Label

func (c *FakeTestController) Label() string

Label implements extension.TestController.

func (*FakeTestController) Profiles

func (c *FakeTestController) Profiles() []*FakeTestProfile

Profiles lists the profiles that were made and not disposed.

func (*FakeTestController) Refresh

func (c *FakeTestController) Refresh(ctx context.Context) error

Refresh plays the Refresh Tests command: it calls the refresh handler, and does nothing without one.

func (*FakeTestController) Resolve

func (c *FakeTestController) Resolve(ctx context.Context, item *extension.TestItem) error

Resolve plays the resolve of an item (nil for the whole tree): it calls the resolve handler, and does nothing without one.

func (*FakeTestController) Runs

func (c *FakeTestController) Runs() []*FakeTestRun

Runs lists the runs the extension made, in order.

func (*FakeTestController) SetLabel

func (c *FakeTestController) SetLabel(label string)

SetLabel implements extension.TestController.

func (*FakeTestController) SetRefreshHandler

func (c *FakeTestController) SetRefreshHandler(fn func(ctx context.Context) error)

SetRefreshHandler implements extension.TestController.

func (*FakeTestController) SetResolveHandler

func (c *FakeTestController) SetResolveHandler(fn func(ctx context.Context, item *extension.TestItem) error)

SetResolveHandler implements extension.TestController.

type FakeTestProfile

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

FakeTestProfile is a run profile of the extension.

func (*FakeTestProfile) Configure

func (p *FakeTestProfile) Configure() (bool, error)

Configure plays the user asking to configure the profile; it reports whether the profile has a configure handler.

func (*FakeTestProfile) Dispose

func (p *FakeTestProfile) Dispose()

Dispose implements extension.TestRunProfile.

func (*FakeTestProfile) IsDefault

func (p *FakeTestProfile) IsDefault() bool

IsDefault implements extension.TestRunProfile.

func (*FakeTestProfile) Kind

Kind implements extension.TestRunProfile.

func (*FakeTestProfile) Label

func (p *FakeTestProfile) Label() string

Label implements extension.TestRunProfile.

func (*FakeTestProfile) LoadCoverage

LoadCoverage plays the loading of the details of a file's coverage.

func (*FakeTestProfile) Run

func (p *FakeTestProfile) Run(ctx context.Context, include, exclude []*extension.TestItem, continuous bool) (*extension.TestRunRequest, error)

Run plays a run asked for by the user: it makes the request and calls the profile's handler with it. The runs the handler makes with CreateTestRun for the request are in Runs. It returns the request and the handler's error.

func (*FakeTestProfile) SetIsDefault

func (p *FakeTestProfile) SetIsDefault(v bool)

SetIsDefault implements extension.TestRunProfile.

func (*FakeTestProfile) SetLabel

func (p *FakeTestProfile) SetLabel(label string)

SetLabel implements extension.TestRunProfile.

func (*FakeTestProfile) SupportsContinuousRun

func (p *FakeTestProfile) SupportsContinuousRun() bool

SupportsContinuousRun implements extension.TestRunProfile.

func (*FakeTestProfile) Tag

func (p *FakeTestProfile) Tag() string

Tag implements extension.TestRunProfile.

func (*FakeTestProfile) Triggers

func (p *FakeTestProfile) Triggers(item *extension.TestItem, uri string) (bool, error)

Triggers plays the question whether the change of the file starts the continuous run of the item again.

type FakeTestRun

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

FakeTestRun is a run of the extension that reports into a list.

func (*FakeTestRun) AddCoverage

func (r *FakeTestRun) AddCoverage(f extension.FileCoverage)

AddCoverage implements extension.TestRun.

func (*FakeTestRun) AppendOutput

func (r *FakeTestRun) AppendOutput(text string, loc *extension.Location, item *extension.TestItem)

AppendOutput implements extension.TestRun.

func (*FakeTestRun) End

func (r *FakeTestRun) End()

End implements extension.TestRun.

func (*FakeTestRun) Ended

func (r *FakeTestRun) Ended() bool

Ended reports whether End was called.

func (*FakeTestRun) Enqueued

func (r *FakeTestRun) Enqueued(item *extension.TestItem)

Enqueued implements extension.TestRun.

func (*FakeTestRun) Errored

func (r *FakeTestRun) Errored(item *extension.TestItem, msgs []extension.TestMessage, d time.Duration)

Errored implements extension.TestRun.

func (*FakeTestRun) Events

func (r *FakeTestRun) Events() []TestRunEvent

Events lists what the run reported, in order.

func (*FakeTestRun) Failed

func (r *FakeTestRun) Failed(item *extension.TestItem, msgs []extension.TestMessage, d time.Duration)

Failed implements extension.TestRun.

func (*FakeTestRun) Name

func (r *FakeTestRun) Name() string

Name implements extension.TestRun.

func (*FakeTestRun) Passed

func (r *FakeTestRun) Passed(item *extension.TestItem, d time.Duration)

Passed implements extension.TestRun.

func (*FakeTestRun) Persist

func (r *FakeTestRun) Persist() bool

Persist is the persist argument the run was made with, and Request the request.

func (*FakeTestRun) Request

func (r *FakeTestRun) Request() *extension.TestRunRequest

Request is the request the run was made for.

func (*FakeTestRun) Skipped

func (r *FakeTestRun) Skipped(item *extension.TestItem)

Skipped implements extension.TestRun.

func (*FakeTestRun) Started

func (r *FakeTestRun) Started(item *extension.TestItem)

Started implements extension.TestRun.

type FakeTimeline

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

FakeTimeline is a provider the extension registered: a test asks it for pages as the view would, and reads what the extension said changed.

func (*FakeTimeline) Changed

func (f *FakeTimeline) Changed(uris ...string)

Changed implements extension.TimelineRegistration.

func (*FakeTimeline) Changes

func (f *FakeTimeline) Changes() [][]string

Changes are the calls of Changed, each with its URIs (none for "every file").

func (*FakeTimeline) Dispose

func (f *FakeTimeline) Dispose()

Dispose implements extension.TimelineRegistration.

func (*FakeTimeline) Disposed

func (f *FakeTimeline) Disposed() bool

Disposed says that the provider was disposed or the activation ended.

func (*FakeTimeline) ID

func (f *FakeTimeline) ID() string

ID is the ID of the provider.

func (*FakeTimeline) Label

func (f *FakeTimeline) Label() string

Label is the label of the provider.

func (*FakeTimeline) Page

Page asks the provider for a page as the host does for the view: nothing for a scheme it has no history for, the items with no ID dropped and the others sorted newest first, and a panic taking the extension off.

func (*FakeTimeline) Schemes

func (f *FakeTimeline) Schemes() []string

Schemes are the schemes of the provider.

type FakeWatch

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

FakeWatch is a call of Workspace().Watch that is still on: a test says what changed in it with Fire.

func (*FakeWatch) Excludes

func (w *FakeWatch) Excludes() []string

Excludes are the exclude globs of the watch.

func (*FakeWatch) Fire

func (w *FakeWatch) Fire(changes ...extension.FileChange)

Fire reports changes to the extension, on its UI thread (when the test pumps), as the host does with the changes of one turn. Paths are absolute; a change that the watch's excludes cover is dropped, as the real watcher drops it.

func (*FakeWatch) Path

func (w *FakeWatch) Path() string

Path is the folder the watch is on, Recursive whether it is recursive and Excludes what it leaves out.

func (*FakeWatch) Recursive

func (w *FakeWatch) Recursive() bool

Recursive says whether the watch goes below the folder.

func (*FakeWatch) Stopped

func (w *FakeWatch) Stopped() bool

Stopped says whether the extension stopped the watch.

type FileViewOpen

type FileViewOpen struct {
	URI, View string
	Side      bool
	Group     int
}

FileViewOpen is a call of FileViews().Open.

type HeadlessView

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

HeadlessView is the fake of extension.HeadlessView: it keeps what the extension sent it, and a test makes it draw (Emit), copy (Copy) and look at the input it got.

func (*HeadlessView) Clipboard

func (v *HeadlessView) Clipboard() string

Clipboard is the text the extension last set with SetClipboard.

func (*HeadlessView) Close

func (v *HeadlessView) Close()

Close implements extension.HeadlessView.

func (*HeadlessView) Closed

func (v *HeadlessView) Closed() bool

Closed tells whether the extension closed the view.

func (*HeadlessView) Copy

func (v *HeadlessView) Copy(text string) bool

Copy tells the function of OnCopy that the user copied the text in the view.

func (*HeadlessView) Done

func (v *HeadlessView) Done() <-chan struct{}

Done implements extension.HeadlessView.

func (*HeadlessView) Emit

func (v *HeadlessView) Emit(img *image.RGBA) bool

Emit hands a picture to the function of OnFrame, as the view does when it changed; false when there is none or the view is closed.

func (*HeadlessView) Keys

func (v *HeadlessView) Keys() []extension.KeyEvent

Keys are the key events the extension sent, in order.

func (*HeadlessView) Notify

Notify tells the function of OnNotification that the workspace raised a notification; false when there is none or the view is closed.

func (*HeadlessView) OnCopy

func (v *HeadlessView) OnCopy(fn func(string))

OnCopy implements extension.HeadlessView.

func (*HeadlessView) OnFrame

func (v *HeadlessView) OnFrame(fn func(*image.RGBA))

OnFrame implements extension.HeadlessView.

func (*HeadlessView) OnNotification

func (v *HeadlessView) OnNotification(fn func(extension.ViewNotification))

OnNotification implements extension.HeadlessView.

func (*HeadlessView) Pointers

func (v *HeadlessView) Pointers() []extension.PointerEvent

Pointers are the mouse events the extension sent.

func (*HeadlessView) Presses

func (v *HeadlessView) Presses() []NotificationPress

Presses are the calls of RunNotificationAction, in order.

func (*HeadlessView) Refresh

func (v *HeadlessView) Refresh()

Refresh implements extension.HeadlessView: the call is counted (Refreshes).

func (*HeadlessView) Refreshes

func (v *HeadlessView) Refreshes() int

Refreshes is how many times the extension called Refresh.

func (*HeadlessView) Resize

func (v *HeadlessView) Resize(size extension.Size) error

Resize implements extension.HeadlessView.

func (*HeadlessView) RunNotificationAction

func (v *HeadlessView) RunNotificationAction(id uint64, action int)

RunNotificationAction implements extension.HeadlessView: the call is kept (Presses).

func (*HeadlessView) Scrolls

func (v *HeadlessView) Scrolls() []extension.ScrollEvent

Scrolls are the scroll events the extension sent.

func (*HeadlessView) SendKey

func (v *HeadlessView) SendKey(e extension.KeyEvent)

SendKey implements extension.HeadlessView: the event is kept (Keys).

func (*HeadlessView) SendPointer

func (v *HeadlessView) SendPointer(e extension.PointerEvent)

SendPointer implements extension.HeadlessView: the event is kept (Pointers).

func (*HeadlessView) SendScroll

func (v *HeadlessView) SendScroll(e extension.ScrollEvent)

SendScroll implements extension.HeadlessView: the event is kept (Scrolls).

func (*HeadlessView) SetClipboard

func (v *HeadlessView) SetClipboard(text string)

SetClipboard implements extension.HeadlessView: the text is kept (Clipboard).

func (*HeadlessView) Size

func (v *HeadlessView) Size() extension.Size

Size implements extension.HeadlessView.

type Input

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

Input is an input box the extension showed.

func (*Input) Accept

func (in *Input) Accept(text string)

Accept ends the box with the text, as the user pressing Enter does; a text the validation refuses fails the test.

func (*Input) Cancel

func (in *Input) Cancel()

Cancel closes the box with no text.

func (*Input) Options

func (in *Input) Options() extension.InputBoxOptions

Options are what the extension asked to show.

func (*Input) PressButton

func (in *Input) PressButton(index int)

PressButton presses a button inside the box, as the user clicking it does: the function of the extension gets the text now in the box (set with Type, else the value the box started with) and may replace it, at once or later, on the UI thread. The test fails when the box has no such button.

func (*Input) Type

func (in *Input) Type(text string)

Type puts text in the box, as the user typing does (without the validation: Accept checks it).

func (*Input) Validate

func (in *Input) Validate(text string) string

Validate is the message the extension's validation gives for the text (empty when it accepts it or has none).

func (*Input) Value

func (in *Input) Value() string

Value is the text now in the box: what was typed, set by a button, else the value the box started with.

type LocationRequest

type LocationRequest struct {
	// Feature is references or implementations.
	Feature string
	// URI and Position are what the extension asked about.
	URI      string
	Position extension.Position
}

LocationRequest is a call of Languages().References or Implementations.

type Note

type Note struct {
	Severity, Message string
	// Actions are the labels of the buttons of the notification; RunNoteAction presses one.
	Actions []string
	// contains filtered or unexported fields
}

Note is a notification the extension showed.

type NotificationPress

type NotificationPress struct {
	// ID and Action are the notification and the place of the button.
	ID     uint64
	Action int
}

NotificationPress is a call of RunNotificationAction.

type OpenedFolder

type OpenedFolder struct {
	// Path is the folder; NewTab says that it was to open in a new workspace tab and not in the tab of the scope.
	Path   string
	NewTab bool
}

OpenedFolder is a call of Workspace().OpenFolder.

type OriginMemory

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

OriginMemory is the origins the fakes remember, which the fakes of two extensions share (ShareOrigins) as the extensions of a scope share them in the host.

func NewOriginMemory

func NewOriginMemory() *OriginMemory

NewOriginMemory makes an empty memory.

type Pick

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

Pick is a quick pick the extension showed.

func (*Pick) Choose

func (p *Pick) Choose(index int)

Choose chooses the item: its command is recorded (see RanCommands) and the extension is told the index. The text typed in the filter is empty; ChooseTyped gives one.

func (*Pick) ChooseTyped

func (p *Pick) ChooseTyped(index int, typed string)

ChooseTyped chooses the item with the text typed in the filter (the argument of QuickPickOptions.OnAccept). A separator cannot be chosen: it fails the test.

func (*Pick) Close

func (p *Pick) Close()

Close closes the quick pick with no choice.

func (*Pick) Labels

func (p *Pick) Labels() []string

Labels are the labels of the items.

func (*Pick) Options

func (p *Pick) Options() extension.QuickPickOptions

Options are what the extension asked to show.

type ProgressReport

type ProgressReport struct {
	Message string
	Percent float64
}

ProgressReport is a call of Report.

type Proposal

type Proposal struct {
	// Change is what the extension asked for.
	Change extension.ProposedChange
	// contains filtered or unexported fields
}

Proposal is a proposed change the extension asked the user to review (Editors().OpenProposedChange). The call blocks until the test answers it with Accept, Reject or Close, as the user does in the diff editor, or until its context ends.

func (*Proposal) Accept

func (p *Proposal) Accept(text string)

Accept answers the call as the user does with Accept: text is the text of the right side when it is accepted.

func (*Proposal) Cancelled

func (p *Proposal) Cancelled() bool

Cancelled tells whether the call ended because its context did, and so closed the tab.

func (*Proposal) Close

func (p *Proposal) Close()

Close answers the call as closing the tab does, which is a rejection.

func (*Proposal) Reject

func (p *Proposal) Reject()

Reject answers the call as the user does with Reject.

type ProviderRegistration

type ProviderRegistration struct {
	// Feature is completion, hover, signatureHelp, definition, references, documentSymbols, documentHighlights, codeActions,
	// formatting, rename or codeLens.
	Feature string
	// Selector is the documents the provider is for.
	Selector extension.DocumentSelector
	// Triggers are the trigger characters of completion and signature help.
	Triggers []string
	// Provider is the provider as it was given.
	Provider any
	// Disposed tells that the extension took the provider away.
	Disposed bool
}

ProviderRegistration is a provider an extension registered with Languages().Register...Provider.

type Published

type Published struct {
	Topic string
	Data  json.RawMessage
}

Published is an event the extension published with Events().Publish.

type RanCommand

type RanCommand struct {
	ID   string
	Args any
}

RanCommand is a command a quick pick item ran, with its arguments.

type RequestCall

type RequestCall struct {
	Topic string
	Data  json.RawMessage
}

RequestCall is a request the extension made with Events().Request.

type RequestDouble

type RequestDouble func(ctx context.Context, ev extension.Event, answer func(value any, err error))

RequestDouble answers a request: it is called when the extension makes the request, with the event of the request, and calls answer once with the value of the reply or an error, from any goroutine. The extension's reply function is called later, on Pump, as the UI thread does.

type Revealed

type Revealed struct {
	URI  string
	InOS bool
}

Revealed is a call of Workspace().RevealFile.

type SearchCall

type SearchCall struct {
	Query   extension.TextSearchQuery
	Options extension.TextSearchOptions
}

SearchCall is a call of Workspace().FindTextInFiles.

type ServerCall

type ServerCall struct {
	Server, Command string
	Args            []any
}

ServerCall is a call of LanguageServers().ExecuteCommand.

type ServerRequest

type ServerRequest struct {
	Server, Method string
	// Params are the params of the request as JSON.
	Params json.RawMessage
	// Notification is true for what the extension sent with LanguageServers().Notify.
	Notification bool
}

ServerRequest is a request the extension sent to a server with LanguageServers().Request.

type SettingUpdate

type SettingUpdate struct {
	Key   string
	Value any
}

SettingUpdate is a call of Settings().Update.

type Shown

type Shown struct {
	URI           string
	Line, Column  int
	Preview       bool
	ReturnedError error
}

Shown is a call of Documents().Show.

type StatusItem

type StatusItem struct {
	extension.StatusItem
	Hidden, Disposed bool
}

StatusItem is an item of the status bar as the extension last set it.

type Tab

type Tab struct {
	Refreshs         int
	Closed, Revealed bool
	Content          extension.EditorTabContent
	Group_           int
	// contains filtered or unexported fields
}

Tab is an editor tab the fake made: it implements extension.EditorTab and records what the extension did to it.

func (*Tab) Busy

func (t *Tab) Busy() bool

Busy is the busy mark.

func (*Tab) Close

func (t *Tab) Close()

Close implements extension.EditorTab: the fake closes the tab at once and calls OnClose.

func (*Tab) Dirty

func (t *Tab) Dirty() bool

Dirty is the dirty mark.

func (*Tab) Group

func (t *Tab) Group() int

Group implements extension.EditorTab.

func (*Tab) Hint

func (t *Tab) Hint() string

Hint is the tooltip the extension set.

func (*Tab) ID

func (t *Tab) ID() string

ID implements extension.EditorTab.

func (*Tab) Icon

func (t *Tab) Icon() string

Icon is the icon the extension set with SetIcon, and IconColor its color.

func (*Tab) IconColor

func (t *Tab) IconColor() string

IconColor is the color of the icon the extension set with SetIcon.

func (*Tab) Kind

func (t *Tab) Kind() string

Kind implements extension.EditorTab.

func (*Tab) Refresh

func (t *Tab) Refresh()

Refresh implements extension.EditorTab.

func (*Tab) Reveal

func (t *Tab) Reveal(bool)

Reveal implements extension.EditorTab.

func (*Tab) SetBusy

func (t *Tab) SetBusy(busy bool)

SetBusy implements extension.EditorTab.

func (*Tab) SetDirty

func (t *Tab) SetDirty(dirty bool)

SetDirty implements extension.EditorTab.

func (*Tab) SetHint

func (t *Tab) SetHint(hint string)

SetHint implements extension.EditorTab.

func (*Tab) SetIcon

func (t *Tab) SetIcon(icon, color string)

SetIcon implements extension.EditorTab.

func (*Tab) SetTitle

func (t *Tab) SetTitle(title string)

SetTitle implements extension.EditorTab.

func (*Tab) State

func (t *Tab) State() json.RawMessage

State asks the content for the state it saves, as JSON.

func (*Tab) Title

func (t *Tab) Title() string

Title is the title the extension set.

type TerminalSources

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

TerminalSources is the registry of the sources of terminal variables that fakes can share, as the scope shares it in the host.

func NewTerminalSources

func NewTerminalSources() *TerminalSources

NewTerminalSources makes an empty registry.

type TestRunEvent

type TestRunEvent struct {
	Kind TestRunEventKind
	// Item is the item of a state or of an output; Duration and Messages come with the results.
	Item     *extension.TestItem
	Duration time.Duration
	Messages []extension.TestMessage
	// Text and Location are those of an output; Coverage is the file of a coverage report.
	Text     string
	Location *extension.Location
	Coverage extension.FileCoverage
}

TestRunEvent is something a run reported.

type TestRunEventKind

type TestRunEventKind string

TestRunEventKind says what a TestRunEvent is.

const (
	RunEnqueued TestRunEventKind = "enqueued"
	RunStarted  TestRunEventKind = "started"
	RunSkipped  TestRunEventKind = "skipped"
	RunPassed   TestRunEventKind = "passed"
	RunFailed   TestRunEventKind = "failed"
	RunErrored  TestRunEventKind = "errored"
	RunOutput   TestRunEventKind = "output"
	RunCoverage TestRunEventKind = "coverage"
	RunEnded    TestRunEventKind = "ended"
)

The kinds of event of a run.

type Trashed

type Trashed struct {
	// URIs are the files that were moved to the trash.
	URIs []string
	// contains filtered or unexported fields
}

Trashed is a call of Workspace().TrashFiles.

func (*Trashed) Undone

func (t *Trashed) Undone() bool

Undone says that the function TrashFiles returned was called.

type Untitled

type Untitled struct {
	URI, LanguageID, Text string
}

Untitled is a call of Documents().OpenUntitled.

type View

type View struct {
	ID      string
	Content extension.ViewContent

	Refreshs int
	Badge    int
	BadgeTip string
	// Title is the title the extension set with SetTitle.
	Title   string
	Reveals []bool
	// Hides counts the calls of Hide.
	Hides    int
	Disposed bool
	// contains filtered or unexported fields
}

View is a view the extension provided.

func (*View) Snapshot

func (v *View) Snapshot() (refreshs, badge int, tip string)

Snapshot is the numbers of a view read under its lock.

func (*View) State

func (v *View) State() json.RawMessage

State asks the content of the view for the state it saves, as JSON (nil for none).

type WindowTab

type WindowTab struct {

	// Refreshs, Changes and Closes count the calls of Refresh, StateChanged and Close.
	Refreshs, Changes, Closes int
	// Capturing is what the extension last set with CaptureKeys.
	Capturing bool
	// Content is what the extension made the tab of.
	Content extension.WindowTabContent
	// contains filtered or unexported fields
}

WindowTab is the window tab the fake made: it implements extension.WindowTab and records what the extension did to it.

func (*WindowTab) CaptureKeys

func (t *WindowTab) CaptureKeys(capture bool)

CaptureKeys implements extension.WindowTab: the value is kept (Capturing).

func (*WindowTab) Close

func (t *WindowTab) Close()

Close implements extension.WindowTab: the fake counts the call; CloseTab ends the tab.

func (*WindowTab) Hint

func (t *WindowTab) Hint() string

Hint is the tooltip the extension set.

func (*WindowTab) ID

func (t *WindowTab) ID() string

ID implements extension.WindowTab.

func (*WindowTab) Kind

func (t *WindowTab) Kind() string

Kind implements extension.WindowTab.

func (*WindowTab) Refresh

func (t *WindowTab) Refresh()

Refresh implements extension.WindowTab.

func (*WindowTab) SetHint

func (t *WindowTab) SetHint(hint string)

SetHint implements extension.WindowTab.

func (*WindowTab) SetTitle

func (t *WindowTab) SetTitle(title string)

SetTitle implements extension.WindowTab.

func (*WindowTab) State

func (t *WindowTab) State() json.RawMessage

State asks the content for the state it saves, as JSON.

func (*WindowTab) StateChanged

func (t *WindowTab) StateChanged()

StateChanged implements extension.WindowTab.

func (*WindowTab) Title

func (t *WindowTab) Title() string

Title is the title the extension set.

Jump to

Keyboard shortcuts

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