简体   繁体   English

在 VSCode 中的特定行打开文件

[英]Open file at specific line in VSCode

In this section: https://code.visualstudio.com/docs/editor/codebasics#_additional-command-line-arguments在本节中: https : //code.visualstudio.com/docs/editor/codebasics#_additional-command-line-arguments

It states you can use --goto to open a file at a specific line.它指出您可以使用--goto在特定行打开文件。 I grep code with AstroGrep and every time I try to use the --goto argument VsCode fails to open.我使用 AstroGrep 编写代码,每次尝试使用--goto参数时,VsCode 都无法打开。

An example argument i'm using which fails:我正在使用的一个示例参数失败了:

Code.exe --goto C:\filepath\filename.txt:450:11

or

Code.exe --goto "C:\file path\filename.txt":450:11

What is wrong with this file:line:column syntax?这个file:line:column语法有什么问题? or is this a bug in vscode?或者这是vscode中的错误?

Thanks谢谢

Seems to be a known issue which was fixed a couple of days ago - see here似乎是几天前修复的已知问题 - 请参阅此处

Workaround until next version:下个版本之前的解决方法:

  • Use relative paths使用相对路径
  • Use insider version of VSCode使用内部版本的 VSCode
Code.exe --goto "C:\file path\filename.txt:450:11" 

为我工作,仔细看看引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM