This release contains a number of features and bug fixes that have been worked on over the last few months. You will need to restart Sublime Text for all changes to take effect
Humanize
to make go test
and go re/play
(in test mdoe) output more readable (using https://github.com/dustin/go-humanize).
ctrl/cmd+.
,ctrl/cmd+.c
) named Go Generate
that calls go generate
in the closest go package (current dir or parent dirs).
It can be enabled with:
&golang.GoGenerate{
Args: []string{"-v", "-x"},
},
.s
files using https://github.com/klauspost/asmfmt
It formats .s
files when they are saved, or the fmt cord ctrl+.
,ctrl.f
is pressed.
Langs
field:
&web.Prettier{
// Langs: []mg.Lang{mg.JS}, // only fmt .js files
Langs: web.PrettierDefaultLangs,
},
You might also need to import "margo.sh/web"
.
You will need to install prettier separately.
go.play
and go.replay
(cord ctrl/cmd+.
,ctrl/cmd+r
) now works in in unsaved _test.go
files.go.replay
now runs the Benchmark* func surrounding the cursor.
Compared to ctrl/cmd+shift+left-click
, it also runs tests.
Known bugs:
Verbose
,
When cx.Verbose = true
the commands that are run are printed to the output prefixed with #
.
e.g. output:
replay
| done
# go test -test.run=. -test.bench=^BenchmarkPoke$
goos: linux
[...]
It's enabled for go.play
and go.replay
(cord ctrl/cmd+.
,ctrl/cmd+r
).
mg.Error
instead of being ignored.
This fixes some cases where the error palette shows errors, but the status and HUD doesn't.
This release fixes a couple bugs:
This release fixes a margo build failure when upgrading to go1.14.
This release focuses on fixing a performance issue due to a failure to resetting all cached data prematurely.
&nodejs.PackageScripts{}
reducer now uses yarn
instead of npm
if the yarn.lock
file is present.This release mainly focuses on under-the-hood improvements for module support.
Kim-Porter
, our solution for auto-completion and package/module going forward.
One side-effect of this change is that unimported-packages support is less reliable but we feel this is a small drawback when compared to the much improved auto-completion support.
We plan to remove support for switching import modes in the future, but if you would like to revert to the previous default (bearing in mind auto-completion might stop working), configure the MarGocodeCtl
reducer as follows:
&golang.MarGocodeCtl{
ImporterMode: golang.SrcImporterWithFallback,
}
go install
lint.
To enable add the following reducer to your margo.go
file:
&golang.TypeCheck{},
import "net/http"
.*mg.Ctx
instead of a mg.KVStore
.
&golang.TypeCheck{}
.
It's a linter that does a full type-check as you type (even in unsaved files).
It can be thought of as a replacement for the gotype
binary of old.
NOTE: This is purely an experiment used primarily for testing the package importer
and type-checking and will probably break randomly, if it works at all.
With that said, the plan is to clean it up and develop it further in the future.
‣
prefix to status items and reduce the space between them.mg.GoMod
and mg.GoSum
for go.mod
and go.sum
files, respectively.
For convenience, goutil.Langs
now holds the list of all Go-related langs
and Go linters are now available in go.mod
and go.sum
.
Tasks ➊➋➌
.
The status animates between Tasks ➊➋➌
and Tasks ➀➁➂
while there are tasks less than 16s old.
Error ➊ꞏ🄋
.
NOTE: The meanings of the numbers have been reverted.
Previously, given 1/2 Errors
, there was 1 issue with tag Error
in this view, and there was a total 2 errors in all views.
The new meanings Error ➊ꞏ🄋
is: ➊ is the number issues in the current view and 🄋 is the number issues in other views.
Only first number is highlighted if there are issues in the current view.
Likewise, when there are issues, but none in the current view, only the second number is highlighted.
func
prefix in the calltip status. The parens already make it obviously a function.This release introduces the HUD and comes with many improvements to snippets and a tweaked version of the Mariana color schemed named Ariana.
Issues
status, including the error messages for the current line.GocodeCalltips
status, including positional highlighting of params and return statement.
It's bound to the keys ctrl+.
,ctrl+0
.
You can manually bind it to another key. e.g. via Preferences > Key Bindings
:
{
"keys": ["ctrl+0"],
"command": "margo_show_hud",
},
name = |
suggests:
name = append(name, ...)
slice = append(slice[:len(slice):len(slice)], ...)
defer func() {}()
defer f()
return
mu.|
suggests:
mu.Lock(); defer mu.Unlock(); |
mu.Lock(); |; mu.Unlock()
package main; func main() { | }
(Add)UnimportedPackages
feature no longer adds circular importspkg-list
for unimported-packages
and show the directory where the package isCursorNode
and ParseCursorNode
were removedCursorCtx.Ctx
is no longer embeddedUnimportedPackages
support for stdlib packages in go1.10 and earlier versions.mg.Reducer.Reducer*
to mg.Reducer.R*
.
Most users should be unaffected.
If you've called any of these methods directly,
you will need to rename the following method calls:
&golang.GoCode{}
and &golang.GocodeCalltips{}
reducers are now ignored.
&golang.MarGocodeCtl{}
&golang.MarGocodeCtl{}
(below).
json.
will now try to import encoding/json
NoUnimportedPackages
(below) to disable this.
NoPreloading
(below) to disable this.
unimported
packages to the file.
AddUnimportedPackages
(below) to enabled this&golang.MarGocodeCtl{}
reducer
&golang.MarGocodeCtl{
// whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
// gs: this replaces the `autocomplete_tests` setting
ProposeTests: false,
// Don't try to automatically import packages when auto-compeltion fails
// e.g. when `json.` is typed, if auto-complete fails
// "encoding/json" is imported and auto-complete attempted on that package instead
// See AddUnimportedPackages
NoUnimportedPackages: false,
// If a package was imported internally for use in auto-completion,
// insert it in the source code
// See NoUnimportedPackages
// e.g. after `json.` is typed, `import "encoding/json"` added to the code
AddUnimportedPackages: false,
// Don't preload packages to speed up auto-completion, etc.
NoPreloading: false,
// Don't suggest builtin types and functions
// gs: this replaces the `autocomplete_builtins` setting
NoBuiltins: false,
},
mg.JSX
, mg.TS
, mg.TSX
and rename R
to Rlang
LangIs()
and ActionIs()
ctrl+.
,ctrl+g
or ctrl+shift + left/right-click
on the function declaration's namemg.ExecRunFunc()
was replaced with the pattern CmdCtx.WithCmd().Run()
the former bypasses builtins so running go install
has no linting support
*
is selected for the initial method definition_
Source: true
mode, CGO packages often failedSource: false
mode, you had to make sure the package was installed
and up-to-date
Source: bool
fields are now ignored.
To restore the old behaviour, use the golang.MarGocodeCtl reducer:
&golang.MarGocodeCtl{
ImporterMode: golang.SrcImporterOnly,
// or
ImporterMode: golang.BinImporterOnly,
}
cache-list-by-key
and cache-list-by-dur
with cache-list
see margocodectl cache-list --help
exit 2
error message
abc.X
proposes abc.XYX123
motd.sync
available via the UserCmd palette as Sync MOTD
Interval
can be set in order to enable automatic update fetching.
When new updates are found, it displays the message in the status bar
e.g. ★ margo.sh/cl/18.09.14 ★
a url where you see the upcoming changes before updating
It sends the following data to the url https://api.margo.sh/motd.json:
?client=gosublime
this tells us which editor plugin's changelog to check
?tag=r18.09.14-1
this allows us to determine if there any updates
?firstHit=1
this allows us to get an estimated count of active users without storing
any personally identifiable data
No other data is sent. For more info contact privacy at kuroku.io
To enabled it, add the following reducer:
&mg.MOTD{
// Interval, if set, specifies how often to automatically fetch messages from Endpoint
// Interval: 3600e9, // automatically fetch updates every hour
},
You will need to restart Sublime Text.
Unless you uncomment/set Interval
, you will need to manually check for updates
using the Sync MOTD
command from the usercmd palette
ctrl+.
,ctrl+c
/ super+.
,super+c
GoSublime: Go
syntax was switched to a new syntax based on the Go syntax shipped in Sublime Text
Menu > View > Syntax > Open all with current extension as... > GoSublime > GoSublime: Go (Deprecated)
please not that this version is buggy and will not receive any fixes
Source: true
-tags "js wasm"
if syscall/js
is imported in the package
ctrl+.
,ctrl+t
/ cmd+.
,cmd+t
keybinding to the new &golang.TestCmds{} reducer:
&golang.TestCmds{
// additional args to add to the command when running tests and examples
TestArgs: []string{},
// additional args to add to the command when running benchmarks
BenchArgs: []string{"-benchmem"},
},
Source: true
option without slowdowns.go modules
should now have completion with Source: true
Source: true
uses a lot more memory (see below for details about cache pruning)Source: true
, they will share the cache (less memory use)
&golang.MarGocodeCtl{}
this allows manual cache management using the new margocodectl
command
margocodectl cache-prune
run margocodectl
for info about how to use the command
^(MARGO|GO|CGO)\w+
into the GoSublime environment
this ensures new env vars like GOPROXY
and GO111MODULE
work correctly
GO111MODULE
leaking into the agent build processmg.UserCmd{
Title: "GoRename",
Name: "gorename",
Args: []string{"-offset={{.View.Filename}}:#{{.View.Pos}}", "-to={{index .Prompts 0}}"},
Prompts: []string{"New Name"},
}
Source
option to use source code for gocode completions
this will most likely be very slow
&golang.Gocode{ Source: true }
&golang.GocodeCalltips{ Source: true }
go
command integration by default&golang.GoCmd{}
go
: Wrapper around the go command, adding linter supportgo.play
: Automatically build and run go commands or run go test for packages
with support for linting and unsaved files
go.replay
: Wrapper around go.play limited to a single instance
by default this command is bound to ctrl+.,ctrl+r
or cmd+.,cmd+r
UserCmds (ctrl+.,ctrl+c
/ cmd+.,cmd+c
) are also added for Go Play
and Go RePlay