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 ¶
- func ApplyRangeEdits(text string, edits []extension.RangeEdit) (string, error)
- func OnRequestValue[P any](a *API, topic string, fn func(ctx context.Context, p P) (any, error))
- type API
- func (a *API) AllBanners() []*FakeBanner
- func (a *API) AnnotationKeys() []string
- func (a *API) Annotations(uri string) []extension.LineAnnotation
- func (a *API) AnswerFileChooser(path string, err error)
- func (a *API) AnswerLocations(feature string, ...)
- func (a *API) Applied() []extension.WorkspaceEdit
- func (a *API) Ask(ctx context.Context, topic string, value any) (extension.Event, error)
- func (a *API) AskAs(ctx context.Context, publisher, topic string, value any) (extension.Event, error)
- func (a *API) Banners() extension.Banners
- func (a *API) Channel(name string) *Channel
- func (a *API) Clipboard() extension.Clipboard
- func (a *API) ClipboardTexts() []string
- func (a *API) CloseWindowTab()
- func (a *API) ClosedHow() []extension.TabClose
- func (a *API) ClosedTabs() []string
- func (a *API) CodeActionCalls() []CodeActionCall
- func (a *API) CodeLensRefreshes() int
- func (a *API) Commands() extension.Commands
- func (a *API) ContentLabel(uri string) string
- func (a *API) ContentLanguage(uri string) string
- func (a *API) ContentProviderFor(scheme string) *FakeContent
- func (a *API) ContentText(ctx context.Context, uri string) (string, error)
- func (a *API) Context() extension.ContextKeys
- func (a *API) ContextKey(key string) any
- func (a *API) ContextKeyFor(origin extension.Origin, key string) any
- func (a *API) Deactivate()
- func (a *API) Debug() extension.Debug
- func (a *API) DebugAdapter(ctx context.Context, debugType string, s extension.DebugSession, ...) (adapter *extension.DebugAdapter, err error)
- func (a *API) DebugConsoleText() string
- func (a *API) DebugCustomEvent(s *FakeDebugSession, event string, body json.RawMessage)
- func (a *API) DebugFactoryTypes() []string
- func (a *API) DebugStarts() []DebugStart
- func (a *API) DebugTrackers(ctx context.Context, debugType string, s extension.DebugSession) []*extension.DebugAdapterTracker
- func (a *API) Decorations() extension.Decorations
- func (a *API) Dialogs() extension.Dialogs
- func (a *API) DocumentText(uri string) (string, bool)
- func (a *API) Documents() extension.Documents
- func (a *API) Drags() []*Drag
- func (a *API) EditorDecorations() extension.EditorDecorations
- func (a *API) EditorTabs() []*Tab
- func (a *API) Editors() extension.Editors
- func (a *API) Emit(topic string, value any)
- func (a *API) EmitAs(publisher, topic string, value any)
- func (a *API) EmitFrom(from extension.ScopeInfo, topic string, value any)
- func (a *API) EndDebugSession(s *FakeDebugSession)
- func (a *API) Events() extension.Events
- func (a *API) FailClipboard(err error)
- func (a *API) FailEditorOpen(fail bool)
- func (a *API) FailHeadlessViews(err error)
- func (a *API) FailNotifications(id string, err error)
- func (a *API) FailOpen(err error)
- func (a *API) FailOpenURI(err error)
- func (a *API) FailProvideContent(err error)
- func (a *API) FailSave(err error)
- func (a *API) FailShow(err error)
- func (a *API) FailState(err error)
- func (a *API) FailTrash(err error)
- func (a *API) FailUndoTrash(err error)
- func (a *API) FailUntitled(err error)
- func (a *API) FailWatches(err error)
- func (a *API) Failed() bool
- func (a *API) FileChooser() extension.FileChooser
- func (a *API) FileChooserCalls() []ChooserCall
- func (a *API) FileDecoration(uri string) (extension.FileDecoration, bool)
- func (a *API) FileDecorationProviders() []*FakeDecorations
- func (a *API) FileViewOpens() []FileViewOpen
- func (a *API) FileViewRefreshes() int
- func (a *API) FileViews() extension.FileViews
- func (a *API) FollowAnnotationLink(uri string, line int, dest string)
- func (a *API) HasHandler(id string) bool
- func (a *API) HeadlessViews() []*HeadlessView
- func (a *API) InputBox() extension.InputBox
- func (a *API) Inputs() []*Input
- func (a *API) Keybindings() extension.Keybindings
- func (a *API) LanguageServers() extension.LanguageServers
- func (a *API) Languages() extension.Languages
- func (a *API) LastInput() *Input
- func (a *API) LastPick() *Pick
- func (a *API) Launch(ctx context.Context, id string) (extension.ServerLaunch, error)
- func (a *API) Launcher(id string) extension.ServerLauncher
- func (a *API) LocationRequests() []LocationRequest
- func (a *API) Log() *slog.Logger
- func (a *API) MarkerCount() int
- func (a *API) Markers(owner string) map[string][]extension.Marker
- func (a *API) Menus() extension.Menus
- func (a *API) MultiDiffFiles(ctx context.Context, kind, key string) (files []extension.MultiDiffResource, err error)
- func (a *API) MultiDiffProviderFor(kind string) *FakeMultiDiff
- func (a *API) NewDebugSession(id, debugType, name string, cfg extension.DebugConfiguration) *FakeDebugSession
- func (a *API) Notes() []Note
- func (a *API) Notifications() extension.Notifications
- func (a *API) OnCodeAction(fn func(CodeActionCall) (string, error))
- func (a *API) OnDebugStart(fn func(DebugStart) (bool, error))
- func (a *API) OnRequest(topic string, fn RequestDouble)
- func (a *API) OnServerCommand(fn func(ServerCall) error)
- func (a *API) OnServerRequest(id string, fn func(ServerRequest) (json.RawMessage, error))
- func (a *API) OpenDialogs() []*FakeDialog
- func (a *API) OpenFileView(viewID string, doc extension.DocumentHandle) (extension.FileViewContent, error)
- func (a *API) OpenedDiffs() []extension.DiffSpec
- func (a *API) OpenedDocuments() []extension.OpenSpec
- func (a *API) OpenedFolders() []OpenedFolder
- func (a *API) OpenedMultiDiffs() []extension.MultiDiffSpec
- func (a *API) OpenedURIs() []string
- func (a *API) OpenedWindowTabs() []string
- func (a *API) Origins() extension.Origins
- func (a *API) Output() extension.Output
- func (a *API) Picks() []*Pick
- func (a *API) Post(fn func())
- func (a *API) Problems() extension.Problems
- func (a *API) ProblemsShown() int
- func (a *API) Progresses() []*FakeProgress
- func (a *API) Proposals() []*Proposal
- func (a *API) ProvideDebugConfigurations(ctx context.Context, debugType, folder string, ...) ([]extension.DebugConfiguration, error)
- func (a *API) Providers() []*ProviderRegistration
- func (a *API) PublishedEvents() []Published
- func (a *API) Pump() bool
- func (a *API) QuickPick() extension.QuickPick
- func (a *API) RanCommands() []RanCommand
- func (a *API) ReplaceCalls() [][]extension.FileReplacement
- func (a *API) Requests() []RequestCall
- func (a *API) RescanFiles()
- func (a *API) ResolveDebugConfiguration(ctx context.Context, debugType, folder string, ...) (extension.DebugConfiguration, error)
- func (a *API) ResolveDebugConfigurationSubstituted(ctx context.Context, debugType, folder string, ...) (extension.DebugConfiguration, error)
- func (a *API) RestoreTab(kindID, id string, state json.RawMessage) *Tab
- func (a *API) RevealedFiles() []Revealed
- func (a *API) Run(id string, args any) error
- func (a *API) RunAs(origin extension.Origin, f func())
- func (a *API) RunCtx(ctx context.Context, id string, args any) error
- func (a *API) RunNoteAction(note int, label string)
- func (a *API) SavedAll() [][]string
- func (a *API) Scope() extension.ScopeInfo
- func (a *API) SearchCalls() []SearchCall
- func (a *API) ServerCalls() []ServerCall
- func (a *API) ServerNotify(id, method string, params any)
- func (a *API) ServerOutputShown(id string) int
- func (a *API) ServerRequests(id string) []ServerRequest
- func (a *API) ServerRestarts(id string) int
- func (a *API) SetActive(doc *extension.ActiveDocument)
- func (a *API) SetActiveDebugSession(s *FakeDebugSession)
- func (a *API) SetActiveMergeEditor(m *extension.ActiveMerge)
- func (a *API) SetComplete(complete bool)
- func (a *API) SetDebugUnavailable(unavailable bool)
- func (a *API) SetDirty(uris ...string)
- func (a *API) SetDocument(uri, text string)
- func (a *API) SetEditorDecorationsUnavailable(unavailable bool)
- func (a *API) SetHistoryUnavailable(unavailable bool)
- func (a *API) SetLogger(l *slog.Logger)
- func (a *API) SetProblemsUnavailable(off bool)
- func (a *API) SetQuickDiffUnavailable(unavailable bool)
- func (a *API) SetServerCommands(server string, commands []string)
- func (a *API) SetServerEncoding(id, encoding string)
- func (a *API) SetServerStatus(id string, status extension.ServerStatus)
- func (a *API) SetSetting(key string, value any)
- func (a *API) SetState(key string, value any)
- func (a *API) SetTabs(tabs ...extension.DocumentTab)
- func (a *API) SetTestingUnavailable(unavailable bool)
- func (a *API) SetTimelineUnavailable(unavailable bool)
- func (a *API) SetTokenizer(fn func(languageID, text string) ([][]extension.Token, error))
- func (a *API) SetViewState(viewID string, raw json.RawMessage)
- func (a *API) SettingUpdates() []SettingUpdate
- func (a *API) Settings() extension.Settings
- func (a *API) ShareOrigins(m *OriginMemory)
- func (a *API) ShareTerminalEnvironment(s *TerminalSources)
- func (a *API) ShownBanners() []*FakeBanner
- func (a *API) ShownDocuments() []Shown
- func (a *API) SourceControl() extension.SourceControls
- func (a *API) SourceControlByHandle(handle string) *FakeSource
- func (a *API) SourceControls() []*FakeSource
- func (a *API) StartDebugSession(s *FakeDebugSession)
- func (a *API) StartWindowTab(id string, state json.RawMessage) *WindowTab
- func (a *API) State() extension.State
- func (a *API) StateKeys() []string
- func (a *API) StatusBar() extension.StatusBar
- func (a *API) StatusItem(id string) *StatusItem
- func (a *API) TerminalEnvironment() extension.TerminalEnvironment
- func (a *API) TerminalSourceCount() int
- func (a *API) TestController(id string) *FakeTestController
- func (a *API) TestControllers() []*FakeTestController
- func (a *API) Tests() extension.Tests
- func (a *API) Timeline() extension.Timelines
- func (a *API) TimelineProvider(id string) *FakeTimeline
- func (a *API) TimelineProviders() []*FakeTimeline
- func (a *API) TrashedFiles() []*Trashed
- func (a *API) UntitledDocuments() []Untitled
- func (a *API) View(id string) *View
- func (a *API) ViewIDs() []string
- func (a *API) Views() extension.Views
- func (a *API) WaitFor(what string, cond func() bool)
- func (a *API) Watches() []*FakeWatch
- func (a *API) WindowTabs() extension.WindowTabs
- func (a *API) Workspace() extension.Workspace
- type Channel
- type ChooserCall
- type CodeActionCall
- type DebugStart
- type Document
- func (d *Document) Edit(edits []extension.TextEdit) error
- func (d *Document) Folder() string
- func (d *Document) LanguageID() string
- func (d *Document) Listeners() (change, scroll int)
- func (d *Document) OnChange(fn func(extension.ViewDocumentChange)) func()
- func (d *Document) OnScroll(fn func(int)) func()
- func (d *Document) OpenFile(path string) error
- func (d *Document) ReadOnly() bool
- func (d *Document) Scroll(line int)
- func (d *Document) SetText(text string)
- func (d *Document) Text() string
- func (d *Document) TopLine() int
- func (d *Document) URI() string
- func (d *Document) Version() int
- type Drag
- type FakeBanner
- type FakeContent
- type FakeDebugSession
- func (s *FakeDebugSession) Configuration() extension.DebugConfiguration
- func (s *FakeDebugSession) CustomRequest(_ context.Context, command string, args any) (json.RawMessage, error)
- func (s *FakeDebugSession) CustomRequests() []string
- func (s *FakeDebugSession) Folder() string
- func (s *FakeDebugSession) ID() string
- func (s *FakeDebugSession) Name() string
- func (s *FakeDebugSession) OnCustomRequest(fn func(command string, args any) (json.RawMessage, error))
- func (s *FakeDebugSession) Parent() extension.DebugSession
- func (s *FakeDebugSession) SetFolder(folder string)
- func (s *FakeDebugSession) SetParent(p extension.DebugSession)
- func (s *FakeDebugSession) Type() string
- type FakeDecorations
- type FakeDialog
- type FakeGroup
- func (g *FakeGroup) ContextValue() string
- func (g *FakeGroup) Dispose()
- func (g *FakeGroup) HideWhenEmpty() bool
- func (g *FakeGroup) ID() string
- func (g *FakeGroup) Label() string
- func (g *FakeGroup) Resources() []extension.ResourceState
- func (g *FakeGroup) SetHideWhenEmpty(hide bool)
- func (g *FakeGroup) SetLabel(label string)
- func (g *FakeGroup) SetResources(resources []extension.ResourceState)
- type FakeHistory
- func (h *FakeHistory) CommonAncestor(ctx context.Context, refs []string) (id string, err error)
- func (h *FakeHistory) CurrentRefs() (current, remote, base *extension.HistoryItemRef)
- func (h *FakeHistory) Dispose()
- func (h *FakeHistory) Disposed() bool
- func (h *FakeHistory) Items(ctx context.Context, o extension.HistoryOptions) (items []extension.HistoryItem, err error)
- func (h *FakeHistory) OpenCommand() string
- func (h *FakeHistory) Refs(ctx context.Context, ids []string) (refs []extension.HistoryItemRef, err error)
- func (h *FakeHistory) RefsChanged(c extension.HistoryRefsChange)
- func (h *FakeHistory) RefsChanges() []extension.HistoryRefsChange
- func (h *FakeHistory) SetCurrentRefs(current, remote, base *extension.HistoryItemRef)
- type FakeInput
- func (in *FakeInput) Enabled() bool
- func (in *FakeInput) Focus()
- func (in *FakeInput) FocusRequests() int
- func (in *FakeInput) OnChange(fn func(value string)) (cancel func())
- func (in *FakeInput) Placeholder() string
- func (in *FakeInput) SetEnabled(enabled bool)
- func (in *FakeInput) SetPlaceholder(placeholder string)
- func (in *FakeInput) SetValidation(fn func(value string) *extension.Validation)
- func (in *FakeInput) SetValue(value string)
- func (in *FakeInput) SetVisible(visible bool)
- func (in *FakeInput) Type(text string)
- func (in *FakeInput) Validate(text string) (v *extension.Validation)
- func (in *FakeInput) Value() string
- func (in *FakeInput) Visible() bool
- type FakeMultiDiff
- type FakeProgress
- type FakeQuickDiff
- func (q *FakeQuickDiff) Dispose()
- func (q *FakeQuickDiff) Disposed() bool
- func (q *FakeQuickDiff) Kind() extension.QuickDiffKind
- func (q *FakeQuickDiff) Label() string
- func (q *FakeQuickDiff) Original(ctx context.Context, uri string) (original string, err error)
- func (q *FakeQuickDiff) Root() string
- type FakeSource
- func (s *FakeSource) AcceptInputCommand() extension.Command
- func (s *FakeSource) ActionButton() *extension.ActionButton
- func (s *FakeSource) ActiveRepositoryName() string
- func (s *FakeSource) AddQuickDiffProvider(p extension.QuickDiffProvider) (extension.QuickDiffRegistration, error)
- func (s *FakeSource) BadgeCount() int
- func (s *FakeSource) Busy() bool
- func (s *FakeSource) ContextValue() string
- func (s *FakeSource) Count() int
- func (s *FakeSource) CreateGroup(spec extension.ResourceGroupSpec) (extension.ResourceGroup, error)
- func (s *FakeSource) Dispose()
- func (s *FakeSource) Group(id string) *FakeGroup
- func (s *FakeSource) Groups() []*FakeGroup
- func (s *FakeSource) Handle() string
- func (s *FakeSource) History() *FakeHistory
- func (s *FakeSource) ID() string
- func (s *FakeSource) Input() extension.SCMInput
- func (s *FakeSource) Label() string
- func (s *FakeSource) QuickDiffProviders() []*FakeQuickDiff
- func (s *FakeSource) QuickDiffRefreshes() int
- func (s *FakeSource) RefreshQuickDiff()
- func (s *FakeSource) RootURI() string
- func (s *FakeSource) SetAcceptInputCommand(c extension.Command)
- func (s *FakeSource) SetActionButton(b *extension.ActionButton)
- func (s *FakeSource) SetActiveRepositoryName(name string)
- func (s *FakeSource) SetBusy(busy bool)
- func (s *FakeSource) SetCount(count int)
- func (s *FakeSource) SetHistoryProvider(p extension.HistoryProvider) (extension.HistoryRegistration, error)
- func (s *FakeSource) SetStatusBarCommands(commands []extension.StatusCommand)
- func (s *FakeSource) StatusBarCommands() []extension.StatusCommand
- type FakeTestController
- func (c *FakeTestController) Changes() []extension.TestTreeChange
- func (c *FakeTestController) CreateRunProfile(label string, kind extension.TestRunKind, handler extension.TestRunHandler, ...) (extension.TestRunProfile, error)
- func (c *FakeTestController) CreateTestItem(id, label, uri string) *extension.TestItem
- func (c *FakeTestController) CreateTestRun(request *extension.TestRunRequest, name string, persist bool) (extension.TestRun, error)
- func (c *FakeTestController) Dispose()
- func (c *FakeTestController) Disposed() bool
- func (c *FakeTestController) ID() string
- func (c *FakeTestController) InvalidateTestResults(items ...*extension.TestItem)
- func (c *FakeTestController) Invalidated() [][]*extension.TestItem
- func (c *FakeTestController) Items() *extension.TestItemCollection
- func (c *FakeTestController) Label() string
- func (c *FakeTestController) Profiles() []*FakeTestProfile
- func (c *FakeTestController) Refresh(ctx context.Context) error
- func (c *FakeTestController) Resolve(ctx context.Context, item *extension.TestItem) error
- func (c *FakeTestController) Runs() []*FakeTestRun
- func (c *FakeTestController) SetLabel(label string)
- func (c *FakeTestController) SetRefreshHandler(fn func(ctx context.Context) error)
- func (c *FakeTestController) SetResolveHandler(fn func(ctx context.Context, item *extension.TestItem) error)
- type FakeTestProfile
- func (p *FakeTestProfile) Configure() (bool, error)
- func (p *FakeTestProfile) Dispose()
- func (p *FakeTestProfile) IsDefault() bool
- func (p *FakeTestProfile) Kind() extension.TestRunKind
- func (p *FakeTestProfile) Label() string
- func (p *FakeTestProfile) LoadCoverage(ctx context.Context, file extension.FileCoverage) (extension.CoverageDetails, error)
- func (p *FakeTestProfile) Run(ctx context.Context, include, exclude []*extension.TestItem, continuous bool) (*extension.TestRunRequest, error)
- func (p *FakeTestProfile) SetIsDefault(v bool)
- func (p *FakeTestProfile) SetLabel(label string)
- func (p *FakeTestProfile) SupportsContinuousRun() bool
- func (p *FakeTestProfile) Tag() string
- func (p *FakeTestProfile) Triggers(item *extension.TestItem, uri string) (bool, error)
- type FakeTestRun
- func (r *FakeTestRun) AddCoverage(f extension.FileCoverage)
- func (r *FakeTestRun) AppendOutput(text string, loc *extension.Location, item *extension.TestItem)
- func (r *FakeTestRun) End()
- func (r *FakeTestRun) Ended() bool
- func (r *FakeTestRun) Enqueued(item *extension.TestItem)
- func (r *FakeTestRun) Errored(item *extension.TestItem, msgs []extension.TestMessage, d time.Duration)
- func (r *FakeTestRun) Events() []TestRunEvent
- func (r *FakeTestRun) Failed(item *extension.TestItem, msgs []extension.TestMessage, d time.Duration)
- func (r *FakeTestRun) Name() string
- func (r *FakeTestRun) Passed(item *extension.TestItem, d time.Duration)
- func (r *FakeTestRun) Persist() bool
- func (r *FakeTestRun) Request() *extension.TestRunRequest
- func (r *FakeTestRun) Skipped(item *extension.TestItem)
- func (r *FakeTestRun) Started(item *extension.TestItem)
- type FakeTimeline
- func (f *FakeTimeline) Changed(uris ...string)
- func (f *FakeTimeline) Changes() [][]string
- func (f *FakeTimeline) Dispose()
- func (f *FakeTimeline) Disposed() bool
- func (f *FakeTimeline) ID() string
- func (f *FakeTimeline) Label() string
- func (f *FakeTimeline) Page(ctx context.Context, uri string, o extension.TimelineOptions) (tl extension.Timeline, err error)
- func (f *FakeTimeline) Schemes() []string
- type FakeWatch
- type FileViewOpen
- type HeadlessView
- func (v *HeadlessView) Clipboard() string
- func (v *HeadlessView) Close()
- func (v *HeadlessView) Closed() bool
- func (v *HeadlessView) Copy(text string) bool
- func (v *HeadlessView) Done() <-chan struct{}
- func (v *HeadlessView) Emit(img *image.RGBA) bool
- func (v *HeadlessView) Keys() []extension.KeyEvent
- func (v *HeadlessView) Notify(n extension.ViewNotification) bool
- func (v *HeadlessView) OnCopy(fn func(string))
- func (v *HeadlessView) OnFrame(fn func(*image.RGBA))
- func (v *HeadlessView) OnNotification(fn func(extension.ViewNotification))
- func (v *HeadlessView) Pointers() []extension.PointerEvent
- func (v *HeadlessView) Presses() []NotificationPress
- func (v *HeadlessView) Refresh()
- func (v *HeadlessView) Refreshes() int
- func (v *HeadlessView) Resize(size extension.Size) error
- func (v *HeadlessView) RunNotificationAction(id uint64, action int)
- func (v *HeadlessView) Scrolls() []extension.ScrollEvent
- func (v *HeadlessView) SendKey(e extension.KeyEvent)
- func (v *HeadlessView) SendPointer(e extension.PointerEvent)
- func (v *HeadlessView) SendScroll(e extension.ScrollEvent)
- func (v *HeadlessView) SetClipboard(text string)
- func (v *HeadlessView) Size() extension.Size
- type Input
- type LocationRequest
- type Note
- type NotificationPress
- type OpenedFolder
- type OriginMemory
- type Pick
- type ProgressReport
- type Proposal
- type ProviderRegistration
- type Published
- type RanCommand
- type RequestCall
- type RequestDouble
- type Revealed
- type SearchCall
- type ServerCall
- type ServerRequest
- type SettingUpdate
- type Shown
- type StatusItem
- type Tab
- func (t *Tab) Busy() bool
- func (t *Tab) Close()
- func (t *Tab) Dirty() bool
- func (t *Tab) Group() int
- func (t *Tab) Hint() string
- func (t *Tab) ID() string
- func (t *Tab) Icon() string
- func (t *Tab) IconColor() string
- func (t *Tab) Kind() string
- func (t *Tab) Refresh()
- func (t *Tab) Reveal(bool)
- func (t *Tab) SetBusy(busy bool)
- func (t *Tab) SetDirty(dirty bool)
- func (t *Tab) SetHint(hint string)
- func (t *Tab) SetIcon(icon, color string)
- func (t *Tab) SetTitle(title string)
- func (t *Tab) State() json.RawMessage
- func (t *Tab) Title() string
- type TerminalSources
- type TestRunEvent
- type TestRunEventKind
- type Trashed
- type Untitled
- type View
- type WindowTab
- func (t *WindowTab) CaptureKeys(capture bool)
- func (t *WindowTab) Close()
- func (t *WindowTab) Hint() string
- func (t *WindowTab) ID() string
- func (t *WindowTab) Kind() string
- func (t *WindowTab) Refresh()
- func (t *WindowTab) SetHint(hint string)
- func (t *WindowTab) SetTitle(title string)
- func (t *WindowTab) State() json.RawMessage
- func (t *WindowTab) StateChanged()
- func (t *WindowTab) Title() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyRangeEdits ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) ClipboardTexts ¶
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 ¶
ClosedHow is the TabClose each closed tab was closed with, in the order of ClosedTabs.
func (*API) ClosedTabs ¶
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 ¶
CodeLensRefreshes is how many times the extension asked for its code lenses to be asked again.
func (*API) ContentLabel ¶
ContentLabel is the label the provider of the URI gives the document ("" when there is no provider).
func (*API) ContentLanguage ¶
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 ¶
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 ¶
ContextKey is the value of a context key the extension set, or nil.
func (*API) ContextKeyFor ¶
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) 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 ¶
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 ¶
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) DocumentText ¶
DocumentText is the text of an open document (one SetDocument made, or Apply opened or created), and whether it is open.
func (*API) EditorDecorations ¶
func (a *API) EditorDecorations() extension.EditorDecorations
EditorDecorations implements extension.API.
func (*API) EditorTabs ¶
EditorTabs are the tabs the fake holds, in the order they were made.
func (*API) Emit ¶
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 ¶
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 ¶
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) FailClipboard ¶
FailClipboard makes the clipboard fail with err from now on; nil makes it work again.
func (*API) FailEditorOpen ¶
FailEditorOpen makes Editors().Open fail after the content of the tab was made, as when the window cannot show the tab.
func (*API) FailHeadlessViews ¶
FailHeadlessViews makes NewHeadlessView fail with err from now on; nil makes it work again.
func (*API) FailNotifications ¶
FailNotifications makes the notifications the extension sends to the server with LanguageServers().Notify fail with err (nil stops failing).
func (*API) FailOpen ¶
FailOpen makes OpenDiff and OpenDocument fail with err; nil makes them work again.
func (*API) FailOpenURI ¶
FailOpenURI makes Workspace().OpenURI fail with err from now on; nil makes it work again.
func (*API) FailProvideContent ¶
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) FailShow ¶
FailShow makes Documents().Show fail with err (nil makes it succeed again); the call is still recorded, with the error.
func (*API) FailState ¶
FailState makes State().Set fail with err from now on; nil makes it work again.
func (*API) FailTrash ¶
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 ¶
FailUndoTrash makes the undo functions of TrashFiles fail with err.
func (*API) FailUntitled ¶
FailUntitled makes Documents().OpenUntitled fail with err; nil makes it work again.
func (*API) FailWatches ¶
FailWatches makes the next calls of Workspace().Watch fail with err (nil makes them work again).
func (*API) Failed ¶
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 ¶
FileViewRefreshes is how many times a file view asked to be built again.
func (*API) FollowAnnotationLink ¶
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 ¶
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) 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) Launch ¶
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) MarkerCount ¶
MarkerCount is the number of markers of all owners.
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) 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 ¶
OpenedDiffs are the calls of OpenDiff, in order.
func (*API) OpenedDocuments ¶
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 ¶
OpenedURIs are the URIs the extension opened with Workspace().OpenURI.
func (*API) OpenedWindowTabs ¶
OpenedWindowTabs are the kinds the extension opened with Workspace().OpenWindowTab.
func (*API) Post ¶
func (a *API) Post(fn func())
Post implements extension.API: the function waits for Pump.
func (*API) ProblemsShown ¶
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) 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 ¶
PublishedEvents are the events the extension published, the first first.
func (*API) Pump ¶
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) 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 ¶
RevealedFiles are the calls of Workspace().RevealFile, in order.
func (*API) RunAs ¶
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) RunNoteAction ¶
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) 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 ¶
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 ¶
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 ¶
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 ¶
SetComplete says whether the walk of the folder has finished.
func (*API) SetDebugUnavailable ¶
SetDebugUnavailable makes the registrations and StartDebugging fail with ExtensionDebugUnavailable, as they do in a host with no debug service.
func (*API) SetDocument ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetProblemsUnavailable makes Problems().Set, Read and Show fail as a scope with no Problems panel does (a headless host).
func (*API) SetQuickDiffUnavailable ¶
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 ¶
SetServerCommands sets what LanguageServers().Commands answers for the server: the commands the running server announced.
func (*API) SetServerEncoding ¶
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 ¶
SetSetting changes a setting as the user does and tells the listeners, on the test's goroutine.
func (*API) SetState ¶
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 ¶
SetTestingUnavailable makes CreateTestController fail with ExtensionTestingUnavailable, as it does in a host with no testing service.
func (*API) SetTimelineUnavailable ¶
SetTimelineUnavailable makes RegisterProvider fail with ExtensionTimelineUnavailable, as it does in a host with no workbench.
func (*API) SetTokenizer ¶
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) 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 ¶
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) 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 ¶
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) 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 ¶
TrashedFiles are the calls of Workspace().TrashFiles, in order.
func (*API) UntitledDocuments ¶
UntitledDocuments are the calls of Documents().OpenUntitled, in order.
func (*API) WaitFor ¶
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) WindowTabs ¶
func (a *API) WindowTabs() extension.WindowTabs
WindowTabs implements extension.API.
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is an Output channel the extension made.
func (*Channel) AppendLine ¶
AppendLine implements extension.OutputChannel.
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 ¶
NewDocument makes a document with a URI, a language, the folder of the workspace and a text.
func (*Document) LanguageID ¶
LanguageID implements extension.DocumentHandle.
func (*Document) Listeners ¶
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) SetText ¶
SetText changes the text and tells the listeners, as an edit of the editor does.
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).
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 ¶
func (s *FakeDebugSession) Parent() extension.DebugSession
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 ¶
ContextValue is the value of scmResourceGroupState.
func (*FakeGroup) Dispose ¶
func (g *FakeGroup) Dispose()
Dispose implements extension.ResourceGroup.
func (*FakeGroup) HideWhenEmpty ¶
HideWhenEmpty tells whether the group is hidden while it has no resources.
func (*FakeGroup) Resources ¶
func (g *FakeGroup) Resources() []extension.ResourceState
Resources are the resources of the group.
func (*FakeGroup) SetHideWhenEmpty ¶
SetHideWhenEmpty 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 ¶
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 ¶
func (h *FakeHistory) Items(ctx context.Context, o extension.HistoryOptions) (items []extension.HistoryItem, err error)
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) FocusRequests ¶
FocusRequests counts the calls of Focus.
func (*FakeInput) Placeholder ¶
Placeholder is the text shown while the box is empty.
func (*FakeInput) SetEnabled ¶
SetEnabled implements extension.SCMInput.
func (*FakeInput) SetPlaceholder ¶
SetPlaceholder implements extension.SCMInput.
func (*FakeInput) SetValidation ¶
func (in *FakeInput) SetValidation(fn func(value string) *extension.Validation)
SetValidation implements extension.SCMInput.
func (*FakeInput) SetValue ¶
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 ¶
SetVisible implements extension.SCMInput.
func (*FakeInput) Type ¶
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.
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) 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 ¶
func (q *FakeQuickDiff) Kind() extension.QuickDiffKind
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 ¶
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 ¶
func (s *FakeSource) AddQuickDiffProvider(p extension.QuickDiffProvider) (extension.QuickDiffRegistration, error)
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 ¶
func (s *FakeSource) CreateGroup(spec extension.ResourceGroupSpec) (extension.ResourceGroup, error)
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) 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 ¶
func (s *FakeSource) SetHistoryProvider(p extension.HistoryProvider) (extension.HistoryRegistration, error)
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 ¶
func (c *FakeTestController) Changes() []extension.TestTreeChange
Changes lists the changes of the controller's tree, in order.
func (*FakeTestController) CreateRunProfile ¶
func (c *FakeTestController) CreateRunProfile(label string, kind extension.TestRunKind, handler extension.TestRunHandler, opts extension.TestRunProfileOptions) (extension.TestRunProfile, error)
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 ¶
func (c *FakeTestController) Items() *extension.TestItemCollection
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 ¶
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 ¶
func (p *FakeTestProfile) Kind() extension.TestRunKind
Kind implements extension.TestRunProfile.
func (*FakeTestProfile) Label ¶
func (p *FakeTestProfile) Label() string
Label implements extension.TestRunProfile.
func (*FakeTestProfile) LoadCoverage ¶
func (p *FakeTestProfile) LoadCoverage(ctx context.Context, file extension.FileCoverage) (extension.CoverageDetails, error)
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.
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 ¶
AppendOutput 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) 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) Label ¶
func (f *FakeTimeline) Label() string
Label is the label of the provider.
func (*FakeTimeline) Page ¶
func (f *FakeTimeline) Page(ctx context.Context, uri string, o extension.TimelineOptions) (tl extension.Timeline, err error)
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) 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 ¶
Path is the folder the watch is on, Recursive whether it is recursive and Excludes what it leaves out.
type FileViewOpen ¶
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 ¶
func (v *HeadlessView) Notify(n extension.ViewNotification) bool
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 ¶
Accept ends the box with the text, as the user pressing Enter does; a text the validation refuses fails the test.
func (*Input) Options ¶
func (in *Input) Options() extension.InputBoxOptions
Options are what the extension asked to show.
func (*Input) PressButton ¶
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 ¶
Type puts text in the box, as the user typing does (without the validation: Accept checks it).
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.
type Pick ¶
type Pick struct {
// contains filtered or unexported fields
}
Pick is a quick pick the extension showed.
func (*Pick) Choose ¶
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 ¶
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) Options ¶
func (p *Pick) Options() extension.QuickPickOptions
Options are what the extension asked to show.
type ProgressReport ¶
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 ¶
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 ¶
Cancelled tells whether the call ended because its context did, and so closed the tab.
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 ¶
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 ¶
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 SearchCall ¶
type SearchCall struct {
Query extension.TextSearchQuery
Options extension.TextSearchOptions
}
SearchCall is a call of Workspace().FindTextInFiles.
type ServerCall ¶
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 ¶
SettingUpdate is a call of Settings().Update.
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) Close ¶
func (t *Tab) Close()
Close implements extension.EditorTab: the fake closes the tab at once and calls OnClose.
func (*Tab) State ¶
func (t *Tab) State() json.RawMessage
State asks the content for the state it saves, as JSON.
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.
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) 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 ¶
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) 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.