1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Limit size of preview snippet

This commit is contained in:
Matthew Brown 2017-01-27 22:39:16 -07:00
parent c868781731
commit f8a70dc707

View File

@ -165,6 +165,14 @@ class CodeLocation
$this->selection_start = max($this->preview_start, $this->selection_start);
$this->selection_end = min($this->preview_end, $this->selection_end);
if ($this->preview_end - $this->selection_end > 200) {
$this->preview_end = (int)strrpos(
$file_contents,
"\n",
$this->selection_end + 200 - strlen($file_contents)
);
}
// reset preview start to beginning of line
$this->column = $this->selection_start -
(int)strrpos($file_contents, "\n", $this->selection_start - strlen($file_contents));