KDevelop Go Plugin
Milian Wolff
mail at milianw.de
Sun Aug 10 12:55:42 UTC 2014
On Sunday 10 August 2014 12:01:24 Pavel Petrushkov wrote:
> Hello KDev developers!
Hello,
this sounds awesome!
> For the past few weeks I've been working on Go language support for
> KDevelop and I think it is time I share my work with everyone. So, here -
> https://github.com/OneHundRedOf/kdev-go is all that I have right now. I
> have written a parser with KDevelop-PG-Qt, simple Declaration and Uses
> Builders which currently support only part of all language features and
> basic code completion support. Of course it's a long way to go to be
> complete, but I've covered the basics like variable and function
> declarations, type deduction with ExpressionVisitor and type members,
> methods and imports code completion. Testing plugin with Go standart
> library shows that it 'mostly works' right now and even can be useful
> sometimes.
Did you hear about the KTextEditor based Go code completion plugin:
https://bitbucket.org/lucashnegri/kgocode
Generally, while I appreciate the work you did, our experience is that it is a
tremendous amount of work to write, _and maintain_ a proper language plugin.
The more you can use other libraries to do the work for you, the better. Esp.
if you have to write the parser yourself, this will break sooner or later.
Because of this reason, we are now working on a clang-based plugin for our C++
language support. Is there really no Go library available that gives you at
least the AST or something like that? Better yet, something like Clang gives
you with types etc. already resolved.
If not, then at least using gcode for code completion (or well, the plugin
mentioned above) would be good instead of reinventing the wheel there.
> I was wondering if someone here would like to review my code and give me
> some feedback. I'm not an experienced KDE or KDevelop developer so any
> constructive criticism and suggestions are welcome. Maybe somebody would
> even join me in developing this plugin. Also if you think my code is ok,
> maybe we should open a project on projects.kde.org? I have no idea about
> the quality of accepted projects though, so that's for you to decide.
I only had a very quick look at it, but over all it looks quite nice already.
Quite a feat, considering the complexity of our language support API (which is
sub-par, esp. on the documentation side ;-)). Your project is more than
welcome on projects.kde.org, the first step would be to get a developer
account (you can put me in as a reference), then we can import the project to
playground.
> Currently most important issues with my plugin are lack of tests and
> documentation, but I will start working on that soon. Also I guess I will
> need frameworks port, I'm hoping to get some help here on that.
Tests are crucial for a language support plugin. Really, I can't stress this
enough. Esp. if you are writing it from scratch with parser and everything,
you'll have to write tons of tests to ensure you are not breaking something
further down the road. You'll save yourself a huge amount of pain and time if
you develop a language support in a tests-driven style. I.e. whenever you
notice something is not working, write a test for it, then make it pass.
> A little bit more info about the plugin is available on github page, if you
> want to try it out, don't forget to set $GOPATH environment variable for
> your project.
Whats the GOPATH env var required for? Include paths or something like that?
You could hook in to the IncludesAndDefinesManager in kdevelop and let the
user define that from inside the UI.
Again, really nice to see this. And congrats to this achievement. If you have
any questions don't hesitate to ask on this list.
Bye
--
Milian Wolff
mail at milianw.de
http://milianw.de
More information about the KDevelop-devel
mailing list