Skip to content

Commit d42ef33

Browse files
mikebronnerclaude
andcommitted
fix: 🔧 change LSP text sync from INCREMENTAL to FULL
The INCREMENTAL sync implementation was broken and causing files to show as having 0-1 bytes of content, preventing PHPCS from detecting lint errors. FULL sync is simpler and more appropriate for a linting server. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 94219cf commit d42ef33

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎lsp-server/src/main.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl LanguageServer for PhpcsLanguageServer {
516516
Ok(InitializeResult {
517517
capabilities: ServerCapabilities {
518518
text_document_sync: Some(TextDocumentSyncCapability::Kind(
519-
TextDocumentSyncKind::INCREMENTAL,
519+
TextDocumentSyncKind::FULL,
520520
)),
521521
diagnostic_provider: Some(DiagnosticServerCapabilities::Options(
522522
DiagnosticOptions {
@@ -651,12 +651,13 @@ impl LanguageServer for PhpcsLanguageServer {
651651
async fn did_change(&self, params: DidChangeTextDocumentParams) {
652652
let uri = params.text_document.uri.clone();
653653

654+
// With FULL sync, we always get the complete document content
654655
if let Some(change) = params.content_changes.first() {
655656
let mut docs = self.open_docs.write().unwrap();
656657
docs.insert(uri.clone(), change.text.clone());
657658
}
658659

659-
// Debounce/skip intermediate changes - diagnostics will be provided via diagnostic() method
660+
// Diagnostics will be provided via diagnostic() method
660661
// This reduces unnecessary PHPCS runs during rapid typing
661662
}
662663

0 commit comments

Comments
 (0)