command to open file at line number
suggested by @jkaster
Currently a file can be opened in an existing window: #1994
VS Code itself supports opening a file with line number with the -g (goto?) flag (see microsoft/vscode#39891):
code -g file.txt:4
# works :)
code-server -r -g file.txt:4
# error Unknown option -g
It would probably make sense to reuse this schema.
Thanks for creating the follow-up issue. It's a modest enhancement of #1964
My use case is for the "protocol" or url version of code-server. Our API Explorer can direct link to source code declarations and example files. Currently, those open as GitHub permalinks.
My goal is to support opening the relevant file at the correct line number in whatever editor the user prefers, so having (e.g.) http://code-server:port/path=/dir/sub/file.ext:line would address this use case for code-server.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.
I hope this gets implemented some day, since it was deemed relatively easy and it would be great for integration
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.
Oh well. Disappointing.
It would be great if this feature will be implemented. There was already lots of requests, but it wasn't implemented yet. #1292 and #2179 was closed.
At long last implemented in https://github.com/coder/code-server/pull/5620 released in v4.8.0.
This is exciting! What's the protocol syntax version of "open folder/file[at line]"?
If you are using the integrated terminal we delegate to Code's own CLI so it will look like:
code-server -r -g test.txt:4
code-server -r -g test.txt:4:1
If you are running outside code-server in an external terminal it goes through our own CLI and we just always assume -g there apparently:
code-server -r test.txt:4
code-server -r test.txt:4:1
We should eventually remove our CLI and directly delegate to Code's in external terminals to remove the disparity at some point.
Sorry for not being clear. By "protocol" I meant URL syntax
Ahh my bad, this is only for the command-line :line:col syntax. I will add that we also want line/col syntax for the URL method in https://github.com/coder/code-server/issues/1964 for when that gets implemented.
I think I am just being dumb, seems this issue was originally for the URL method but I misread the first post. Sorry for the noise.
Still, I think we can keep this in #1964 since I think it would make sense to implement it all at once.
No worries at all! Thanks for the reply and the work
On Mon, Feb 13, 2023, 12:58 PM Asher @.***> wrote:
I think I am just being dumb, seems this issue was originally for the URL method but I misread the first post. Sorry for the noise.
Still, I think we can keep this in #1964 https://github.com/coder/code-server/issues/1964 since I think it would make sense to implement it all at once.
— Reply to this email directly, view it on GitHub https://github.com/coder/code-server/issues/3106#issuecomment-1428671695, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABORGASV64F4GNPEGAG6YVLWXKN6TANCNFSM42ZNZSAQ . You are receiving this because you were mentioned.Message ID: @.***>