golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.91k stars 758 forks source link

Requesting to set a new command to execute current Go file. #1628

Open kavi6024 opened 3 years ago

kavi6024 commented 3 years ago

Issue Type: Feature Request

Team VSCode, I am currently learning Golang. I want to set a command such that when I press the respective keybinding (I know how to set keybindings), I want the current Go file to be executed in the Terminal. Like, if I have a file called "Hello.go" and if my desired keybinding is Shift + Return (which is by default for many other commands), the terminal should execute:

C:/Users/admin > "..././PathToGoCompiler" & "...././Path/Hello.go"

Please help me.

Also, even if the syntax is correct in the Go file, it shows me some red lines, but the program is running correctly. Please publish some new extensions to rectify the "errored-errors".

Contact me at : srikavipriyan3@gmail.com

Extension version: 0.26.0 VS Code version: Code 1.58.2 (c3f126316369cd610563c75b1b1725e0679adfb3, 2021-07-14T22:10:15.214Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

suzmue commented 3 years ago

You can run your current Go file by selecting Debug: Start Without Debugging (^F5)

Another options for executing a Go program would be to create a task and attach that to a keybinding. You can find more information about VS Code tasks here

Also, even if the syntax is correct in the Go file, it shows me some red lines, but the program is running correctly. Please publish some new extensions to rectify the "errored-errors".

Can you please open another issue for these errors and share your gopls logs? Instructions for collecting the logs can be found here.

kavi6024 commented 3 years ago

Team VS Code, Honestly, I didn't understand a thing. If you or someone could guide me, I would appreciate it very much.

On Tue, Jul 20, 2021 at 1:22 AM Suzy Mueller @.***> wrote:

You can run your current Go file by selecting Debug: Start Without Debugging (^F5)

Another options for executing a Go program would be to create a task and attach that to a keybinding. You can find more information about VS Code tasks here https://code.visualstudio.com/docs/editor/tasks

Also, even if the syntax is correct in the Go file, it shows me some red lines, but the program is running correctly. Please publish some new extensions to rectify the "errored-errors".

Can you please open another issue for these errors and share your gopls logs? Instructions for collecting the logs can be found here https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/golang/vscode-go/issues/1628#issuecomment-882814835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIDX7HDPQ3AYKK5K324RZ3TYR67FANCNFSM5ARZZ5JA .

kavi6024 commented 3 years ago

Also, I tried this. But it opens something called "Perl Langauge Server" in the Output bar,

On Tue, Jul 20, 2021 at 1:22 AM Suzy Mueller @.***> wrote:

You can run your current Go file by selecting Debug: Start Without Debugging (^F5)

Another options for executing a Go program would be to create a task and attach that to a keybinding. You can find more information about VS Code tasks here https://code.visualstudio.com/docs/editor/tasks

Also, even if the syntax is correct in the Go file, it shows me some red lines, but the program is running correctly. Please publish some new extensions to rectify the "errored-errors".

Can you please open another issue for these errors and share your gopls logs? Instructions for collecting the logs can be found here https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/golang/vscode-go/issues/1628#issuecomment-882814835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIDX7HDPQ3AYKK5K324RZ3TYR67FANCNFSM5ARZZ5JA .

stamblerre commented 3 years ago

Also, I tried this. But it opens something called "Perl Langauge Server" in the Output bar,

There should be a drop-down next to the bar that says "Perl Language Server" that allows you to look at different logs for other language servers. Please look for the "gopls (server)" option.