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

[display] sort vars by "distance" of their declaration to display position #7069

Closed
Gama11 opened this issue May 22, 2018 · 3 comments
Closed
Labels
feature-ide IDE / Editor support

Comments

@Gama11
Copy link
Member

Gama11 commented May 22, 2018

(if there's no expected type)

package cases;

class Issue7069 extends DisplayTestCase {
	/**
	class Main {
		var field:Int;
		static function main(argument:Int) {
			var local:Int;
			{
				var blockLocal:Int;
				for (i in 0...10) {
					{-1-}
				}
			}
		}
	}
	**/
	function test() {
		var results = toplevel(pos(1));
		eq("i", results[0].name);
		eq("blockLocal", results[1].name);
		eq("local", results[2].name);
		eq("argument", results[3].name);
		eq("field", results[4].name);
	}
}

The reason why this would be helpful is fairly obvious: within that for, you're most likely to need i, then blockLocal, etc...

@Simn
Copy link
Member

Simn commented May 22, 2018

Is there a precedence to such a feature? I'm still not sure if this is the right thing to do.

@jdonaldson
Copy link
Member

One might argue it's like selector specificity in css.

@Simn Simn added the feature-ide IDE / Editor support label May 22, 2018
@EricBishton
Copy link
Member

IntelliJ sorts the five closest (or most likely by type) first and alphabetizes the rest. However, receiving them in "closest" order, and then re-sorting them, if necessary, is quite acceptable.

@Simn Simn closed this as completed in a93b907 May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-ide IDE / Editor support
Projects
None yet
Development

No branches or pull requests

4 participants