Imported symbols missing mouse-over popup
Thomas Brix Larsen
brix at brix-verden.dk
Wed Nov 25 21:42:22 UTC 2015
tirsdag den 24. november 2015 22.46.57 CET skrev Thomas Brix Larsen:
> tirsdag den 24. november 2015 22.29.20 CET skrev Pavel Petrushkov:
> > On Mon, Nov 23, 2015 at 8:01 PM, Thomas Brix Larsen <brix at brix-verden.dk>
> > wrote:
> >
> > > søndag den 22. november 2015 20.20.47 CET skrev Milian Wolff:
> > > > On Donnerstag, 19. November 2015 18:53:29 CET Thomas Brix Larsen
wrote:
> > > > > Hi all,
> > > > >
> > > > > I'm working on a plugin for the D Programming Language.
> > > http://dlang.org
> > > > >
> > > > > I currently have a problem with symbols declared in other modules
not
> > > having
> > > > > the mouse-over popup. Here is a screenshot:
> > > > > http://brix-verden.dk/misc/imported_symbols_are_red.png
> > > > >
> > > > > The symbols add and testConstant are imported from "importedstuff".
> > > Here is
> > > > > what duchainify has recorded:
> > > > > http://brix-verden.dk/misc/imported_symbols_are_red.txt
> > > > >
> > > > > Any hints would be appreciated.
> > > >
> > > > Hey Thomas,
> > > >
> > > > where is the source code for your plugin?
> > > >
> > > > Are you importing the parent context of the imports? Maybe that's what
> is
> > > > missing? Afaik that is required to keep the import alive. But it may
> > > also be
> > > > something completely different... :-/ Without the source and an
example
> > > to
> > > > test it I'd have to hard time to come up with a clear answer.
> > > >
> > > > Also, did you write a unit test for this issue yet - is it
reproducible
> > > there?
> > > > Would certainly make it simpler to find a solution to this problem.
> > > >
> > > > Bye
> > > >
> > > >
> > >
> > > Hello Milian,
> > >
> > > I have just pushed the code to github.
> > >
> > > https://github.com/ThomasBrixLarsen/kdev-dlang
> > >
> > > I believe that I have imported the parent context correctly as "Find
uses"
> > > in KDevelop is working. But the mouse-over dialog/window is still
missing.
> > >
> > > To be honest I'm not sure how to make a unit test for this case as the
> > > problem seems graphical.
> > >
> > > - Thomas
> > >
> > > _______________________________________________
> > > KDevelop-devel mailing list
> > > KDevelop-devel at kde.org
> > > https://mail.kde.org/mailman/listinfo/kdevelop-devel
> > >
> >
> > Hey Thomas,
> >
> > I see you reused some of my kdev-go code, nice to know it was useful to
> > someone:)
> >
> > Unfortuntely I cannot help you with this issue. For similar feature in Go
> > it was enough to create
> > NamespaceAliasDeclaration with globalImportIdentifier() and set its
> > ImportIdentifier to namespace
> > that you're importing, but I see you already did that.
> >
> > One thing I can point out is that your import statement ("import
> > importstuff") is not highlighted,
> > but it should be, since you're opening a declaration on it, right? So
maybe
> > you should check
> > if that code does not get executed or something.
> >
> > Otherwise I suggest debugging ContextBrowser::showToolTip to see where
your
> > declaration
> > gets lost.
> >
> > Btw, I cannot compile your plugin, I attached the error I get when running
> > build.sh. If you can
> > figure it how to fix this, I can take a closer look at your code later.
> >
> > Best regards,
> > Pavel.
> >
>
> Hello Pavel,
>
> Yeah I thought that the newest of the language plugins might be most up to
> date with regards to how the API should be used against KDevelop 5. So Go it
> was. :)
>
> I fixed some problems later so that the import is highlighted now. I will
look
> into your debug suggestion.
>
> It looks like you haven't checked out the libdparse submodule. Do something
> like this: git submodule update --init --recursive
>
> - Thomas
>
> _______________________________________________
> KDevelop-devel mailing list
> KDevelop-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kdevelop-devel
>
So I debugged it and it actually kinda finds a use.
This code in DUChainUtils::itemUnderCursor:
//Try finding a use under the cursor
for(int a = 0; a < ctx->usesCount(); ++a)
if( ctx->uses()[a].m_range.contains(c, RangeInRevision::IncludeBackEdge) )
return ctx->topContext()->usedDeclarationForIndex(ctx->uses()
[a].m_declarationIndex);
Returns a nullptr.
Following it further down it seems that
PersistentSymbolTable::self().getFilteredDeclarations(id, top-
>recursiveImportIndices()) in DeclarationId::getDeclaration(...) doesn't give
any results.
- Thomas
More information about the KDevelop-devel
mailing list