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

Hide reserved identifiers in autocomplete list when _ has not been typed #4939

Closed
Colengms opened this issue Feb 8, 2020 · 7 comments
Closed
Assignees
Labels
Feature: Auto-complete Feature Request Feature: Signature Help fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@Colengms
Copy link
Contributor

Colengms commented Feb 8, 2020

IntelliSense will provide suggestions that include anything and everything in system headers, a lot of which the user is unlikely to use.

image

It may be possible to remove some of these identifiers, such as identifiers reserved for internal use by standard headers.

the identifiers with a double underscore anywhere are reserved;
the identifiers that begin with an underscore followed by an uppercase letter are reserved;
the identifiers that begin with an underscore are reserved in the global namespace.
(from: https://en.cppreference.com/w/cpp/language/identifiers )

Though, the last one might need to be kept, as there are various commonly used functions that match that pattern. i.e. MS implementation of POSIX functions such as _open, _read, etc.

@sean-mcmanus
Copy link
Contributor

There is an existing issue that is related: #1798

@bobbrow bobbrow modified the milestones: Backlog, 0.30.0 Jul 24, 2020
@bobbrow bobbrow modified the milestones: 0.30.0, 0.31.0 Aug 11, 2020
@bobbrow bobbrow changed the title Add setting to exclude suggestion of reserved identifier in system defines. Auto-complete filters Aug 28, 2020
@bobbrow bobbrow modified the milestones: 1.1.0, 1.2.0 Aug 28, 2020
@bobbrow bobbrow modified the milestones: 1.2.0, On Deck Oct 20, 2020
@Colengms Colengms modified the milestones: On Deck, 1.6.0 Jun 15, 2021
@jureid jureid modified the milestones: 1.6.0, On Deck Aug 2, 2021
@Colengms
Copy link
Contributor Author

When using tag parser, and completing a member function/variable, would it be possible to filter the results to only member functions/variables? Seems like the tag parser should have that info.

@sean-mcmanus
Copy link
Contributor

@Colengms We do that already -- we just don't have the type available for the class used. Are you seeing a case where global variables are showing in the completion list when using a member access?

@Colengms
Copy link
Contributor Author

@sean-mcmanus I meant members of the current class. Showing members from all classes isn't particularly useful. :/ But, it makes sense that we would need semantic parsing to identify the class used.

image

@bobbrow
Copy link
Member

bobbrow commented Feb 15, 2022

Instead of adding settings around this the current thinking is that we just remove the symbols starting with _ from the suggestion list if the user does not start the symbol they are currently typing with a _. This will prevent the fuzzy matching from matching reserved symbols.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Feb 15, 2022

@bobbrow I'm not opposed to do that, but I believe that it won't actually improve the experience significantly, because under normal circumstances, users who type any letter will not have __ variables sorted near the top, regardless of if they're filtered or not. I believe it would be better if we:

  1. Identified an exact repro case.
  2. The exact improvements that will result after the fix.

So far I haven't seen this. I believe in the vast majority of cases where users are complaining about __ results is when a bug is occurring that is causing local variables (or other valid user variables) to not be shown, such as bug #8610 or whenever it falls back to the tag parser behavior. Implementing the suggested fix would just remove the __ variables for the rare case in which users scroll through the big list of global variables, which is not a likely occurrence, and is not a scenario that users are complaining about from what I understand, i.e. users want valid useful results to appear sorted first.

@bobbrow bobbrow changed the title Auto-complete filters Hide reserved identifiers in autocomplete list when _ has not been typed Feb 15, 2022
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, 1.10.0 Mar 9, 2022
@michelleangela michelleangela added the fixed Check the Milestone for the release in which the fix is or will be available. label Mar 14, 2022
@michelleangela
Copy link
Contributor

michelleangela commented Mar 14, 2022

Final behavior:
Reserved identifiers with characters that match typed characters in the same order, but not contiguously are initially filtered from the auto-completion list.

Example:
Typed characters are "ab", then identifiers that contain characters "ab" in the same order but not in contiguously such as in the pattern <any-or-no-character>a<any-or-no-character>b<any-or-no-character> will be filtered from the auto-completion list.

Bypassing the filter:
Typing an underscore _ as the initial character will bypass this filter, or doing a ctrl + space in the same location will invoke to show all auto-complete suggestions.

@michelleangela michelleangela modified the milestones: 1.10.0, 1.9 Mar 14, 2022
@sean-mcmanus sean-mcmanus modified the milestones: 1.9, 1.9.4 Mar 14, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: Auto-complete Feature Request Feature: Signature Help fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

6 participants