-
Notifications
You must be signed in to change notification settings - Fork 65
Conversation
Including because they're supported by both gofmt and goimports.
At one point that didn't work for me, but now, as if by magic, it does!
Cool, I'm 👍 on merging this and nuking #3. I've been using this every day and it's been stable. I did notice that this branch defaults the format on save to true, though there was some internal discussion about whether it should be on or off by default. Personally, I'm OK with it on by default, but will defer to the Atom team for that. @kevinsawicki any thoughts on that? |
The rationale for enabling format on save by default:
|
|
||
handleBufferEvents: (editor) -> | ||
buffer = editor.getBuffer() | ||
@subscribe buffer, 'saved', => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer.on 'saved', =>
and you can get rid of {Subscriber} = require 'emissary'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but then there's on unsubscribe...not sure if required...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Atom folks told me this ensures proper clean up of things, I'll check with them again as I'm not entirely clear on the distinction and what the preferred way is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 560e30b - it's not required.
🚢 |
- Future Enhancement: Highlight errors using information in stdout
@kevinsawicki @rubyist All done with changes on this feature branch. OK to merge? |
👍 from me, I'll defer to atom team to do the actual merging |
👍, this branch is working great for me. |
👍 using this branch @ Go bootcamp. Works great! |
- Shamelessly borrowed approach and code from [atom-jshint](https://github.com/Joezo/atom-jshint)
Awww yissss. Thanks for doing that, it's the one thing I've been really missing over my emacs setup. 👍! |
I did some digging this morning, because @rubyist's commit (68c94b6) addressed touched on an issue I was intermittently experiencing also. I suspect that providing the current environment to packages is something the Atom team is trying to address / undoing / trying to address (which may explain why – "as if by magic" – things started working, and then broke again). As of For reference, the Pandoc package is experiencing similar issues:
I can confirm that I can reliably make things work with just
Launching Atom via
Based on this, it may be more sensible to specify |
@joefitzgerald I just tested this PR using goimports and I don't see a warning due to compilation errors. Here is the code snippet I use: package main
import "fmt"
func main() {
fmt.Println("test")
42
} if I remove the fmt import statement, it gets re-added on save (as expected) but I don't see any errors related to the syntax error. Note that I set the path manually (absolute path). |
Note: |
hmm that's correct, I have vim setup to check for syntax errors every save, I really can't live without this feature, I'll check how vim does that and will get back to you. |
Ultimately, if you have a |
vim is likely using gocode, a third party package. On Monday, March 10, 2014, Matt Aimonetti notifications@github.com wrote:
|
so after further investigation, I'm getting the syntax errors from syntastic https://github.com/scrooloose/syntastic which has support for go using the following files: From what I can see, it is using go build/test: It also seem to support golint https://github.com/golang/lint I don't think that syntax verification should be blocking this merge, but I think that atom should should have a way to (maybe optionally) check that your code's syntax is correct. |
I think there is a general desire (and I personally share this) to also integrate gocode (see #2) and potentially other tools to round out the feature set here. I use GoSublime; others use vim and emacs. But I think we want the same set of features. This PR solely addresses I've already created an issue in the autocomplete package repo to request additional extensibility features, in advance of Your suggestion to leverage tools to highlight compile errors is a good one and we should create a new issue for it. It raises questions about $GOROOT, $GOPATH, and package root which could increase the complexity of integration. |
I agree, but I also think that adding support for go build on save should Dealing with $GOPATH might be interesting if we try to cover edge cases or On Sun, Mar 9, 2014 at 7:34 PM, Joe Fitzgerald notifications@github.comwrote:
|
@probablycorey Notification that this refers to an issue you created against Atom. |
Hmm... @rubyist any way to get attention on this? Would love to get this merged or critiqued and then build upon it. |
return if not matchLine? | ||
error = [matchLine[2], matchLine[3], matchLine[4]] | ||
errors.push error | ||
loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why using a loop here? I had a hard time understanding the logic flow between the loop, the extraction, error pushing and patching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular expression evaluation (pattern.exec(data)
) must be repeated until there are no more matches in order to collect all matches for a multi-line body of text. The loop continues until there are no more matches (we have reached the end of the error text).
@@ -1,7 +1,8 @@ | |||
{ | |||
"name": "language-go", | |||
"description": "Go language support in Atom", | |||
"version": "0.7.0", | |||
"version": "0.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the package maintainer policy is, but usually, PRs shouldn't include version upgrades so the author can choose when the version change takes place.
@kevinsawicki Happy to make changes or act on any feedback you have about this PR. |
Folks, given the answer in #2 (comment), I'm going to close this, and pick up work in https://github.com/joefitzgerald/go-plus. I am open to renaming the package - just throwing something out there so we can rally around it.
I invite @mattetti, @rubyist, @rosshale, @darkhelmet, @apires, @drnic and others to collaborate with me there to add |
hmm I think there is a compromise to be found, I'm afraid that with only "syntax highlighting, snippets, and language properties such as folding and indent patterns" the default go package isn't very useful. Due to the compiled nature of the language, I feel that a compilation/syntax check + reformatting of the code as per gofmt standards is really needed. Anything else, including godef, gocode etc.. should indeed live in another package. My understanding from @kevinsawicki's comment wasn't that he didn't want to add extra features, but to keep it as minimal as possible. @kevinsawicki can you maybe explain what you had you mind or what you'd prefer us to do? |
This is now published as package |
This PR picks up where #3 left off by removing the snippets, and then ensuring goimports will work as a substitute for
gofmt
.goimports
gofmt
orgoimports
gofmt
errors, highlighting the line number(s) of the error(s)