Code Monkey home page Code Monkey logo

gosublime's People

Contributors

aleksi avatar andyone avatar avinassh avatar cee-dub avatar dave avatar defeated avatar dersebi avatar disposaboy avatar guillermooo avatar hickford avatar igm avatar kortschak avatar logrusorgru avatar lucretiel avatar monkeywithacupcake avatar nathany avatar olliebennett avatar ryboe avatar samuel avatar slene avatar teejae avatar tux21b avatar xstrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gosublime's Issues

It can't create new project if no other projects is opened right now

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?

MarGo - margo.py RuntimeError

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.

go build

The "Go build.sublime-build.example" doesn't seem to work.

Environment

OSX 10.7.3
go version weekly.2012-02-22 +96bd78e7d35e
Sublime Text 2 Build 2180

Steps

  1. cp ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/GoSublime/examples/Go\ build.sublime-build.example ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/GoSublime/Go\ build.sublime-build
  2. open go file in GOPATH
  3. cmd-B

[Errno 2] No such file or directory
[Finished]

Notes

  1. go build from terminal.app properly builds the file
  2. application path is set via: launchctl setenv PATH $PATH

GsFmt error

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.

Feature Request: Open GoDoc

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.

glint thread calls methods on the glint object

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)

GsLint and Go project with multiple files

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.

auto import

would be nice to have auto-import of packages if completion fails

  • prompt the first time
  • allow to automatically drop unused imports
  • then perhaps automatically re-insert if required

GsFmt says source has errors

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!

Completion snippets interfere with normal editing

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.

ST2 frozen by latest gosublime

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.

if there is no import statement, code completion won't work

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.

No such file or directory

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?

Inter-line alignment should be with spaces, not tabs.

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.

false-positives between cross platform files

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

Env vars not working

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.

code outline

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?

can we have "goto definition"?

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 incomplete

example config is not properly documented(it's documented in USAGE.md only)
and some code mentioned in USAGE.md are missing

SublimeText lock up when selecting text on OS X

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.

imports rewriting is incomplete

  • adding an import introduces extra newlines
  • deleting an imported package leaves a blank space
  • we must not modify any import blocks that contains import "C"
  • if there are no suitable import blocks present, add one

Deps should use their own thread

  • starting margo and gocode should use their own thread to prevent blocking the ui thread
  • margo.post should be more pessimistic and not try to start margo

Annoying temp file!

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 is outdated

the demo only demonstrates the main functionality on the first release and none of the improvements since then

gslint doesn't track unsaved buffers

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...

GsLint doesn't show up

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).

Disabling gofmt?

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?

Is anyone else missing run_gofmt_on_save?

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.

gofmt - did not work now?

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?

GoSublime has issues with environmental variables

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

whither lint?

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

MarGo & Gocode

An issue to track the dependency and integration of MarGo and Gocode in GS

  • Why the update prompt keeps appearing when you restart ST2: It's designed to remind you to update gocode and MarGo. Most of the GS functionality is being pushed into MarGo (think gofmt, lint, doc, package imports, etc.). If MarGo has a breaking change and you update GS it will very likely have broken functionality until you update. It only appears if the CHANGELOG version string is different. In the future, instructions to install via git directly, It behaves slightly odd currently if you install manually because your settings don't contain a changelog version. Just choose the option to update and it will handle the rest. If it still appears after that then something probably went wrong so please file a bug report, including any errors in the console (ctrl+` (baktick) or ctrl+' (single quote)) and we can try to get to the bottom of it.

gslint does not work with google app engine

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.

Can't handle unicode

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

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:

  • exclude the tab markers from the snippets
  • don't emit the parameter definitions in the source - possibly extract the status message reporter from gslint and make it more general then we can have the function definition in the status bar along with the function return type

Issues with gotype

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() is no longer thread-safe

runcmd() now calls env() which accesses sublime_text objects directly - when called in another thead (gslint) we get access cross-thread errors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.