Class WorkspaceService<TConfig>
Class for handling requests/events that deal with the state of the workspace, including the opening and closing of files, the changing of configuration, etc.
Inheritance
Inherited Members
Namespace:Microsoft.SqlTools.ServiceLayer.Workspace
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public class WorkspaceService<TConfig>
where TConfig : class, new ()
Type Parameters
| Name | Description |
|---|---|
| TConfig | The type of the class used for serializing and deserializing the configuration. Must be the actual type of the instance otherwise deserialization will be incomplete. |
Constructors
| Improve this Doc View SourceWorkspaceService()
Default, parameterless constructor. TODO: Figure out how to make this truely singleton even with dependency injection for tests
Declaration
public WorkspaceService()
Properties
| Improve this Doc View SourceCurrentSettings
Current settings for the workspace
Declaration
public TConfig CurrentSettings { get; }
Property Value
| Type | Description |
|---|---|
| TConfig |
Instance
Declaration
public static WorkspaceService<TConfig> Instance { get; }
Property Value
| Type | Description |
|---|---|
| WorkspaceService<TConfig> |
Workspace
Workspace object for the service. Virtual to allow for mocking
Declaration
public virtual Workspace Workspace { get; }
Property Value
| Type | Description |
|---|---|
| Workspace |
Methods
| Improve this Doc View SourceInitializeService(ServiceHost)
Declaration
public void InitializeService(ServiceHost serviceHost)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceHost | serviceHost |
RegisterConfigChangeCallback(WorkspaceService<TConfig>.ConfigChangeCallback)
Adds a new task to be called when the configuration has been changed. Use this to handle changing configuration and changing the current configuration.
Declaration
public void RegisterConfigChangeCallback(WorkspaceService<TConfig>.ConfigChangeCallback task)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkspaceService.ConfigChangeCallback<> | task | Task to handle the request |
RegisterTextDocChangeCallback(WorkspaceService<TConfig>.TextDocChangeCallback)
Adds a new task to be called when the text of a document changes.
Declaration
public void RegisterTextDocChangeCallback(WorkspaceService<TConfig>.TextDocChangeCallback task)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkspaceService.TextDocChangeCallback<> | task | Delegate to call when the document changes |
RegisterTextDocCloseCallback(WorkspaceService<TConfig>.TextDocCloseCallback)
Adds a new task to be called when a text document closes.
Declaration
public void RegisterTextDocCloseCallback(WorkspaceService<TConfig>.TextDocCloseCallback task)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkspaceService.TextDocCloseCallback<> | task | Delegate to call when the document closes |
RegisterTextDocOpenCallback(WorkspaceService<TConfig>.TextDocOpenCallback)
Adds a new task to be called when a file is opened
Declaration
public void RegisterTextDocOpenCallback(WorkspaceService<TConfig>.TextDocOpenCallback task)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkspaceService.TextDocOpenCallback<> | task | Delegate to call when a document is opened |