disposaboy / gosublime Goto Github PK
View Code? Open in Web Editor NEWA Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
License: MIT License
A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
License: MIT License
Description in subject. I just downloaded and unpacked sublime text 2 for 64 linux and installed gocode, MarGo, GoBuild and SublimeGo package for sublime text. I run "Create Go Project" from Project menu and every time see message "There is no opened project to convert. Please save your project first". But I don't have any project. What should I save?
gslint doesn't always run when a view is activated - so when you fix a missing definition in another file and switch back the error persists until you edit something
Hi! I am running OSX 10.7.3 with Go 1.0.1 from Homebrew and Sublime Text 2 Build 2181 and I'am getting this error when starting SB2 with fresh installed GoSublime (just modified env with PATH in GoSublime User Settings to be MarGo and gocode in PATH).
** GoSublime: Traceback (most recent call last):
File "./margo.py", line 44, in post
File "./gscommon.py", line 86, in setting
File "./gscommon.py", line 83, in settings_obj
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)
**
Some days early everything was quite normal and I even show lint messages in code, with corrections and suggestions about 'unsued package' and etc., you know it.
Any one ever made it work on Windows 7?
The "Go build.sublime-build.example" doesn't seem to work.
OSX 10.7.3
go version weekly.2012-02-22 +96bd78e7d35e
Sublime Text 2 Build 2180
[Errno 2] No such file or directory
[Finished]
Whenever I invoke GsFmt, I get the following error: GsFmt: Could not patch the buffer: Invalid range. I looked at gsfmt.py but can't figure out what's wrong. I'm on Windows. gofmt is in my path and works fine from the command line.
It might not be a bug, I just don't know where else I can ask. Sorry for the noise if it doesn't belong here.
Hi,
Would it be possible to add a command that would open godoc at package? Eg if I had 'fmt' written on the current line and I pressed ctrl-alt-g-d, it would open 'godoc fmt' in Sublime.
Or if I had 'fmt.Printf' written on the current line and pressed the command, it would open godoc fmt and then search for 'Printf'.
This'd be a huge help.
When I am scrolled to some line in my code and then save the file the editor position moved to line 0.
The functions and types which in the buildin not autocomplete. there's no tips. I should input all the function,such as append, len,panic, defer etc.
the glint thread should not call methods (directly) on the glint object as they may access the view, etc. which needs to be called from the main thread
Exception in thread Thread-134:
Traceback (most recent call last):
File ".\threading.py", line 532, in __bootstrap_inner
File ".\gslint.py", line 103, in run
File ".\gscommon.py", line 80, in notice
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)
implement settings to explicitly disable gocode, gslint, etc
The GsLint feature is nice, but spits out a lot of false positives when using multiple go files for one package.
An example:
file_a.go defines func do_something()
file_b.go uses do_something() from file_a.go
both are in package main
gotype file_a.go would be just fine.
gotype file_b.go whould spit out an undeclared name error.
gotype file_a.go file_b.go would be fine again.
A possible solution would be to extend a gotype run on all .go files of the same package in the sublime-project the current file is in. So for the example above run gotype on all .go files in package main.
would be nice to have auto-import of packages if completion fails
I recently switched my Go development to Windows and updated from a weekly from December to the latest, specifically gomingw 2012-02-07.
I really like the application go gofmt on my source when I save the file. However, I'm seeing an error in the bottom pane:
** GsFmt: File C:\Development\hello.go contains errors **
The source file contains no errors. I used the Hello World example to test this and I can compile cleanly with 6g/6l.
Looking in the python for GoSublime, it looks like gofmt.exe is being called with '-d' option. When I attempt to call gofmt on the same source code with -d, I am told that diff.exe is not in my path.
So anyway, I solved the problem by copying diff (and the necessary DLL) from my Git install to somewhere in my path. I suppose my only issues to report are 1) Git isn't a requirement for installing GoSublime and the installer for Windows doesn't recommend putting the Unix tools like diff into your Path, and 2) GsFmt's error message is misleading.
Anyway, problem solved, just wanted to let you know. Thanks so much for the great package!
somewhere along the line GsLint became gotype specific... so no longer supports anything else
When you use the snippets provided in the completion popup. If you fail to visit each marker (each parameter place holder, etc) then when pressing tab elsewhere, there is a tendency for the cursor to jump to the unvisited markers with no way to stop it until a modification occurs.
The latest update (22/04) caused ST2 a start failure, falling into freeze here, on OS X 10.6, so that I have to remove gosublime so far. This issue occurred after I fired a gosublime upgrading. BTW, I have gocode installed.
I have a cmd project, I have several struct define in other files, but in this file, I'm not importing any thing, I just use the struct directly, so there is no import statement. And the completion doesn't work.
If I add an empty import:
import ()
then the completion shows up.
Getting the following error when I attempt to use the plugin:
Error while running gocode: [Errno 2] No such file or directory
I followed your installation instructions to the letter. The only difference is that the packages directory is now found at ~/.config/sublime-text-2/Packages instead of the directory you specified. I am running Ubuntu 10.10.
Could it be that you are assuming the directory you specified before and that could be causing the error?
I guess since the update you're now using MarGo instead of gofmt. I'm not sure why, but fine, OK. Unfortunately it has incorrect behavior: if my original code looks like:
m := map[string]int {
"foo bar baz": 1,
"a": 2,
"beep": 3,
}
GoSublime now reformats on save by inserting tab characters between the :
and the integers, assuming an 8-character tabstop, I'm guessing as a function of this. These should be spaces.
It would be incredibly handy if there was a quick way to run go tests with gosublime.
helper command keybinding examples are missing contexts, it's checked in the commands instead, which makes them do more than they need to.
files intended for alternative OS's e.g pkg_windows.go and pkg_linux.go cause false-positive redeclaration errors because they're both files are passed for type-checking by gslint
I'm working with latest weekly release of Go, which needs the GOPATH var set to correctly find package paths and such. I put that var on my config file:
"env": {
"PATH": "/usr/local/go/bin:$PATH",
"GOPATH": "/Users/harad/golang"
},
But the gotype command when is called by GsLint shows errors just like if the GOPATH var were not defined.
On the shell, where GOPATH is the same, gotype works fine, throwing no errors:
Horchata:~ harad$ echo $GOPATH
/Users/harad/golang
Horchata:~ harad$ go tool gotype golang/src/clienet/main.go
Horchata:~ harad$
But when I unset GOPATH, I get some errors, just the same errors that show up on GsLint for that file:
Horchata:~ harad$ GOPATH=
Horchata:~ harad$ go tool gotype golang/src/clienet/main.go
golang/src/clienet/main.go:3:8: could not import clienet/services/prueba (can't find import: clienet/services/prueba)
golang/src/clienet/main.go:6:2: undeclared name: prueba
go tool gotype: exit status 2
Horchata:~ harad$
So the env
property in the config file doesn't seem to take effect.
ST2 Build 2181, GoSublime v2012.02.26.12.18.51, Mac OS X.
My dream: sublime text 2 with a code outline, similar to things you see in eclipse, etc.
Nothing fancy, just a list of all the top-level func, var, const declarations that i can scroll through.
Any idea how well this kind of thing would fit into the ST2 ecosystem? Is it possible?
GoSublime is good,I like it.and can we have the "goto defeinition" to jump to source code? I think it is a good function.
example config is not properly documented(it's documented in USAGE.md only)
and some code mentioned in USAGE.md are missing
When selecting Go source code and dragging the mouse into the file list, SublimeText begins using 100% cpu and goes unresponsive, requiring a force quit as demonstrated here:
http://cl.ly/071F3m3c170n303d2L1f
I have narrowed it down to this package. When removing this package the problem goes away. I am using the latest developer build of SublimeText (2169) and the latest checkout of GoSublime.
Thoughts? I'll be happy to give you any more information I can.
Why GoSublime keep generating "GoSublimetmp30~xxx.go" in the same directory of editing go package? If I keep sublime open, it will affect "go build" and "go test" command!
the demo only demonstrates the main functionality on the first release and none of the improvements since then
gslint only takes the current file into account so any other opened and unsaved files don't take effect until saved - gslint should pass all unsaved files...
Everything works fine except GsLint, which simply doesn't work, not marking the mistakes nor showing errors to the bottom bar. Here is my settings line:
"gslint_cmd": ["/usr/local/go/bin/gotype", "-p", "$pkg", "$files"],`
Which works in the shell:
Horchata:Desktop harad$ /usr/local/go/bin/gotype -p main prueba.go
prueba.go:6:14: expected operand, found 'import'
GsFmt, completion, build, etc. work fine. I'm using Sublime Text 2 build 2165 (the last one).
The Gocode daemon/server needs to be started before querying for completion otherwise it hangs...
find all references to a local variable. ctrl+d is not very nice as it's file-scoped
Sometimes I write sentences in comments, and if I have auto-dot-completion turned on (as I do) ending those sentences is somewhat problematic :)
When I save changes to a .go file, with GoSublime gofmt is applied to my code. I really have to keep my own formatting please... how can I disable this?
I've always enjoyed the gofmt_on_save functionality, but now it's gone. I am quite sloppy so I keep forgetting to run gofmt before saving the files on my own and I really don't like the idea of adding and remembering an additional key binding.
The Usage.md now reveals that there might be some rare cases which might corrupt the file. However, I've (luckily?) never encountered such a case and in my opinion it's save enough to trust gofmt (as long as it doesn't return any error). Also, if I do not like the change, there is still an undo command or even git reset (in the worst possible case).
So, what's about adding an additional "save" argument to the gs_fmt command which is false by default? It can be used to tell gs_fmt to save the file afterwards, so that it can be used as drop-in replacement for C-s. You can still leave the disclaimer in place.
I only noticed recently that gofmt
did not work when I saved a .go
file, on OS X; while on Windows, everything seems to be fine.
I've been used to let gofmt
format my .go
file on saving, then going on writing code... I've checked the configuration, and the "fmt_enabled": true
is expected to work, right? How can I get the formatting back?
I installed GoSublime on my 64bit Arch Linux box and it seems that it has issues with reading environmental variables to get the GOROOT and GOPATH as well as knowing where the go executable are stored. After filling in the details in the user configuration file for GoSublime it is aware of PATH and GOROOT but still has issues with GOPATH.
╭─vendion@Big-O ~
╰─➤ which go
/opt/go/bin/go
╭─vendion@Big-O ~
╰─➤ echo $PATH | grep go
.../opt/go/bin:/home/vendion/gocode/bin...
╭─vendion@Big-O ~
╰─➤ echo $GOROOT
/opt/go
╭─vendion@Big-O ~
╰─➤ echo $GOPATH
/home/vendion/gocode
Note: I trimmed the output from $PATH down to the relevant parts
With this set to go tools has no issues running, I also have no problems with vim with gocode and syntastic installed.
In my GoSublime.sublime-settings I have the following:
"env": { "PATH": "$PATH:/opt/go/bin:$HOME/gocode/bin", "GOROOT": "/opt/go", "GOPATH": "$HOME/gocode" },
When I use the GsShell to run the go build
command I get the following error:
Executing: go build .
Database.go:6:2: import "github.com/mattn/go-sqlite3": cannot find package
[Finished]
I have the package in question installed in my GOPATH
╭─vendion@Big-O ~
╰─➤ ls $GOPATH/pkg/linux_amd64/github.com/mattn
go-gtk go-sqlite3.a
and running the go build
tool from my terminal works
╭─vendion@Big-O ~GOPATH/src/github.com/vendion/Gonesis ‹develop›
╰─➤ ls
academy.go Database.go~ Gonesis.sublime-project options.go
academy.go~ doc.go Gonesis.sublime-workspace README.md
Contributors Gonesis.go LICENSE
Database.go Gonesis.go~ main_test.go
╭─vendion@Big-O ~GOPATH/src/github.com/vendion/Gonesis ‹develop›
╰─➤ go build .
╭─vendion@Big-O ~GOPATH/src/github.com/vendion/Gonesis ‹develop›
╰─➤ ls
academy.go Database.go~ Gonesis.go~ main_test.go
academy.go~ doc.go Gonesis.sublime-project options.go
Contributors Gonesis Gonesis.sublime-workspace README.md
Database.go Gonesis.go LICENSE
Hi. After some local debugging to figure out why I did not have lint any more and what happened to the linter, I saw that you removed it entirely recently, in c64e60d . Why? I realize it had issues, like the problems with interacting with building, but it was still really nice to have. I'm going to try reinstating that bit of the code locally and getting something to work, but meanwhile, what's the plan for linting?
Thanks for GoSublime!
Gary
An issue to track the dependency and integration of MarGo and Gocode in GS
made gocode work with app engine with $:"gocode set lib-path /home/hash/google_appengine/goroot/pkg/linux_386",
gslint sees this as error
import (
"appengine"
"appengine/user"
)
and autocompletion works.
It seems that this package only works when something is syntax highlighting the files. If I am off on this please let me know. Thanks.
Autocomplete won't work anywhere in this program...
package main
// U+03C0: π
func main() {
}
...because there is a non-ASCII character (pi) in it. This is legal go code (the spec indicates that source is UTF-8 encoded), but python can't handle it, I'm assuming because it's default encoding is ASCII.
completed function parameters include the parameter type in the source which can be a little annoying as you have to use the tab key in order highlight and overwrite them or do it manually which is a little tedious.
Perhaps:
Go 1 will use "go tool gotype" instead of gotype. http://weekly.golang.org/doc/go1.html#exp
The first problem is that GoSublime doesn't like spaces in the runcmd. Configured like this:
"gslint_cmd": ["/Volumes/Mercury/Users/nathany/Development/go/golang/bin/go tool gotype", "-p", "$pkg", "$files"]
Error while running /Volumes/Mercury/Users/nathany/Development/go/golang/bin/go tool gotype: [Errno 2] No such file or directory: None
So I made a shell script (gotype.sh) to run it, which gets past that issue:
#!/usr/local/bin/zsh
/Volumes/Mercury/Users/nathany/Development/go/golang/bin/go tool gotype $*
Gotype previously had problems with finding imports http://goo.gl/De5Wf
In the current weekly (go version weekly.2012-02-22) the command line works as it should. But I'm still having trouble finding the imports when using with GoSublime. If I echo $GOPATH from my shell script, it happens to be blank. So for whatever reason, the settings in my .zshrc are being ignored.
So for now I'm setting $GOPATH in my gotype.sh script, but this is all less than ideal.
runcmd() now calls env() which accesses sublime_text objects directly - when called in another thead (gslint) we get access cross-thread errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.