wndhydrnt / go-signature-statusbar Goto Github PK
View Code? Open in Web Editor NEWDisplay the signature of the current Go function under the cursor in the status bar of Atom
License: MIT License
Display the signature of the current Go function under the cursor in the status bar of Atom
License: MIT License
package main
import (
"fmt"
)
type test struct {
attr string
}
func main() {
fmt.Println(&test{
attr: "test",
})
}
I often have the following problem:
Variable names are not short enough and too many arguments are present in function signature.
Thus, I can only see some portion of it. It may be nice if I can adjust the width. I noticed your commit 17ff9e0 and changed package.json
to increase the width. After restarting Atom width increased but nevertheless some functions just don't fit there.
In fact, it would be great if a popup is shown since functions may have many arguments and status bar i not long enough to show it. However this repo's name is go-signature-statusbar so maybe it's not fit for this project :)
[Enter steps to reproduce:]
Atom: 1.19.4 x64
Electron: 1.6.9
OS: Mac OS X 10.12.6
Thrown From: go-signature-statusbar package 1.2.2
Uncaught TypeError: Cannot read property 'getLastCursor' of undefined
At /home/user/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:50
TypeError: Cannot read property 'getLastCursor' of undefined
at GoSignatureStatusbarView.displaySignature (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:50:26)
at invokeFunc (/packages/go-signature-statusbar/node_modules/lodash.debounce/index.js:160:19)
at trailingEdge (/packages/go-signature-statusbar/node_modules/lodash.debounce/index.js:207:14)
at timerExpired (/packages/go-signature-statusbar/node_modules/lodash.debounce/index.js:195:14)
-0:45.3.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-always)
-0:42.5.0 golang:update-tools (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
atom-beautify 0.30.5
atom-typescript 11.0.7
autoclose-html 0.23.0
busy-signal 1.4.3
code-peek 1.4.21
color-picker 2.2.5
color-tabs 0.1.8
color-tabs-regex 0.2.5
double-tag 0.9.0
environment 1.3.1
file-icons 2.1.11
go-debug 1.5.0
go-outline 0.6.6
go-plus 5.5.5
go-rename 0.3.0
go-signature-statusbar 1.2.2
haxe 0.8.14
highlight-selected 0.13.1
hyperclick 0.1.3
intentions 1.1.5
language-docker 1.1.8
language-glsl 2.0.1
language-gradle 0.0.3
language-haxe 0.6.0
language-nimrod 0.1.0
language-opencl 0.1.1
language-pony 0.3.8
language-powershell 4.0.0
language-restructuredtext 1.1.0
last-cursor-position 0.9.2
linter 2.2.0
linter-javac 1.9.4
linter-jshint 3.1.5
linter-ui-default 1.6.8
minimap 4.29.6
minimap-cursorline 0.2.0
minimap-pigments 0.2.2
pigments 0.40.2
sort-lines 0.15.0
symbol-gen 1.3.1
sync-settings 0.8.3
Is it possible to add type info for variables?
Argument to path.dirname
must be a string:
Object.dirname (/Applications/Atom.app/Contents/Resources/app.asar/src/electron-shims.js:9:10)
<unknown> (/Users/milk/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:108:37)
Also i've got another exception referencing to path.dirname
:
Object.dirname - /Applications/Atom.app/Contents/Resources/app.asar/src/electron-shims.js:9:10
GoSignatureStatusbarView.displaySignature - /Users/milk/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:99:38
<unknown> - /Users/milk/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:222:18
Function.module.exports.Emitter.simpleDispatch - /Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14
Emitter.emit - /Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28
TextEditor.cursorMoved - /Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2085:27
For example err := json.NewDecoder(r.Body).Decode(&request)
Given this line, the statusbar usually only shows the NewDecoder signature, not the Decode, even when the cursor is within Decode
.
The issue has to do with matches.reverse() causing issues with the later loop in lib/go-signature-statusbar-view.js
the trivial solution is to funcs.reverse()
prior to that loop.
If possible please add an option for setting default font size, this will be very useful.
[Enter steps to reproduce:]
Atom: 1.14.4 x64
Electron: 1.3.13
OS: Ubuntu 16.10
Thrown From: go-signature-statusbar package 1.2.0
Failed to activate the go-signature-statusbar package
At Cannot read property 'locator' of null
TypeError: Cannot read property 'locator' of null
at GoSignatureStatusbarView.displaySignature (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:82:18)
at GoSignatureStatusbarView.activate (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:26:12)
at Object.addStatusBarTile (/packages/go-signature-statusbar/lib/go-signature-statusbar.js:33:37)
at Object.consumeStatusBar (/packages/go-signature-statusbar/lib/go-signature-statusbar.js:45:10)
at Provider.module.exports.Provider.provide (/app.asar/node_modules/service-hub/lib/provider.js:29:52)
at ServiceHub.module.exports.ServiceHub.consume (/app.asar/node_modules/service-hub/lib/service-hub.js:50:18)
at Package.module.exports.Package.activateServices (/app.asar/src/package.js:404:75)
at Package.module.exports.Package.activateNow (/app.asar/src/package.js:221:16)
at /app.asar/src/package.js:922:28
at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
at /app.asar/src/package-manager.js:563:50
at Set.forEach (native)
at PackageManager.module.exports.PackageManager.activatePackage (/app.asar/src/package-manager.js:561:41)
at /app.asar/node_modules/settings-view/lib/package-manager.js:439:29
at exit (/app.asar/node_modules/settings-view/lib/package-manager.js:69:16)
at triggerExitCallback (/app.asar/src/buffered-process.js:303:11)
at /app.asar/src/buffered-process.js:324:11
at /app.asar/src/buffered-process.js:185:9)
at emitOne (events.js:101:20)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:493:12)
-8:33 core:move-right (input.hidden-input)
-8:32.6.0 core:move-up (input.hidden-input)
-8:32.4.0 core:move-right (input.hidden-input)
-8:32.2.0 core:move-down (input.hidden-input)
2x -8:31.7.0 core:move-left (input.hidden-input)
-8:29.6.0 core:move-up (input.hidden-input)
-8:29.5.0 core:move-right (input.hidden-input)
-8:29.2.0 core:move-down (input.hidden-input)
-8:29 core:move-left (input.hidden-input)
-7:29.3.0 golang:update-tools (atom-workspace.workspace.scrollbars-visible-always.use-animations.theme-atom-material-syntax-light.theme-atom-material-ui)
-2:39.6.0 core:move-right (input.hidden-input)
-2:39.3.0 core:select-all (input.hidden-input)
-2:39.1.0 core:move-right (input.hidden-input)
2x -2:38.8.0 core:save (input.hidden-input)
29x -2:25.8.0 window:decrease-font-size (span.)
-2:22.4.0 window:increase-font-size (span.)
atom-material-syntax-light 0.4.6
atom-material-ui 1.3.9
go-debug 1.1.0
go-plus 5.2.0
go-rename 0.3.0
go-signature-statusbar 1.2.0
hyperclick 0.0.40
linter 1.11.23
linter-golinter 1.2.1
Warmest greetings.
Is it possible to display current variable type as it occurs for functions?
Thanks.
Hi, I'm 'kinda' new to Atom and I've just installed go-plus which I believe installed go-signature-statusbar too. But I noticed that Atom became very slow while moving the cursor around, so I tried disabling packages one by one... then I found out that when I disable go-signature-statusbar, editing and cursor moving becomes responsive again.
Is there a reason that this package makes my Atom so slow while editing? Perhaps I'm doing something wrong? I'm using 1.17.2 on Windows 10.
Thanks
[Enter steps to reproduce:]
atom .
Atom: 1.19.0 x64
Electron: 1.6.9
OS: Mac OS X 10.12.5
Thrown From: go-signature-statusbar package 1.2.1
Uncaught TypeError: Cannot read property 'match' of undefined
At /Users/hayanoh/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:117
TypeError: Cannot read property 'match' of undefined
at GoSignatureStatusbarView.extractFunc (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:117:23)
at GoSignatureStatusbarView.displaySignature (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:49:21)
at GoSignatureStatusbarView.activate (/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:25:12)
at /packages/go-signature-statusbar/lib/go-signature-statusbar.js:30:39
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at Workspace.didChangeActivePaneItemOnPaneContainer (/Applications/Atom.app/Contents/Resources/app/src/workspace.js:493:28)
at WorkspaceCenter.paneContainer.onDidChangeActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-center.js:17:20)
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at PaneContainer.didChangeActiveItemOnPane (/Applications/Atom.app/Contents/Resources/app/src/pane-container.js:284:26)
at Pane.module.exports.Pane.setActiveItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:339:22)
at Pane.module.exports.Pane.activateItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:492:27)
at Immediate.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:702:30)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
busy-signal 1.4.3
go-debug 1.5.0
go-plus 5.5.5
go-signature-statusbar 1.2.1
hyperclick 0.1.3
intentions 1.1.5
linter 2.2.0
linter-ui-default 1.6.3
Hi, after a atom packages update some days ago i get this red exception popup a lot:
TypeError: Cannot read property 'locator' of null
at GoSignatureStatusbarView.displaySignature (/Users/mattias/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:82:18)
at /Users/mattias/.atom/packages/go-signature-statusbar/lib/go-signature-statusbar-view.js:195:14
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
at TextEditor.module.exports.TextEditor.cursorMoved (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2103:27)
at Selection.module.exports.Selection.markerDidChange (/Applications/Atom.app/Contents/Resources/app.asar/src/selection.js:921:21)
at /Applications/Atom.app/Contents/Resources/app.asar/src/selection.js:41:24
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
at DisplayMarker.module.exports.DisplayMarker.notifyObservers (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/display-marker.js:248:27)
at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/display-marker.js:53:26
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
at Marker.module.exports.Marker.emitChangeEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker.js:425:20)
at Marker.module.exports.Marker.update (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker.js:366:12)
at Marker.module.exports.Marker.setHeadPosition (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker.js:146:19)
at DisplayMarker.module.exports.DisplayMarker.setHeadBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/display-marker.js:146:32)
at DisplayMarker.module.exports.DisplayMarker.setHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/display-marker.js:154:19)
at /Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:67:31
at Cursor.module.exports.Cursor.changePosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:668:7)
at Cursor.module.exports.Cursor.setScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:65:19)
at /Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1874:23
at TextEditor.module.exports.TextEditor.moveCursors (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2097:9)
at TextEditor.module.exports.TextEditor.setCursorScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1873:19)
at TextEditorComponent.module.exports.TextEditorComponent.onMouseDown (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor-component.js:722:25)
at HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor-component.js:3:59)
When I check which version of go-plus that is installed in the packages list the version is "undefined".
Could it be some local config causing it?
First, I really like the plugin.
Have you looked at Guru instead if GoCode? With Guru I think your code would become a bit easier and you could also get more information. Please note that I have truncated file paths bellow to make examples easier to read in the issue.
Package: golang.org/x/tools/cmd/guru
Example on function:
guru describe main.go:#323
main.go:21.25-21.39: reference to method func (*github.com/gorilla/mux.Route).GetPathTemplate() (string, error)
github.com/gorilla/mux/route.go:549:17: defined here
Example on variable (definition):
main.go:21.2-21.9: definition of var template string
Example on variable (same as above but when used)
main.go:25.31-25.38: reference to var template string
main.go:21:2: defined here
Example of constant:
main.go:27.42-27.44: reference to const url untyped string of constant value "http://example.com"
main.go:12:7: defined here
With this type of information there are two benefits:
1 . Support is extended to show type information on variables and constants, and not just function signature
2. Links can be created for "jump to definition"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.