# lsp: Honor dynamic LSP document selectors \(\#59243\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/23aca9895c8e9001845282e3d9f13d5c99641b58)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 23aca9895c8e9001845282e3d9f13d5c99641b58

Requested commit: 23aca9895c8e9001845282e3d9f13d5c99641b58

Commit: 23aca9895c8e9001845282e3d9f13d5c99641b58

Tree: cf75b71e417517584d70ddd870390dfbe5abd94d

Author: Shuhei Kadowaki

Committer: GitHub

## Message

```
lsp: Honor dynamic LSP document selectors (#59243)

Zed previously discarded the documentSelector from dynamically
registered textDocument capabilities and treated those capabilities as
applicable to every buffer attached to the server. This could route
requests for documents outside a registration selector.

Track dynamic textDocument registrations by method and registration ID,
and use their selectors when routing local requests, checking
capabilities, and deriving completion triggers. Static capabilities
continue to apply to every attached buffer. Language and URI scheme
matching are supported, while unsupported pattern matching remains
fail-open.

Keep document color, symbol, link, code lens, and folding range caches
aligned with the selector-aware server set so incapable or non-matching
servers do not leave caches perpetually incomplete.

Require an advertised diagnostic provider before sending pull diagnostic
requests, and add integration coverage for selector-aware dynamic
completion registration and trigger updates.

---

Release Notes:

- Improved language server request routing to respect dynamically
registered document selectors.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

- [8a4bd132a60c4091b37e35a9a4ff6d703e2d2645](https://git.cafe/gitcafe/zed/commit/8a4bd132a60c4091b37e35a9a4ff6d703e2d2645?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/23aca9895c8e9001845282e3d9f13d5c99641b58?format=markdown)
