Interface ILanguageService
Represents the declaration of a language service for IUIMultiLineTextInput.
Namespace: DevToys.Api
Assembly: DevToys.Api.dll
Syntax
public interface ILanguageService
Remarks
The value of NameAttribute should correspond to the SyntaxColorizationLanguageName.
[Export(typeof(ILanguageService))]
[Name("programmingLanguageName")]
internal sealed class MyLanguageService : ILanguageService
{
}
Methods
GetAutoCompletionItemsAsync(string, TextSpan, CancellationToken)
Gets the list of items to be displayed in the auto-completion list (invoked through Ctrl+Space in a IUIMultiLineTextInput).
Declaration
Task<IReadOnlyList<AutoCompletionItem>> GetAutoCompletionItemsAsync(string textDocument, TextSpan span, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | textDocument | The text in the IUIMultiLineTextInput. |
TextSpan | span | The caret location, or selected span in the text document. |
CancellationToken | cancellationToken | A cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IReadOnlyList<AutoCompletionItem>> | Returns a list of items to display in the auto-completion popup. |
GetSemanticTokensAsync(string, CancellationToken)
Gets an ordered list of semantic tokens for the specified text document. Semantic tokens are used to provide rich syntax highlighting and information for the IUIMultiLineTextInput's editor.
Declaration
Task<IReadOnlyList<SemanticToken>> GetSemanticTokensAsync(string textDocument, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | textDocument | The text in the IUIMultiLineTextInput. |
CancellationToken | cancellationToken | A cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IReadOnlyList<SemanticToken>> | Returns a list of semantic tokens providing information about how the document should be colored |
Remarks
Semantic tokens should be provided in the order in which they appear in the document. Their ranges should not overlap. Their positions should be relative to the previous token or the start of the document.