> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Effect-TS/tsgo/llms.txt
> Use this file to discover all available pages before exploring further.

# Completions

> Smart completions, snippet insertions, codegens, and rename extensions provided by the Effect Language Service.

The Effect Language Service augments TypeScript's built-in completion list with Effect-aware snippets. These completions fire in specific syntactic positions — typically inside `extends` clauses, after a `.` accessor, or inside a comment — and insert ready-to-use boilerplate with tab stops.

<Note>
  All completions work in both Effect V3 and V4 unless noted otherwise.
</Note>

## Class extends completions

These completions trigger when your cursor is inside the `extends` clause of a class declaration. They insert the full parent-class call, including the self-referencing type parameter and deterministic tag key.

### `contextSelfInClasses`

Inserts a `Context.Tag("key")<ClassName, Shape>(){}` snippet when you dot-access `Context` in an `extends` clause.

**Support:** V3 ✓ · V4 ✗

```typescript theme={null}
// Typing: class MyService extends Context.|
class MyService extends Context.Tag("MyService")<MyService, { port: number }>()
{}
```

### `effectSelfInClasses`

Inserts an `Effect.Service<ClassName>()("key", { ... }){}` or `Effect.Tag("key")<ClassName, Shape>(){}` snippet when you dot-access `Effect` in an `extends` clause.

**Support:** V3 ✓ · V4 ✗

```typescript theme={null}
// Typing: class Database extends Effect.|
class Database extends Effect.Service<Database>()("Database", {
  effect: Effect.gen(function* () {
    return { query: (sql: string) => Effect.succeed([]) }
  })
}) {}
```

### `serviceMapSelfInClasses`

Inserts a `ServiceMap.Service<ClassName, {}>()( "key"){}` or factory-based `ServiceMap.Service<ClassName>()( "key", { make }){}` snippet when you dot-access `ServiceMap` in an `extends` clause.

**Support:** V3 ✓ · V4 ✓

```typescript theme={null}
// Typing: class Database extends ServiceMap.|

// Option 1 — inline shape
class Database extends ServiceMap.Service<Database, { query: (sql: string) => Effect.Effect<Row[]> }>()("Database") {}

// Option 2 — factory
class Database extends ServiceMap.Service<Database>()("Database", {
  make: Effect.gen(function* () {
    return { query: (sql: string) => Effect.succeed([]) }
  })
}) {}
```

### `effectDataClasses`

Inserts a `Data.TaggedError("ClassName")<{}>{}` or `Data.TaggedClass("ClassName")<{}>{}` snippet when you dot-access `Data` in an `extends` clause.

**Support:** V3 ✓ · V4 ✓

```typescript theme={null}
// Typing: class DatabaseError extends Data.|

// TaggedError
class DatabaseError extends Data.TaggedError("DatabaseError")<{
  message: string
}> {}

// TaggedClass
class Row extends Data.TaggedClass("Row")<{
  id: number
  name: string
}> {}
```

### `effectSchemaSelfInClasses`

Inserts schema class constructor snippets when you dot-access `Schema` (or `Model` in V4) in an `extends` clause. The available variants depend on your Effect version.

**Support:** V3 ✓ · V4 ✓

<Tabs>
  <Tab title="V3 variants">
    ```typescript theme={null}
    class User extends Schema.Class<User>("User")({ name: Schema.String }) {}

    class UserError extends Schema.TaggedError<UserError>()("UserError", {
      message: Schema.String
    }) {}

    class UserEvent extends Schema.TaggedClass<UserEvent>()("UserEvent", {
      id: Schema.Number
    }) {}

    class GetUser extends Schema.TaggedRequest<GetUser>()("GetUser", {
      id: Schema.Number
    }) {}
    ```
  </Tab>

  <Tab title="V4 variants">
    ```typescript theme={null}
    class User extends Schema.Class<User>("User")({ name: Schema.String }) {}

    class UserError extends Schema.TaggedErrorClass<UserError>()("UserError", {
      message: Schema.String
    }) {}

    class UserError extends Schema.ErrorClass<UserError>("UserError")({ message: Schema.String }) {}

    class UserEvent extends Schema.TaggedClass<UserEvent>()("UserEvent", {
      id: Schema.Number
    }) {}

    // Model.Class (effect/unstable)
    class User extends Model.Class<User>("User")({ name: Schema.String }) {}
    ```
  </Tab>
</Tabs>

### `rpcMakeClasses`

Inserts an `Rpc.make("ClassName", { ... }){}` snippet when you dot-access `Rpc` from `@effect/rpc` in an `extends` clause.

**Support:** V3 ✓ · V4 ✗

```typescript theme={null}
// Typing: class GetUser extends Rpc.|
class GetUser extends Rpc.make("GetUser", {
  payload: Schema.Struct({ id: Schema.Number }),
  success: Schema.Struct({ name: Schema.String })
}) {}
```

***

## Dot-access completions

### `genFunctionStar`

Inserts a `gen(function*(){})` snippet when you type `.gen` after any object that has a callable `gen` property — for example `Effect`, `Micro`, or any custom object with a compatible `gen` method.

**Support:** V3 ✓ · V4 ✓

```typescript theme={null}
// Typing: Effect.|
Effect.gen(function* () {
  // cursor placed here
})
```

### `schemaBrand`

Inserts a `brand("varName")` snippet when you dot-access `Schema` inside a variable declaration initializer. The variable name is automatically inferred from the enclosing declaration.

**Support:** V3 ✓ · V4 ✗

```typescript theme={null}
// Typing: const UserId = Schema.String.pipe(Schema.|
// Variable name "UserId" is inferred automatically
const UserId = Schema.String.pipe(Schema.brand("UserId"))
```

***

## Comment directive completions

### `effectDiagnosticsComment`

Inserts an `@effect-diagnostics ruleName:severity` or `@effect-diagnostics-next-line ruleName:severity` directive snippet when you type `@` inside a `//`, `/*`, or `/**` comment. All diagnostic rule names and severity levels are offered as choices.

**Support:** V3 ✓ · V4 ✓

```typescript theme={null}
// Typing: // @|

// @effect-diagnostics floatingEffect:off
const abandoned = Effect.succeed(1)

// @effect-diagnostics-next-line missingEffectError:off
const risky: Effect.Effect<void> = doSomethingRisky()
```

### `effectCodegensComment`

Inserts an `@effect-codegens codegenName` directive snippet when you type `@` inside a comment. All available codegen names are offered as tab-stop choices.

**Support:** V3 ✓ · V4 ✓

```typescript theme={null}
// Typing: // @|

// @effect-codegens accessors
class MyService extends Effect.Service<MyService>()("MyService", {
  // ...
}) {}
```

***

## Codegens

Codegens are comment-directive-driven code generators. You annotate a declaration with an `@effect-codegens` comment and the language service inserts boilerplate into the file. All three codegens are planned but **not yet implemented**.

<Warning>
  Codegens are not yet available. The completion for `@effect-codegens` (above) inserts the directive, but no code is generated from it in the current release.
</Warning>

| Codegen        | Description                                                                                  | Status              |
| -------------- | -------------------------------------------------------------------------------------------- | ------------------- |
| `accessors`    | Generate Service accessor methods from an `@effect-codegens accessors` comment directive     | Not yet implemented |
| `annotate`     | Generate type annotations from an `@effect-codegens annotate` comment directive              | Not yet implemented |
| `typeToSchema` | Generate a Schema from a type alias via an `@effect-codegens typeToSchema` comment directive | Not yet implemented |

When implemented, usage will look like this:

```typescript theme={null}
// @effect-codegens accessors
class Logger extends Effect.Service<Logger>()("Logger", {
  accessors: true,
  effect: Effect.gen(function* () {
    return { log: (msg: string) => Console.log(msg) }
  })
}) {}
// ↑ The language service will insert accessor methods below this class
```

***

## Rename extensions

### `keyStrings`

Extends TypeScript's rename operation to also update key string literals inside Effect class declarations (e.g., the tag key string `"MyService"` when you rename the class `MyService`). This feature is planned but **not yet implemented**.

<Warning>
  `keyStrings` rename extension is not yet available in the current release.
</Warning>

```typescript theme={null}
// Renaming "Database" would also update the string literal "Database"
class Database extends Effect.Service<Database>()("Database", {
  //                                                ^^^^^^^^^^  also renamed
  effect: Effect.succeed({ query: () => Effect.succeed([]) })
}) {}
```
