Showing posts with label intellij-idea. Show all posts
Showing posts with label intellij-idea. Show all posts

2016-11-17

Best Golang IDE: IntelliJ and VSCode

I've been using IntelliJ + go-lang-idea-plugin for years now (because it's currently the best one for almost everything: Ruby, PHP, Python, Javascript, SQL, you name it..), previously it's ok to use SublimeText + GoSublime, or LiteIDE, but today we got another completely working alternative that is also purely free (like IntelliJ Community): VisualStudioCode + lukehoban.Go. Here's how to install in ArchLinux:

yaourt --needed --noconfirm -S --force visual-studio-code 
go get -u -v github.com/nsf/gocode      
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
code

Then press Ctrl+Shift+P, type "Install Extension", type: "Go", done :3

Everything's works fine now:

In my opinion, IntelliJ still the best, but surely I'll be using VSCode when my IntellJ license ends.

2015-02-24

How to make IntelliJ IDEA load faster

IntelliJ IDEA is one of the best IDE around, but the default configuration isn't that good. The initial loading of this software took about 5-15 minutes because of the initial configuration of JVM. There are some workaround to make it work faster, just go to your IDEA installation directory, bin directory, and look for idea.vmoptions (or idea64.vmoptions), change the content of that file into something like this:

-server
-Xms512m
-Xmx8192m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=512m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-Dawt.useSystemAAFontSettings=lcd

The Xmx sets the maximum memory that could be used by JVM, if you have a huge amount of RAM (4 GB+) you may change it at least half and at most three quarter of your RAM. After changing that configuration, close the IDEA and start it again IDEA now should load faster (in my PC it took about 10 seconds to start loading the project and 20 seconds more to complete loading the project).


2015-02-03

How to build latest Go IDEA Plugin

As we already know, IntelliJ IDEA has the best Javascript and almost any other language auto-complete support, including database client and many useful linters and development tools. This tutorial intended to make IntelliJ as Go IDE, since last time I tried, the plugin (v0.9.6) is buggy and not good enough for daily use. First of all, the last plugin release (1.0.0-alpha11) is outdated, there's many bug that has been fixed after then. To build the latest package, use this command (or see first comment below for shorter command):

git clone --depth 1 git@github.com:go-lang-plugin-org/go-lang-idea-plugin.git
cd go-lang-idea-plugin
git checkout -b v1.0.0-alpha0
git branch --set-upstream-to=origin/v1.0.0-alpha0 v1.0.0-alpha0
git reset --hard origin/v1.0.0-alpha0
git pull
ln -s $YOUR_INSTALLED_IDEA_PATH idea-IC

alternatively, you can clone certain branch directly:

git clone -b v1.0.0-alpha0 https://github.com/go-lang-plugin-org/go-lang-idea-plugin.git
ln -s $YOUR_INSTALLED_IDEA_PATH idea-IC

Then open the directory using IntelliJ, open the File > Project Structure...


Make sure it has been configured as described in this link (rename the idea-IC SDK to IDEA sdk, assign that SDK to each module and project, install correct GrammarKit and ant plugin), when done, choose Build > Build Artifacts... > Go.zip to build the latest release on the bin/directory. Just install the zip file normally in plugins setting dialog. One more thing, to make this plugin works correctly, enter your $GOPATH value into Global Libraries and Project Libraries on Settings > Languages and Frameworks > Go Libraries. Voila! now your IDEA support Go programming language ^_^;


Or if building manually is taking too much of your time, you could download Go.zip file from this directory.

2014-11-26

How to install Goclipse and Golang IDEA plugin

Warning: current master version of these plugins (2014-11-25) are not good enough for daily coding, don't bother to try them for now.
Edit: latest alpha version of Golang IDEA plugin for IntelliJ are the best plugin for now.

Goclipse is another IDE for golang, that based on the infamous Eclipse platform. To install Eclipse, just type:

pacman -S eclipse

To install Goclipse, you must first clone the repository, for example using this command:

git clone --depth 1 https://github.com/GoClipse/goclipse.git

Then you must download all dependencies and start building:

cd goclipse
mvn clean integration-test
ant -f releng/ CreateProjectSite
ant -f releng/ PublishProjectSite

Last command would fail when not supplied with correct DprojectSiteGitURL parameter, but the required jars still resides in bin-maven/projectSite/, just use any webserver to serve the files as Eclipse update site, for example using php:

cd bin-maven/projectSite/
php -S localhost:9009

To install Goclipse, open Eclipse, Help > Install New Software..,  just add http://localhost:9009/releases

Then select Goclipse, next, accept the license, and finish.

Now the bad parts: bad coloring (for example, the operator color is not configurable), gocode doesn't work (even when GOPATH and GOROOT already configured on settings page and restarted), and autocomplete doesn't work at all.

Next we'll try IntelliJ with Golang IDEA plugin, first you must clone the repository:

git clone --depth 1 https://github.com/go-lang-plugin-org/go-lang-idea-plugin.git

Then place (or symlink) the IntelliJ program directory inside that folder that created by git, with name idea-IC, then just run:

ant -f build-package.xml

That command would produce a file named: google-go-language.jar, just install that plugin normally using on IntelliJ.

Now the bad parts: member autocomplete doesn't work at all (even when GOROOT and GOPATH configured on settings page and restarted).