Show / Hide Table of Contents

# Class LanguageService

Main class for Language Service functionality including anything that requires knowledge of the language to perform, such as definitions, intellisense, etc.

##### Inheritance

System.Object
LanguageService

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.LanguageServices

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public sealed class LanguageService

### Properties

| Improve this Doc View Source

#### Instance

Gets the singleton instance object

##### Declaration

    public static LanguageService Instance { get; }

##### Property Value

Type | Description
--- | ---
LanguageService |

### Methods

| Improve this Doc View Source

#### GetCompletionItems(TextDocumentPosition, ScriptFile, ConnectionInfo)

Return the completion item list for the current text position. This method does not await cache builds since it expects to return quickly

##### Declaration

    public CompletionItem[] GetCompletionItems(TextDocumentPosition textDocumentPosition, ScriptFile scriptFile, ConnectionInfo connInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
TextDocumentPosition | textDocumentPosition |
ScriptFile | scriptFile |
ConnectionInfo | connInfo |

##### Returns

Type | Description
--- | ---
CompletionItem[] |

| Improve this Doc View Source

#### HandleDidChangeConfigurationNotification(SqlToolsSettings, SqlToolsSettings, EventContext)

Handle the file configuration change notification

##### Declaration

    public Task HandleDidChangeConfigurationNotification(SqlToolsSettings newSettings, SqlToolsSettings oldSettings, EventContext eventContext)

##### Parameters

Type | Name | Description
--- | --- | ---
SqlToolsSettings | newSettings |
SqlToolsSettings | oldSettings |
EventContext | eventContext |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### HandleDidChangeTextDocumentNotification(ScriptFile[], EventContext)

Handles text document change events

##### Declaration

    public Task HandleDidChangeTextDocumentNotification(ScriptFile[] changedFiles, EventContext eventContext)

##### Parameters

Type | Name | Description
--- | --- | ---
ScriptFile[] | changedFiles |
EventContext | eventContext |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### HandleDidOpenTextDocumentNotification(ScriptFile, EventContext)

Handle the file open notification

##### Declaration

    public Task HandleDidOpenTextDocumentNotification(ScriptFile scriptFile, EventContext eventContext)

##### Parameters

Type | Name | Description
--- | --- | ---
ScriptFile | scriptFile |
EventContext | eventContext |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### InitializeService(ServiceHost, SqlToolsContext)

Initializes the Language Service instance

##### Declaration

    public void InitializeService(ServiceHost serviceHost, SqlToolsContext context)

##### Parameters

Type | Name | Description
--- | --- | ---
ServiceHost | serviceHost |
SqlToolsContext | context |

| Improve this Doc View Source

#### ParseAndBind(ScriptFile, ConnectionInfo)

Parses the SQL text and binds it to the SMO metadata provider if connected

##### Declaration

    public ParseResult ParseAndBind(ScriptFile scriptFile, ConnectionInfo connInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
ScriptFile | scriptFile |
ConnectionInfo | connInfo |

##### Returns

Type | Description
--- | ---
Microsoft.SqlServer.Management.SqlParser.Parser.ParseResult | The ParseResult instance returned from SQL Parser

| Improve this Doc View Source

#### RemoveAutoCompleteCacheUriReference(ConnectionSummary, String)

Remove a reference to an autocomplete cache from a URI. If it is the last URI connected to a particular connection, then remove the cache.

##### Declaration

    public Task RemoveAutoCompleteCacheUriReference(ConnectionSummary summary, string ownerUri)

##### Parameters

Type | Name | Description
--- | --- | ---
ConnectionSummary | summary |
System.String | ownerUri |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### UpdateLanguageServiceOnConnection(ConnectionInfo)

Update the autocomplete metadata provider when the user connects to a database

##### Declaration

    public Task UpdateLanguageServiceOnConnection(ConnectionInfo info)

##### Parameters

Type | Name | Description
--- | --- | ---
ConnectionInfo | info |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |