Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Fix References_GrammarTest_Statements#189

Merged
MikhailArkhipov merged 3 commits intomicrosoft:masterfrom
MikhailArkhipov:40
Oct 3, 2018
Merged

Fix References_GrammarTest_Statements#189
MikhailArkhipov merged 3 commits intomicrosoft:masterfrom
MikhailArkhipov:40

Conversation

@MikhailArkhipov
Copy link
Copy Markdown

Fixes #40

Code is pretty confusing, with reassignments and import names same as variable names. Various apps behave differently. Basically the fix is

  • Keep any reference to external files as definition (so use can navigate there)
  • Keep import abc as reference (so use can find all usages of 'abc').


// External module 'abc', URI varies depending on install
var externalUri = references[1].uri;
externalUri.LocalPath.Should().Contain("abc.py");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Contain or EndsWith?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

EndsWith

.Where(v => (v.VariableType == VariableType.Reference || v.VariableType == VariableType.Value) &&
v.ScopeLevel <= mainDefinition.ScopeLevel);
variables = new[] { mainDefinition }.Concat(others.Concat(defsToRefs));
variables = new[] { mainDefinition }.Concat(imports).Concat(others.Concat(defsToRefs));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it just rearrangement, or some of the variables will be excluded?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No exclusion, just keeping imports as definitions. Before they were converted to references since they were below in the same scope such as

abc = 1
import abc

@MikhailArkhipov MikhailArkhipov merged commit 13448bb into microsoft:master Oct 3, 2018
@MikhailArkhipov MikhailArkhipov deleted the 40 branch October 4, 2018 17:11
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
Fix References_GrammarTest_Statements
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

References_GrammarTest_Statements test fails

2 participants