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

autocomplete funcs with parens, replace current identifier #20387

Merged
merged 2 commits into from
Feb 3, 2018

Conversation

cpirich
Copy link
Contributor

@cpirich cpirich commented Feb 2, 2018

  • Modify autocomplete so that we replace the entire identifier (previously, we only replaced the text before the cursor that was used as the filterText). Example: if you have a call to randomNumber(), then move the cursor to between the r and the a and type s, you will see a dropdown with matches for items that contain r before s (filterText is rs) - including readRecords, like this:

pasted image 0 1

  • If you select readRecords from the dropdown above, we now replace rsandomNumber with readRecords. Previously, we'd only replace rs with readRecords and you'd end up with readRecordsandomNumber
  • Change autocomplete to append a pair of parentheses when completing a function name (but not a property). We also move the cursor back in between the parentheses if the function expects parameters, and the parameter autocomplete / tooltip will automatically kick in for the first param.
  • We previously did something similar in starwars playlab under a flag called autocompleteFunctionsWithParens - but that mode also added a semicolon. That mode has been renamed to autcompleteFunctionsWithSemicolon and the behavior is preserved.
  • Added special handling for the case where you are modifying a function call (as in the first example above), such that we don't add parentheses since they are already present, but we move the cursor forward into the position of the first parameter if the function has parameters.

Examples
autocompleting a function that expects a parameter:
autocomplete_parens
autocompleting a member function that expects a parameter,
autocompleting a member property,
autocompleting a member function that does not expect a parameter,
autocompleting an existing member function call to a different function call (multiple times):
autocomplete_funcs_vs_props_2

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Seems much better.

@cpirich cpirich merged commit 644258a into staging Feb 3, 2018
@cpirich cpirich deleted the ace_autocomplete_enhancements branch February 3, 2018 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants