<p></p>
<blockquote>
<p dir="auto">I'm not really happy with <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/geany/geany/commit/b710cf3aa1300dd43e4edfcf152f7f3a10f9a686/hovercard" href="https://github.com/geany/geany/commit/b710cf3aa1300dd43e4edfcf152f7f3a10f9a686"><tt>b710cf3</tt></a></p>
</blockquote>
<blockquote>
<p dir="auto">it makes a lot of assumption</p>
</blockquote>
<p dir="auto">Basically the only assumption that this makes is that sources and corresponding headers have the same file name and headers have some of the commonly used header extensions.</p>
<blockquote>
<p dir="auto">it seems really expensive</p>
</blockquote>
<p dir="auto">Note that this doesn't use any file system operations - this works over TMSourceFile structures which represent parsed source files, which, without any extensions, are only open documents (with something like ProjectOrganizer it can be whole projects). It's true this function does string comparisons which can be a bit expensive but the number of files tends to be 2 orders of magnitude less than the number of tags.</p>
<blockquote>
<p dir="auto">works only for C/C++ by hardcoding</p>
</blockquote>
<p dir="auto">This is true but I don't see any sign that any of the other ctags parsers would get the capabilities of the cxx parser soon so scope autocompletion will unfortunately be C/C++ only feature for the foreseeable future.</p>
<blockquote>
<p dir="auto">has nothing to do with local variables</p>
</blockquote>
<p dir="auto">It doesn't but neither other things in this PR do - this is about improving scope autocompletion. When you type something like</p>
<pre class="notranslate"><code class="notranslate">void MyClass::myFunction() {
    name.  // <--
}
</code></pre>
<p dir="auto">it makes a difference whether the code first looks for a member <code class="notranslate">name</code> in the header or an arbitrary member <code class="notranslate">name</code> in the workspace - in which case you get incorrect results.</p>
<p dir="auto">In fact, I was thinking about improving this by looking at <code class="notranslate">#include</code> tags (we currently ignore them) and using tags from the included files first.</p>
<p dir="auto">Now thinking about it I should have implemented it differently - I could do it inside <code class="notranslate">sort_found_tags()</code> and compare the file name of the sorted tag with the source file name there Will be less comparisons and shorter code.</p>
<blockquote>
<p dir="auto">Please lets discuss that feature in a separate PR.</p>
</blockquote>
<p dir="auto">I can separate it but in some form I want to keep this feature because it improves the results of scope autocompletion.</p>
<blockquote>
<p dir="auto">Also, if we want that, then it may make sense to expose that "find header" logic somehow to implement a "go to header" feature (I think ProjectOrganizer already has something like that?)</p>
</blockquote>
<p dir="auto">The difference between ProjectOrganizer and Geany is that Geany doesn't know about all project files (there's no notion of a file belonging to a project in Geany). For every project file in ProjectOrganizer there is TMSourceFile, in Geany just for open files and this functionality cannot be easily replicated in Geany itself unless Geany would search the file system for the header.</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/3185#issuecomment-1114065878">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJZZ54CIMNNBMI4O5D3VHWZTJANCNFSM5UWGU33A">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAIOWJ56ZEHJHAUEPCYY4HTVHWZTJA5CNFSM5UWGU33KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIJTUXVQ.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/3185/c1114065878</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/3185#issuecomment-1114065878",
"url": "https://github.com/geany/geany/pull/3185#issuecomment-1114065878",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>