bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.61k stars 94 forks source link

`Smart Select` can't select content without brackets #1423

Open kanlukasz opened 4 years ago

kanlukasz commented 4 years ago

Describe the bug Smart Select cannot select content without parentheses The first expansion marks first bracket (what for ??), and then second expansion select all the content, including the brackets. In the end, it is impossible to mark the whole without brackets

To Reproduce

<?php

if ($_POST) {
  print 'Hello post data';
  print 'Hello post data';
  print 'Hello post data';
}

Screenshot - Current behavior bad

Screenshot - Expected behavior good

Platform and version

Version: 1.49.1 (system setup)
Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf
Date: 2020-09-16T23:27:51.792Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041
bmewburn commented 2 years ago

Not sure about this one. The reason the opening brace is selected first is because the cursor is next to it and this is deemed more important than whitespace so it becomes the terminal node in the syntax tree and the ranges computed from there. You're right that it differs from the default vscode implementation but it is still possible to select the block without the braces if started within the block.

smart-select

Comparing to another language, Typescript, ts server shows similar behaviour to intelephense when the cursor is adjacent to opening brace.

smart-select-ts