Re: completion in java for classes in the same package
ian martins <[email protected]> Fri, 18 Oct 2019 06:25:56 -0400
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <CAC=rjb6vEbLQigE0EU=w_y33CKAVhBP26i8J8LmzTC00Oi6=cA@mail.gmail.com> |
--===============6594124744125150928== Content-Type: multipart/alternative; boundary="0000000000001fde1f05952cc322" --0000000000001fde1f05952cc322 Content-Type: text/plain; charset="UTF-8" Eric, thanks for the quick response and thanks for the pointers. I'll see what I can do. On Mon, Oct 14, 2019 at 8:18 PM Eric Ludlam <[email protected]> wrote: > On 10/14/19 3:12 PM, ian martins wrote: > > Hello, > > > > I want to use semantic for completion in java, but it doesn't seem to > > find classes in the same package as the class being visited in the > > current buffer. > > > > For example, if I have the following package structure: > > > > mypackage/MyClassA > > /MyClassB > > > > and I open MyClassA in a buffer and try to auto complete the methods of > > an object of type MyClassB, semantic says > > "semantic-analyze-possible-completions-default: Cannot find types for > > `MyClassB classB'" > > > > I found that if I add an "import mypackage.MyClassB;" at the top of > > MyClassA, it'll work. But this shouldn't be necessary. Is this > intentional? > > > > I'm tested on > > emacs 24.5, semantic 2.2 and > > emacs 26.3, semantic 2.2. > > Hi Ian, > > I haven't been working on semantic in a few years, and I never did > serious java development myself, but maybe I can provide a couple pointers. > > The base 'java' support with semantic is pretty simple, as per you > discovering you need to be specific about what to import. Think of it > as assuming java acts like C. > > The semantic/db-javap.el support file had a range of semanticdb database > tables designed to wrap directories and jar files so you can look up > symbols. These were the wrappers that made semantic aware of some of the > java library structure. I don't recall the specifics, but reading > through it, it looks like it has the feature you want via > `semanticdb-table-java-directory' and some overrides for the symbol > analyzer. > > This can be found in cedet from sourceforge. I can't find the file in > the version of cedet included with Emacs. > > I'm going to assume you are using semantic that is built into emacs > since cedet from SF doesn't work well with newer versions of emacs due > to the conversion of eieio. > > It might be possible to pull that one file over along with a copy of > cedet-java.el and enable it. It might need changes based on the changes > to eieio. I don't really know why it was left out of emacs. > > If you get it working, I'd recommend sending it along to emacs > maintainers so it can be included. > > Eric > --0000000000001fde1f05952cc322 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Eric, thanks for the quick response and thanks for the poi= nters. I'll see what I can do.<br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 14, 2019 at 8:18 PM Eric = Ludlam <<a href=3D"mailto:[email protected]">[email protected]</= a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p= x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On= 10/14/19 3:12 PM, ian martins wrote:<br> > Hello,<br> > <br> > I want to use semantic for completion in java, but it doesn't seem= to <br> > find classes in the same package as the class being visited in the <br= > > current buffer.<br> > <br> > For example, if I have the following package structure:<br> > <br> >=C2=A0 =C2=A0 =C2=A0 mypackage/MyClassA<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/MyClassB<br> > <br> > and I open MyClassA in a buffer and try to auto complete the methods o= f <br> > an object of type MyClassB, semantic says <br> > "semantic-analyze-possible-completions-default: Cannot find types= for <br> > `MyClassB classB'"<br> > <br> > I found that if I add an "import mypackage.MyClassB;" at the= top of <br> > MyClassA, it'll work. But this shouldn't be necessary. Is this= intentional?<br> > <br> > I'm tested on<br> > emacs 24.5, semantic 2.2 and<br> > emacs 26.3, semantic 2.2.<br> <br> Hi Ian,<br> <br> I haven't been working on semantic in a few years, and I never did <br> serious java development myself, but maybe I can provide a couple pointers.= <br> <br> The base 'java' support with semantic is pretty simple, as per you = <br> discovering you need to be specific about what to import.=C2=A0 Think of it= <br> as assuming java acts like C.<br> <br> The semantic/db-javap.el support file had a range of semanticdb database <b= r> tables designed to wrap directories and jar files so you can look up <br> symbols. These were the wrappers that made semantic aware of some of the <b= r> java library structure.=C2=A0 I don't recall the specifics, but reading= <br> through it, it looks like it has the feature you want via <br> `semanticdb-table-java-directory' and some overrides for the symbol <br= > analyzer.<br> <br> This can be found in cedet from sourceforge.=C2=A0 I can't find the fil= e in <br> the version of cedet included with Emacs.<br> <br> I'm going to assume you are using semantic that is built into emacs <br= > since cedet from SF doesn't work well with newer versions of emacs due = <br> to the conversion of eieio.<br> <br> It might be possible to pull that one file over along with a copy of <br> cedet-java.el and enable it.=C2=A0 It might need changes based on the chang= es <br> to eieio.=C2=A0 I don't really know why it was left out of emacs.<br> <br> If you get it working, I'd recommend sending it along to emacs <br> maintainers so it can be included.<br> <br> Eric<br> </blockquote></div> --0000000000001fde1f05952cc322-- --===============6594124744125150928== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============6594124744125150928== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ cedet-semantic mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cedet-semantic --===============6594124744125150928==--