Skip to content

Simplify FAR impl wrt searching for global namespaces#61933

Merged
CyrusNajmabadi merged 5 commits intodotnet:mainfrom
CyrusNajmabadi:simplifyFAR
Jun 15, 2022
Merged

Simplify FAR impl wrt searching for global namespaces#61933
CyrusNajmabadi merged 5 commits intodotnet:mainfrom
CyrusNajmabadi:simplifyFAR

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 15, 2022 19:40
@CyrusNajmabadi CyrusNajmabadi requested a review from dibarbet June 15, 2022 19:40
@ghost ghost added the Area-IDE label Jun 15, 2022

static bool IsCandidate(SyntaxToken t, ISyntaxFactsService syntaxFacts, string text)
=> syntaxFacts.IsGlobalNamespaceKeyword(t) || (syntaxFacts.IsIdentifier(t) && syntaxFacts.TextMatch(t.ValueText, text));
=> syntaxFacts.IsIdentifier(t) && syntaxFacts.TextMatch(t.ValueText, text);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ugly hack where we used the same path for identifier lookup to lookup the 'Global' keyword.

containsGlobalKeyword = containsGlobalKeyword || syntaxFacts.IsGlobalNamespaceKeyword(token);

if (syntaxFacts.IsIdentifier(token) ||
syntaxFacts.IsGlobalNamespaceKeyword(token))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same ugly hack where when we encountered this specific keyword, we added it to the identifier set for the file. this was because we didn't use to store any other token information as a bit in the index. but we changed that up ages ago, and it's trivial to store this info.

public bool ContainsTupleExpressionOrTupleType => _contextInfo.ContainsTupleExpressionOrTupleType;
public bool ContainsGlobalSuppressMessageAttribute => _contextInfo.ContainsGlobalSuppressMessageAttribute;
public bool ContainsConversion => _contextInfo.ContainsConversion;
public bool ContainsUsingStatement => _contextInfo.ContainsUsingStatement;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just sorted for my sanity. and public bool ContainsGlobalKeyword => _contextInfo.ContainsGlobalKeyword; was added.

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge June 15, 2022 20:22
@CyrusNajmabadi CyrusNajmabadi merged commit 5f01883 into dotnet:main Jun 15, 2022
@ghost ghost added this to the Next milestone Jun 15, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the simplifyFAR branch June 15, 2022 22:16
@RikkiGibson RikkiGibson modified the milestones: Next, 17.3 P3 Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants