diff options
| author | adamdottv <[email protected]> | 2025-04-30 12:20:51 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-04-30 12:20:51 -0500 |
| commit | ed50c3678999e6b0e42bd14367b79e4348db29cf (patch) | |
| tree | dc43612ea24bf8ac03c6bf86379e3a18f27023d4 /internal/lsp/client.go | |
| parent | 98cf65b425014712f711cd7637def12c91f3a54b (diff) | |
| download | opencode-ed50c3678999e6b0e42bd14367b79e4348db29cf.tar.gz opencode-ed50c3678999e6b0e42bd14367b79e4348db29cf.zip | |
fix: lsp issues with tmp and deleted files
Diffstat (limited to 'internal/lsp/client.go')
| -rw-r--r-- | internal/lsp/client.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/lsp/client.go b/internal/lsp/client.go index d115b2404..355b05d30 100644 --- a/internal/lsp/client.go +++ b/internal/lsp/client.go @@ -627,6 +627,15 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error { func (c *Client) NotifyChange(ctx context.Context, filepath string) error { uri := fmt.Sprintf("file://%s", filepath) + // Verify file exists before attempting to read it + if _, err := os.Stat(filepath); err != nil { + if os.IsNotExist(err) { + // File was deleted - close it in the LSP client instead of notifying change + return c.CloseFile(ctx, filepath) + } + return fmt.Errorf("error checking file: %w", err) + } + content, err := os.ReadFile(filepath) if err != nil { return fmt.Errorf("error reading file: %w", err) |
