---
title: "TypeshadeLanguageService: class in Editor, TypeShade API"
description: "TypeshadeLanguageService, a class in Editor. Provides Typeshade diagnostics, completion, hover, and position mapping for editor integrations."
url: https://typeshade.dev/api/typeshadelanguageservice/
language: en
---

# `TypeshadeLanguageService`

Class in Editor

Provides Typeshade diagnostics, completion, hover, and position mapping for editor integrations.

`import { TypeshadeLanguageService } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
class TypeshadeLanguageService
```

## Constructor

**`new TypeshadeLanguageService(options: TypeshadeLanguageServiceOptions = {})`**

## Instance properties

**`fileName` read only `string`**

File name used when parsing source text; carries no filesystem meaning.

## Instance methods

**`getDiagnostics` `(source: string): readonly TypeshadeDiagnostic[]`**

Returns compiler diagnostics with zero-based ranges and UTF-16 spans suitable for editor markers.

**`getCompletions` `(source: string, position: TypeshadePosition): readonly TypeshadeCompletionItem[]`**

Returns context-aware Typeshade completion items at a zero-based editor position.

**`getHover` `(source: string, position: TypeshadePosition): TypeshadeHover | undefined`**

Returns hover documentation for known Typeshade types and attributes at a zero-based editor position.

**`getPosition` `(source: string, offset: number): TypeshadePosition`**

Converts a UTF-16 source offset into the zero-based position used by adapters; an offset past the end of the source clamps to the end.

**`getOffset` `(source: string, position: TypeshadePosition): number`**

Converts a zero-based editor position into a UTF-16 source offset; a position past the end of the source clamps to the end.

## Source

[`src/language-service.ts`, line 122](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service.ts#L122), at commit af54ddad5
