我也在寻找同样的东西,看到这篇帖子还没有答案,所以觉得可以试着回答一下。
如果你在用户设置文件中添加了以下内容,vscode将不再预览定义:
"editor.gotoLocation.multiple": "goto"
对我来说,上述所有方法都无法解决从typescript文件导入的jsx文件的问题。
我通过进入 F1 > Preferences: Open User Settings
> 搜索 peek
> 尝试将每个设置更改为goto
而不是peek
来解决这个问题。
在我这种情况下,需要更改 Multiple References
设置。
对于较新的版本,请设置:
"editor.definitionLinkOpensInPeek": false
// "editor.defaultColorDecorators": true,
// "markdown.editor.pasteUrlAsFormattedLink.enabled": true,
// Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.
// - peek: Show Peek view of the results (default)
// - gotoAndPeek: Go to the primary result and show a Peek view
// - goto: Go to the primary result and enable Peek-less navigation to others
"editor.gotoLocation.multipleDeclarations": "peek",
// Controls the behavior the 'Go to Definition'-command when multiple target locations exist.
// - peek: Show Peek view of the results (default)
// - gotoAndPeek: Go to the primary result and show a Peek view
// - goto: Go to the primary result and enable Peek-less navigation to others
"editor.gotoLocation.multipleDefinitions": "peek",
// Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.
// - peek: Show Peek view of the results (default)
// - gotoAndPeek: Go to the primary result and show a Peek view
// - goto: Go to the primary result and enable Peek-less navigation to others
"editor.gotoLocation.multipleImplementations": "peek",
// Controls the behavior the 'Go to References'-command when multiple target locations exist.
// - peek: Show Peek view of the results (default)
// - gotoAndPeek: Go to the primary result and show a Peek view
// - goto: Go to the primary result and enable Peek-less navigation to others
"editor.gotoLocation.multipleReferences": "peek",
// Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.
// - peek: Show Peek view of the results (default)
// - gotoAndPeek: Go to the primary result and show a Peek view
// - goto: Go to the primary result and enable Peek-less navigation to others
"editor.gotoLocation.multipleTypeDefinitions": "peek",
在我的电脑上(Mac),如果我按下CMD + 点击或 F12 在一个方法上,它会将我带到定义的 Peek 视图,但是 CMD+F12 会直接带我到实现而没有出现 Peek。
我试图找到解决方法,更改 CMD+点击的行为以转到实现,但似乎还没有解决方案?
VSCode文档显示默认设置为转到定义,无法修改: https://code.visualstudio.com/docs/editor/editingevolved