Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra quotation marks when completing shape fields #36

Closed
juanfernandoe opened this issue Jan 24, 2019 · 2 comments
Closed

Extra quotation marks when completing shape fields #36

juanfernandoe opened this issue Jan 24, 2019 · 2 comments
Labels

Comments

@juanfernandoe
Copy link

Hi,

When you are selection and option from the autocompletition list, vscode don't remove
the last '

Example:
if you have a shape with field message
$test['message'] = 'hello world';

then you are accessing that field, vscode automatically create the quotation mark for close.
$test['']

then you pick 'message' from the autocompletition list, the result is
$test['message'']

the problem is the double quotation mark to close.

@PranayAgarwal
Copy link
Member

I remember discussing this with the HHVM team a little while ago. I'll try and pull up that thread to see what the status of the fix is, but right now an option is to not insert the first ' and just start typing the field name after [. Results will still show up, and it will automatically insert both ' characters after you hit enter.

@fredemmott
Copy link
Contributor

Relevant code and som explanation of the problem at https://github.com/facebook/hhvm/blob/a8a3a07ee94f2304fba2f21d366be45382b98e38/hphp/hack/src/server/autocompleteService.ml#L608

Two ways come to mind to resolve this without a significant rewrite:

  • lookahead here to make the pos_end include the next character if it's a single quote - i.e. replace 'f' with 'foo'
  • lookahead in autocomplete_shape_key, and don't include a trailing quote in the replacement if the next character is a ' - i.e. replace 'f with 'foo, with the trailing ' untouched

The first option is probably best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants