mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fixes to LSP protocol (#4143)
* Fix missing parameter in LSP textDocument.didChange This parameter was accepted, but not documented. Since the JSON-RPC Dispatcher looks at the comments for type information, it would fail to find info and produce: PHP Notice: Undefined offset: 1 in vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php on line 141 Combined with issue #4142, this ended up violating the protocol. * Ignore out-of-project files in textDocument.completion Other methods, such as didOpen and didChange already checked for this, but completion did not. This would lead to funny behaviour, where triggering completion would cause the file to be analyzed, but only using the on-disk state. And any changes to the file would never be analyzed. This ignores out-of-project files for completion, too.
This commit is contained in:
parent
274d19c649
commit
ab5850364d
@ -92,6 +92,7 @@ class TextDocument
|
|||||||
/**
|
/**
|
||||||
* The document change notification is sent from the client to the server to signal changes to a text document.
|
* The document change notification is sent from the client to the server to signal changes to a text document.
|
||||||
*
|
*
|
||||||
|
* @param \LanguageServerProtocol\VersionedTextDocumentIdentifier $textDocument
|
||||||
* @param \LanguageServerProtocol\TextDocumentContentChangeEvent[] $contentChanges
|
* @param \LanguageServerProtocol\TextDocumentContentChangeEvent[] $contentChanges
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -243,6 +244,9 @@ class TextDocument
|
|||||||
$this->server->doAnalysis();
|
$this->server->doAnalysis();
|
||||||
|
|
||||||
$file_path = LanguageServer::uriToPath($textDocument->uri);
|
$file_path = LanguageServer::uriToPath($textDocument->uri);
|
||||||
|
if (!$this->codebase->config->isInProjectDirs($file_path)) {
|
||||||
|
return new Success([]);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$completion_data = $this->codebase->getCompletionDataAtPosition($file_path, $position);
|
$completion_data = $this->codebase->getCompletionDataAtPosition($file_path, $position);
|
||||||
|
Loading…
Reference in New Issue
Block a user