Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MockPreferenceProvider

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _pendingChanges

_pendingChanges: Promise<boolean> = Promise.resolve(false)

Protected Readonly _ready

_ready: Deferred<void> = new Deferred<void>()

Protected deferredChanges

deferredChanges: PreferenceProviderDataChanges | undefined

Protected fireDidPreferencesChanged

fireDidPreferencesChanged: (...arguments: ArgumentsType) => Promise<ReturnType> = debounce(() => {const changes = this.deferredChanges;this.deferredChanges = undefined;if (changes && Object.keys(changes).length) {this.onDidPreferencesChangedEmitter.fire(changes);return true;}return false;}, 0)

Type declaration

    • (...arguments: ArgumentsType): Promise<ReturnType>
    • Parameters

      • Rest ...arguments: ArgumentsType

      Returns Promise<ReturnType>

Readonly onDidPreferencesChanged

onDidPreferencesChanged: Event<PreferenceProviderDataChanges> = this.onDidPreferencesChangedEmitter.event

Protected Readonly onDidPreferencesChangedEmitter

onDidPreferencesChangedEmitter: Emitter<PreferenceProviderDataChanges> = new Emitter<PreferenceProviderDataChanges>()

Protected Readonly preferenceOverrideService

preferenceOverrideService: PreferenceLanguageOverrideService

Readonly prefs

prefs: {}

Type declaration

  • [p: string]: any

Protected scope

Protected Readonly toDispose

toDispose: DisposableCollection = new DisposableCollection()

Accessors

pendingChanges

  • get pendingChanges(): Promise<boolean>

ready

  • get ready(): Promise<void>

Methods

dispose

  • dispose(): void

Protected emitPreferencesChangedEvent

get

  • get<T>(preferenceName: string, resourceUri?: undefined | string): T | undefined
  • Retrieve the stored value for the given preference and resource URI.

    Type parameters

    • T

    Parameters

    • preferenceName: string

      the preference identifier.

    • Optional resourceUri: undefined | string

      the uri of the resource for which the preference is stored. This is used to retrieve a potentially different value for the same preference for different resources, for example files.encoding.

    Returns T | undefined

    the value stored for the given preference and resourceUri if it exists, otherwise undefined.

getConfigUri

  • getConfigUri(resourceUri?: undefined | string, sectionName?: undefined | string): URI | undefined
  • Retrieve the configuration URI for the given resource URI.

    Parameters

    • Optional resourceUri: undefined | string

      the uri of the resource or undefined.

    • Optional sectionName: undefined | string

      the section to return the URI for, e.g. tasks or launch. Defaults to settings.

    Returns URI | undefined

    the corresponding resource URI or undefined if there is no valid URI.

Optional getContainingConfigUri

  • getContainingConfigUri(resourceUri?: undefined | string, sectionName?: undefined | string): URI | undefined

getDomain

  • getDomain(): string[] | undefined

Protected getParsedContent

  • getParsedContent(jsonData: any): {}

getPreferences

  • getPreferences(): {}

markReady

  • markReady(): void

Protected mergePreferenceProviderDataChange

resolve

  • Resolve the value for the given preference and resource URI.

    Type parameters

    • T

    Parameters

    • preferenceName: string

      the preference identifier.

    • Optional resourceUri: undefined | string

      the URI of the resource for which this provider should resolve the preference. This is used to retrieve a potentially different value for the same preference for different resources, for example files.encoding.

    Returns PreferenceResolveResult<T>

    an object containing the value stored for the given preference and resourceUri if it exists, otherwise undefined.

setPreference

  • setPreference(preferenceName: string, newValue: any, resourceUri?: undefined | string): Promise<boolean>

Static merge

  • merge(source: JSONValue | undefined, target: JSONValue): JSONValue