Closed Kaijun closed 1 year ago
Thanks for your proposal. Do you mean navigating and unfold the directory when using the "go to definition(or ctrl+left-click a field in your code space)" which similar to the IDEA?
Thanks for your proposal. Do you mean navigating and unfold the directory when using the "go to definition(or ctrl+left-click a field in your code space)" which similar to the IDEA?
yes, exactly
I am sorry for the delay of my reply.
We have three questions about it:
ctrl+hover
and ctrl+click
in vscode, because they have the same call entry in vscode interface ExpanderProvider
.vscode-go
has implemented the feature of definition, so may be conflicts between them.btw, I try to use goland, but it doesn't seem to unflod the target directory while the code definition jumps. Instead, dependencies are only unflod when a package name in the imports scope is clicked.
Thank you!
refs: https://github.com/rogpeppe/godef https://github.com/golang/tools https://github.com/golang/vscode-go
@Kaijun Yes, this feature probably works, but only tested on windows. Could you test it on macos? @CaptainGopher Thank you!
I tested it on macOS 12.3 with Apple M1 chip.
At the beginning, the plugin works normally, the source file was able to be auto expanded and located when I navigated to the source file.
But after trying several times, I found an interesting bug, the plugin will stuck into an UNRESPONSIVE
state stably. Then all the code navigation function just won't work.
After I closed all the editor tabs, the plugin will crash, and gopls
restarted.
I checked the developer tools and found these console error message for you. Hope it will help. The whole message is as bellow:
INFO UNRESPONSIVE extension host: starting to profile NOW
log.ts:307 WARN UNRESPONSIVE extension host: 'r3inbowari.gomodexplorer' took 47% of 5685.25ms, saved PROFILE here: 'file:///var/folders/p2/j15n39rd245514jrpf80h2680000gn/T/exthost-f0cd71.cpuprofile' (4) [{…}, {…}, {…}, {…}]
localProcessExtensionHost.ts:290 Extension Host
localProcessExtensionHost.ts:291 <--- Last few GCs --->[4372:0x120008000] 274776 ms: Scavenge (reduce) 3564.8 (3948.8) -> 3564.6 (3948.8) MB, 3.0 / 0.0 ms (average mu = 0.278, current mu = 0.356) allocation failure [4372:0x120008000] 274780 ms: Scavenge (reduce) 3565.2 (3948.8) -> 3564.9 (3948.8) MB, 3.0 / 0.0 ms (average mu = 0.278, current mu = 0.356) allocation failure [4372:0x120008000] 274784 ms: Scavenge (reduce) 3565.5 (3948.8) -> 3565.3 (3948.8) MB, 3.0 / 0.0 ms (average mu = 0.278, current mu = 0.356) allocation failure <--- JS stacktrace --->FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x119194ba4 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 2: 0x119194d2c node::OnFatalError(char const*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 3: 0x114ead1ec v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 4: 0x114ead11c v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 5: 0x11505f198 v8::internal::Heap::StartIncrementalMarking(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 6: 0x1150711d4 v8::internal::Heap::AllocatedExternalMemorySinceMarkCompact() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 7: 0x11503d800 v8::internal::Factory::NewMap(v8::internal::InstanceType, int, v8::internal::ElementsKind, int, v8::internal::AllocationType) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 8: 0x1152dbac0 v8::internal::Map::TransitionToDataProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::StoreOrigin) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 9: 0x1152c6508 v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::StoreOrigin) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]10: 0x115159494 v8::internal::WeakObjects::Local::Publish() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]11: 0x7407f0a06c 12: 0x74002d3fbc 13: 0x7407e8a598 14: 0x7400b4bfe8 15: 0x7400ae9e8c 16: 0x7400b4cf24 17: 0x7407f576cc 18: 0x7407e8a7e0 19: 0x7400b4d508 20: 0x7407f59358 21: 0x7407eb4fa8 22: 0x7407e8b308 23: 0x114fd8f70 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]24: 0x114fd984c v8::internal::Execution::TryCallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::FixedArray>, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*, bool) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]25: 0x114fd99b8 v8::internal::Execution::TryCall(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*, bool) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]26: 0x114fffb70 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]27: 0x7407e8f1f4 28: 0x7400a33a4c 29: 0x7407e8b42c 30: 0x7407e8b0c8 31: 0x114fd7cf4 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]32: 0x114ecb210 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]33: 0x119100b34 node::CallbackScope::~CallbackScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]34: 0x119100d94 node::CallbackScope::~CallbackScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]35: 0x1191138f8 node::EmitAsyncDestroy(node::Environment*, node::async_context) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]36: 0x11924abd8 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]37: 0x11924cc18 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]38: 0x1192510b4 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]39: 0x113b34818 uv_signal_stop [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]40: 0x113b3c220 uv_free_interface_addresses [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]41: 0x113b2b80c uv_run [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]42: 0x113cc77ac v8::CodeEvent::GetScriptName() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]43: 0x113b3c92c ElectronInitializeICUandStartNode [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]44: 0x104b85088
log.ts:313 ERR Cannot call write after a stream was destroyed: Error: Cannot call write after a stream was destroyed
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at errorBuffer (node:internal/streams/writable:517:14)
at onwriteError (node:internal/streams/writable:420:3)
at onwrite (node:internal/streams/writable:457:7)
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:100:12)
abstractExtensionService.ts:884 Extension host (LocalProcess) terminated unexpectedly. Code: null, Signal: SIGABRT
_onExtensionHostCrashed @ abstractExtensionService.ts:884
_onExtensionHostCrashed @ extensionService.ts:263
_onExtensionHostCrashOrExit @ abstractExtensionService.ts:876
(anonymous) @ abstractExtensionService.ts:861
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
_onExtHostProcessExit @ localProcessExtensionHost.ts:577
(anonymous) @ localProcessExtensionHost.ts:307
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
$ @ ipc.ts:632
onResponse @ ipc.ts:711
onBuffer @ ipc.ts:697
(anonymous) @ ipc.ts:509
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
$ @ event.ts:382
emit @ node:events:390
onMessage @ node:electron/js2c/renderer_init:81
log.ts:313 ERR Extension host (LocalProcess) terminated unexpectedly. No extensions were activated.
log.ts:301 INFO Automatically restarting the extension host.
console.ts:137 [Extension Host] Server: { "Commands": [ "gopls.add_dependency", "gopls.add_import", "gopls.apply_fix", "gopls.check_upgrades", "gopls.edit_go_directive", "gopls.gc_details", "gopls.generate", "gopls.generate_gopls_mod", "gopls.go_get_package", "gopls.list_imports", "gopls.list_known_packages", "gopls.regenerate_cgo", "gopls.remove_dependency", "gopls.run_tests", "gopls.run_vulncheck_exp", "gopls.start_debugging", "gopls.test", "gopls.tidy", "gopls.toggle_gc_details", "gopls.update_go_sum", "gopls.upgrade_dependency", "gopls.vendor" ], "Name": "gopls", "Version": "v0.8.3", "GoVersion": "go1.18.1"}
log.ts:313 ERR [Extension Host] (node:11966) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Electron --trace-deprecation ...` to show where the warning was created)
console.ts:137 [Extension Host] (node:11966) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `Electron --trace-deprecation ...` to show where the warning was created)
E @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
O @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
And this is the screenshot:
@CaptainGopher Thank you very much, v0.2.4 maybe solved this problem.
@Kaijun Yes, this feature probably works, but only tested on windows. Could you test it on macos? @CaptainGopher Thank you!
Sorry for the late reply.
Thanks for your work! It works on my mac device.
OS: macOS Monterey VSC: Version: 1.67.1
Is it possible to navigate to the file and unfold the directory while going to the definition of go mod package with file opening?