# LspServer

## LspServer

LspServer class for Daytona SDK.

### Constructors

#### new LspServer()

```ruby
def initialize(language_id:, path_to_project:, toolbox_api:, sandbox_id:, otel_state: nil)

```

**Parameters**:

- `language_id` _Symbol_ -
- `path_to_project` _String_ -
- `toolbox_api` _DaytonaToolboxApiClient:LspApi_ -
- `sandbox_id` _String_ -
- `otel_state` _Daytona:OtelState, nil_ -

**Returns**:

- `LspServer` - a new instance of LspServer

### Methods

#### language_id()

```ruby
def language_id()

```

**Returns**:

- `Symbol`

#### path_to_project()

```ruby
def path_to_project()

```

**Returns**:

- `String`

#### toolbox_api()

```ruby
def toolbox_api()

```

**Returns**:

- `DaytonaToolboxApiClient:LspApi`

#### sandbox_id()

```ruby
def sandbox_id()

```

**Returns**:

- `String`

#### completions()

```ruby
def completions(path:, position:)

```

Gets completion suggestions at a position in a file

**Parameters**:

- `path` _String_ -
- `position` _Daytona:LspServer:Position_ -

**Returns**:

- `DaytonaApiClient:CompletionList`

#### did_close()

```ruby
def did_close(path)

```

Notify the language server that a file has been closed.
This method should be called when a file is closed in the editor to allow
the language server to clean up any resources associated with that file.

**Parameters**:

- `path` _String_ -

**Returns**:

- `void`

#### did_open()

```ruby
def did_open(path)

```

Notifies the language server that a file has been opened.
This method should be called when a file is opened in the editor to enable
language features like diagnostics and completions for that file. The server
will begin tracking the file's contents and providing language features.

**Parameters**:

- `path` _String_ -

**Returns**:

- `void`

#### document_symbols()

```ruby
def document_symbols(path)

```

Gets symbol information (functions, classes, variables, etc.) from a document.

**Parameters**:

- `path` _String_ -

**Returns**:

- `Array\<DaytonaToolboxApiClient:LspSymbol]`

#### sandbox_symbols()

```ruby
def sandbox_symbols(query)

```

Searches for symbols matching the query string across all files
in the Sandbox.

**Parameters**:

- `query` _String_ -

**Returns**:

- `Array\<DaytonaToolboxApiClient:LspSymbol]`

#### start()

```ruby
def start()

```

Starts the language server.
This method must be called before using any other LSP functionality.
It initializes the language server for the specified language and project.

**Returns**:

- `void`

#### stop()

```ruby
def stop()

```

Stops the language server.
This method should be called when the LSP server is no longer needed to
free up system resources.

**Returns**:

- `void`