@@ -3,7 +3,6 @@ package app
33import (
44 "context"
55 "database/sql"
6− "log/slog"
76
87 "github.com/kujtimiihoxha/termai/internal/config"
98 "github.com/kujtimiihoxha/termai/internal/db"
@@ -23,8 +22,6 @@ type App struct {
2322 Permissions permission.Service
2423
2524 LSPClients map[string]*lsp.Client
26−
27− ceanups []func()
2825}
2926
3027func New(ctx context.Context, conn *sql.DB) *App {
@@ -44,10 +41,7 @@ func New(ctx context.Context, conn *sql.DB) *App {
4441 }
4542
4643 for name, client := range cfg.LSP {
47− lspClient, err := lsp.NewClient(client.Command, client.Args...)
48− app.ceanups = append(app.ceanups, func() {
49− lspClient.Close()
50− })
44+ lspClient, err := lsp.NewClient(ctx, client.Command, client.Args...)
5145 workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient)
5246 if err != nil {
5347 logging.Error("Failed to create LSP client for", name, err)
@@ -64,13 +58,3 @@ func New(ctx context.Context, conn *sql.DB) *App {
6458 }
6559 return app
6660}
67−
68−func (a *App) Close() {
69− for _, cleanup := range a.ceanups {
70− cleanup()
71− }
72− for _, client := range a.LSPClients {
73− client.Close()
74− }
75− slog.Info("App closed")
76−}