note: this software is not finished and is under active development
Go-sea provides tree-sitter enhanced editing and refactoring capabilities in Emacs, heavily utilizing tree-sitter. The goal for this project is to provide every feature a full-fledged IDE such as GoLand would provide. It is intended that you would use go-sea in addition to a language server. The language server would provide the core functions of what would be expected from an IDE while go-sea provides extra refactorings. If you have any ideas, definitely make a feature request. I'd love to hear them.
- Generate table test based on functions parameters and results.
- Move a function to another package, updating old references to use the updated package.
- Auto-implement interfaces for a type.
- Add a return parameter, adding the zero value for it to all returns
- Remove a return parameter, removing it from each return
- Apply De Morgans law to a boolean expression (ex. !A && B -> !(A || !B))
- Swap var and short var definitions
- Negate the if-else statement, swapping their bodies.
- Generate an else clause for the if statement
- Quickly jump to places
Move a definition to another package, updating references.
Insert an "if error != nil, return the error" case, using the zero value of the function.
Switch between using ":=" and "var" to define a variable.
Add a return type for the current function, updating all nested return statements.
Remove the last return item, updating all return statements.
Toggle the returning of a functions error.
Flip the if statement, inverting the condition and swapping blocks.
Add else if clause.
Add implementation stubs for interface.
Toggle between forms !(A || B)
and (!A && !B)
or !(A && B)
and (!A || !B)
.
Generate a unit test based off of the current functions signature.
Jump to functions return type.
Find and jump to a functions unit test.
Fold code at line. If go-sea-fold-abbrev
is non-nil, the text on the
fold will show a symbol for each line of code: ?
if statement, =
assignment statement, ○
call expression, ↺
for statement, ↩
return statement, v
var declaration, and ┆
switch statement.
Fold entire buffer to specific level.
This project is very much a work in progress and expect rough edges.
I don't plan on uploading it to MELPA or ELPA until all these rough
edges are ironed out and I have tested it personally thoroughly. That
being said, if you want to try it out you can install it from source,
adding the this repository to you load path and running (require 'go-sea)
.
You need to have a version of Emacs that supports tree-sitter (29) as well as
ag
or rg
installed. If you are using rg
you should set the value
of go-sea-search-engine
to 'rg
.
Also there are no default keybinding so you will need to add these yourself.
I plan on providing much more detailed documentation with examples before release.
- Generate types from JSON
- More small code refactorings
- Parse special document comments (like links)
- Introduce constant
- Advanced code searching