<p></p>
<blockquote>
<p dir="auto">This may be true for well-written, valid code. But we deal with code that's just being written, and in that case it can absolutely be useful to autocomplete later declarations, perhaps knowing that I need to move the declaration upwards after finishing this line.</p>
</blockquote>
<p dir="auto">Can do that. On the one hand I don't think it's so common to have a variable declared after its use (I typically forget to declare it altogether), on the other hand there will hopefully not be too many variables with the same name declared in the same function that this would cause problems.</p>
<p dir="auto">Also consider this:</p>
<pre><code>void foo()
{
        Foo a;
        if (true)
        {
                Bar a;
                if (true)
                {
                        Baz a;
                }
        }
        // <-- cursor here
        if (true)
        {
                Bar2 a;
                if (true)
                {
                        Baz2 a;
                }
        }
}
</code></pre>
<p dir="auto">We don't get nesting information for local variables by ctags - all the <code>a</code> variables in the above code have the same scope returned by ctags. So by removing some of them we may at least reduce the danger that the wrong one is used.</p>
<blockquote>
<p dir="auto">I don't think we apply that logic to global tags like static variables, do we? Like, I can autocomplete a call to foo() even if its declaration is later in the file?</p>
</blockquote>
<p dir="auto">No, we don't, I added it just for the local variables.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/3175#issuecomment-1105209998">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ5C2O6DVXZPKKFZE5TVGFKE5ANCNFSM5T5CX5RA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAIOWJ47UGYWVEYUQQOFE3DVGFKE5A5CNFSM5T5CX5RKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIHQCVDQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><geany/geany/pull/3175/c1105209998</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/3175#issuecomment-1105209998",
"url": "https://github.com/geany/geany/pull/3175#issuecomment-1105209998",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>