Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(701)

Issue 6445043: code review 6445043: misc/vim: fix :Import insertion heuristic. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 10 months ago by dsymonds
Modified:
12 years, 9 months ago
Reviewers:
CC:
golang-dev, minux1, fss
Visibility:
Public.

Description

misc/vim: fix :Import insertion heuristic. If a factored import group has a blank line, assume it is dividing separate groups of imports (e.g. standard library vs. site-specific). import ( "bytes" "io" "mycorp/package" ) The most common case is inserting new standard library imports, which are usually (stylistically) the first group, so we should drop "net" in the above example immediately after "io". Since this logic is getting non-trivial, add a test.

Patch Set 1 #

Patch Set 2 : diff -r a0aa11b6c6cb https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r a0aa11b6c6cb https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r a0aa11b6c6cb https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 5 : diff -r a39aacb5077d https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -2 lines) Patch
M misc/vim/ftplugin/go/import.vim View 1 2 3 4 chunks +32 lines, -2 lines 0 comments Download
A misc/vim/ftplugin/go/test.sh View 1 2 3 4 1 chunk +61 lines, -0 lines 0 comments Download

Messages

Total messages: 8
dsymonds
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 10 months ago (2012-07-25 03:36:52 UTC) #1
dsymonds
Any Vim users want to sanity check this?
12 years, 10 months ago (2012-07-28 11:17:45 UTC) #2
minux1
could we change the heuristic to take package prefix into account? Unable to correctly :Import ...
12 years, 10 months ago (2012-07-28 16:20:17 UTC) #3
fss
On 2012/07/28 11:17:45, dsymonds wrote: > Any Vim users want to sanity check this? It ...
12 years, 10 months ago (2012-07-28 16:21:52 UTC) #4
dsymonds
PTAL It's more complicated now, but site prefixes are now handled correctly. There's also a ...
12 years, 9 months ago (2012-07-29 05:02:27 UTC) #5
minux1
LGTM. i played with test.sh for some time, added a third import group and a ...
12 years, 9 months ago (2012-07-29 05:19:48 UTC) #6
fss
On 2012/07/29 05:02:27, dsymonds wrote: > PTAL > > It's more complicated now, but site ...
12 years, 9 months ago (2012-07-29 14:58:18 UTC) #7
dsymonds
12 years, 9 months ago (2012-07-29 22:48:58 UTC) #8
*** Submitted as http://code.google.com/p/go/source/detail?r=9bf2225c38eb ***

misc/vim: fix :Import insertion heuristic.

If a factored import group has a blank line, assume it is dividing
separate groups of imports (e.g. standard library vs. site-specific).
        import (
                "bytes"
                "io"

                "mycorp/package"
        )

The most common case is inserting new standard library imports,
which are usually (stylistically) the first group, so we should drop
"net" in the above example immediately after "io".

Since this logic is getting non-trivial, add a test.

R=golang-dev, minux.ma, franciscossouza
CC=golang-dev
http://codereview.appspot.com/6445043

http://codereview.appspot.com/6445043/diff/8001/misc/vim/ftplugin/go/test.sh
File misc/vim/ftplugin/go/test.sh (right):

http://codereview.appspot.com/6445043/diff/8001/misc/vim/ftplugin/go/test.sh#...
misc/vim/ftplugin/go/test.sh:3: # Copyright 2011 The Go Authors. All rights
reserved.
On 2012/07/29 05:19:48, minux wrote:
> s/2011/2012/ ?

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b