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 a new instance of the SyntaxLanguage class.

public SyntaxLanguage(string key)
Parameter Type Description
key string

A string that identifies the language.

Properties

Key

Gets a string that identifies the language.

public string Key { get; protected set; }

Property Value

string:

A string that identifies the language.

PlainText

Gets a SyntaxLanguage that implements a default plain text parser.

public static SyntaxLanguage PlainText { get; }

Property Value

SyntaxLanguage:

A SyntaxLanguage that implements a default plain text parser.

SyncRoot

Gets an object that can be used to synchronize access to the services.

public object SyncRoot { get; }

Property Value

object:

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

Methods

GetAllServiceTypes()

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

public IEnumerable<object> GetAllServiceTypes()

Returns

IEnumerable<object>:

A collection of all the service types that have been registered.

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:

The service that has been registered with the specified type.

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:

The service that has been registered with the specified type.

OnServiceAdded(CollectionChangeEventArgs<object>)

Raises the ServiceAdded event.

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

A CollectionChangeEventArgs{object} that contains the event data.

OnServiceRemoved(CollectionChangeEventArgs<object>)

Raises the ServiceRemoved event.

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

A CollectionChangeEventArgs{object} that contains 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