@@ -324,6 +324,9 @@ type OpenFileInfo struct {
324// HandlesFile checks if this LSP client handles the given file based on its
324// HandlesFile checks if this LSP client handles the given file based on its
325// extension and whether it's within the working directory.
325// extension and whether it's within the working directory.
326func (c *Client) HandlesFile(path string) bool {
326func (c *Client) HandlesFile(path string) bool {
327 if !fsext.HasPrefix(path, c.cwd) {
330 if !fsext.HasPrefix(path, c.cwd) {
328 slog.Debug("File outside workspace", "name", c.name, "file", path, "workDir", c.cwd)
331 slog.Debug("File outside workspace", "name", c.name, "file", path, "workDir", c.cwd)
329 return false
332 return false
@@ -364,6 +367,9 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error {
365// NotifyChange notifies the server about a file change.
368// NotifyChange notifies the server about a file change.
366func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
369func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
367 uri := string(protocol.URIFromPath(filepath))
373 uri := string(protocol.URIFromPath(filepath))
369 content, err := os.ReadFile(filepath)
375 content, err := os.ReadFile(filepath)
@@ -420,12 +426,18 @@ func (c *Client) GetFileDiagnostics(uri protocol.DocumentURI) []protocol.Diagnos
421// GetDiagnostics returns all diagnostics for all files.
427// GetDiagnostics returns all diagnostics for all files.
422func (c *Client) GetDiagnostics() map[protocol.DocumentURI][]protocol.Diagnostic {
428func (c *Client) GetDiagnostics() map[protocol.DocumentURI][]protocol.Diagnostic {
423 return c.diagnostics.Copy()
432 return c.diagnostics.Copy()
426// GetDiagnosticCounts returns cached diagnostic counts by severity.
435// GetDiagnosticCounts returns cached diagnostic counts by severity.
427// Uses the VersionedMap version to avoid recomputing on every call.
436// Uses the VersionedMap version to avoid recomputing on every call.
428func (c *Client) GetDiagnosticCounts() DiagnosticCounts {
437func (c *Client) GetDiagnosticCounts() DiagnosticCounts {
439+ return DiagnosticCounts{}
429 currentVersion := c.diagnostics.Version()
441 currentVersion := c.diagnostics.Version()
431 c.diagCountsMu.Lock()
443 c.diagCountsMu.Lock()
@@ -459,6 +471,9 @@ func (c *Client) GetDiagnosticCounts() DiagnosticCounts {
460// OpenFileOnDemand opens a file only if it's not already open.
472// OpenFileOnDemand opens a file only if it's not already open.
461func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
473func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
462 // Check if the file is already open
477 // Check if the file is already open
463 if c.IsFileOpen(filepath) {
478 if c.IsFileOpen(filepath) {
464 return nil
479 return nil
@@ -501,6 +516,9 @@ func (c *Client) openKeyConfigFiles(ctx context.Context) {
502// WaitForDiagnostics waits until diagnostics change or the timeout is reached.
517// WaitForDiagnostics waits until diagnostics change or the timeout is reached.
503func (c *Client) WaitForDiagnostics(ctx context.Context, d time.Duration) {
518func (c *Client) WaitForDiagnostics(ctx context.Context, d time.Duration) {
504 ticker := time.NewTicker(200 * time.Millisecond)
522 ticker := time.NewTicker(200 * time.Millisecond)
505 defer ticker.Stop()
523 defer ticker.Stop()
506 timeout := time.After(d)
524 timeout := time.After(d)