Skip to content
Permalink
Browse files

Pop open signature help when filling in function in VS Code

  • Loading branch information...
muglug committed Jul 1, 2019
1 parent 67c3726 commit 2e1493be73fdd62e95af53d71cea8196687625df
Showing with 40 additions and 2 deletions.
  1. +35 −0 src/Psalm/CodeLocation/Raw.php
  2. +5 −2 src/Psalm/Codebase.php
@@ -0,0 +1,35 @@
<?php
namespace Psalm\CodeLocation;
use PhpParser;
use function substr_count;
use function substr;
class Raw extends \Psalm\CodeLocation
{
/**
* @param string $file_path
* @param string $file_name
* @param string $file_contents
*/
public function __construct(
string $file_contents,
string $file_path,
int $file_start,
int $file_end
) {
$this->file_start = $file_start;
$this->file_end = $file_end;
$this->raw_file_start = $this->file_start;
$this->raw_file_end = $this->file_end;
$this->file_path = $file_path;
$this->file_name = $file_path;
$this->single_line = false;
$this->preview_start = $this->file_start;
$this->line_number = substr_count(
substr($file_contents, 0, $this->file_start),
"\n"
) + 1;
}
}
@@ -1,7 +1,7 @@
<?php
namespace Psalm;
use LanguageServerProtocol\{Position, Range};
use LanguageServerProtocol\{Position, Range, Command};
use PhpParser;
use Psalm\Internal\Analyzer\Statements\Block\ForeachAnalyzer;
use Psalm\Internal\Analyzer\ProjectAnalyzer;
@@ -1289,7 +1289,10 @@ public function getCompletionItemsForClassishThing(string $type_string, string $
null,
(string)$method_storage->visibility,
$method_storage->cased_name,
$method_storage->cased_name . (count($method_storage->params) !== 0 ? '($0)' : '()')
$method_storage->cased_name . (count($method_storage->params) !== 0 ? '($0)' : '()'),
null,
null,
new Command('Trigger parameter hints', 'editor.action.triggerParameterHints')
);
$completion_item->insertTextFormat = \LanguageServerProtocol\InsertTextFormat::SNIPPET;

1 comment on commit 2e1493b

@iluuu1994

This comment has been minimized.

Copy link
Contributor

commented on 2e1493b Jul 1, 2019

Works like a charm 🙂

Please sign in to comment.
You can’t perform that action at this time.