VSCodium / vscodium

binary releases of VS Code without MS branding/telemetry/licensing
https://vscodium.com
MIT License
24.27k stars 1.02k forks source link

How do I open a file in VSCodium from the terminal, and the jump to a desired line of code in it? #1928

Open florinpatrascu opened 2 weeks ago

florinpatrascu commented 2 weeks ago

Hi there,

I can open a file from the terminal for editing, using the command codium lib/a_file.ex (the file extension doesn't matter) and VSCodium functions correctly. However, when I attempt codium lib/a_file.ex:20, VSCodium tries to create a new file with the tab displaying a_file:20 as the file name. This functionality works in VSCode, and I'm curious if I'm making a mistake or if this feature is not yet supported in VSCodium. I'm using iTerm2 on macOS, but this issue persists in Terminal as well.

Thank you.

daiyam commented 2 weeks ago

Humm... I can't do code lib/a_file.ex:20 either... Not sure what's going on.

florinpatrascu commented 2 weeks ago

so .. after a fair amount of spelunking, the only way I can make it work is to use this form: codium -g lib/a_file.ex:20. It seems codium ignores the line number, unless explicitly requested to use it (the -g part, aka --goto <file:line[:character]>)

daiyam commented 2 weeks ago

Reading https://code.visualstudio.com/docs/editor/command-line, and I can't find if code lib/a_file.ex:20 (with Visual Studio Code and without -g) is expected to do what you want. (It also doesn't work on my machine)

Could it be one of your extension adding the feature?

florinpatrascu commented 2 weeks ago

None of my extensions are causing this behavior; it appears to be standard for VSCode. You might want to try using the full path in your case. If you have a project open and you want to open a file from the CLI, it will open the file even if the path is relative, as shown in my initial example.

daiyam commented 2 weeks ago

You might want to try using the full path in your case.

I tried both relative and absolute, from Visual Studio Code or Terminal, I still don't have the behaviour you desire in Visual Studio Code.

Are you on arm64?

florinpatrascu commented 2 weeks ago

Are you on arm64?

yes