In This Article

SyntaxLanguage Class

Implements a syntax-highlighting language definition that can be used to parse an ICodeDocument and provide additional functionality via registered services.

public class SyntaxLanguage : ISyntaxLanguage, IKeyedObject, IServiceLocator
Inheritance:
object object
Derived:
DotNetSyntaxLanguageBase JavaScriptSyntaxLanguage JsonSyntaxLanguage PythonSyntaxLanguage XmlSyntaxLanguage
Implements:
ISyntaxLanguage IKeyedObject IServiceLocator

Constructors

SyntaxLanguage(string)

Initializes an instance of the class.

public SyntaxLanguage(string key)
Parameter Type Description
key string

A string that identifies the language.

Properties

Key

A string that identifies the language.

public string Key { get; protected set; }

Property Value

string

PlainText

A SyntaxLanguage that implements a default plain text parser.

public static SyntaxLanguage PlainText { get; }

Property Value

SyntaxLanguage

SyncRoot

An object that can be used to synchronize access to the services.

public object SyncRoot { get; }

Property Value

object

Methods

GetAllServiceTypes()

Returns a collection of all the service types that have been registered.

public IEnumerable<object> GetAllServiceTypes()

Returns

IEnumerable<object>

GetService(object)

Returns the service that has been registered with the specified type.

public object? GetService(object serviceType)
Parameter Type Description
serviceType object

The type of service to return.

Returns

object

GetService<T>()

Returns the service that has been registered with the specified type.

public T? GetService<T>()
Type Parameters:
T -

The type of service to return.

Returns

T

OnServiceAdded(CollectionChangeEventArgs<object>)

Raises the ServiceAdded event.

protected virtual void OnServiceAdded(CollectionChangeEventArgs<object> e)
Parameter Type Description
e CollectionChangeEventArgs<object>

The event data.

OnServiceRemoved(CollectionChangeEventArgs<object>)

Raises the ServiceRemoved event.

protected virtual void OnServiceRemoved(CollectionChangeEventArgs<object> e)
Parameter Type Description
e CollectionChangeEventArgs<object>

The event data.

RegisterService(object, object)

Registers a service instance for the specified service type.

public void RegisterService(object serviceType, object service)
Parameter Type Description
serviceType object

The type of service.

service object

The service object instance.

RegisterService<T>(T)

Registers a service instance for the specified service type.

public void RegisterService<T>(T service)
Type Parameters:
T -

The type of service.

Parameter Type Description
service T

The service object instance.

UnregisterService(object)

Unregisters a service of the specified service type.

public void UnregisterService(object serviceType)
Parameter Type Description
serviceType object

The type of service.

UnregisterService<T>()

Unregisters a service of the specified service type.

public void UnregisterService<T>()
Type Parameters:
T -

The type of service.

Events

ServiceAdded

Occurs after a service is added to the object.

public event EventHandler<CollectionChangeEventArgs<object>>? ServiceAdded

Event Type

EventHandler<CollectionChangeEventArgs<object>>

ServiceRemoved

Occurs after a service is removed from the object.

public event EventHandler<CollectionChangeEventArgs<object>>? ServiceRemoved

Event Type

EventHandler<CollectionChangeEventArgs<object>>

Inherited Members

Extension Methods