Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extension: do not classify '.tmpl' as 'gotmpl' by default #3595

Closed
thernstig opened this issue Nov 9, 2024 · 5 comments
Closed

extension: do not classify '.tmpl' as 'gotmpl' by default #3595

thernstig opened this issue Nov 9, 2024 · 5 comments

Comments

@thernstig
Copy link

Is your feature request related to a problem? Please describe.
Consider not activating the extension until a go file is open or a user explicitly requests (command/setting). In the latest version of the exention we get this (which we did not do before):

image

Failed to find the "go" binary in either GOROOT() or PATH(/home/tobias/.vscode-server/bin/e8653663e8840adaf45af01eab5c627a5af81807/bin/remote-cli:/home/tobias/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/WinMerge:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/siniz/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/siniz/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin). Check PATH, or Install Go and reload the window. If PATH isn't what you expected, see https://github.com/golang/vscode-go/issues/971

Describe the solution you'd like
Do not invoke anything from the extension until a Go file, or any file type that the extension is registered with, is opened.

Describe alternatives you've considered
None

Additional context
This worked before. It has regressed in the latest version. See these previously, solved topics:
#2164
#3038

@gopherbot gopherbot added this to the Untriaged milestone Nov 9, 2024
@hyangah
Copy link
Contributor

hyangah commented Nov 11, 2024

This extension is meant to get activated only when a go-related file is open or Go debugging is asked.

https://github.com/golang/vscode-go/blob/master/extension/package.json#L97-L103

The welcome page event is suspicious, but this activation event setting didn't change for quite some time.

@thernstig Can you please check the Extension Host output log and see what triggered golang.go extension in your env?
Screenshot 2024-11-11 at 11 19 02 AM

@hyangah hyangah added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 11, 2024
@thernstig
Copy link
Author

@hyangah I cannot get it to replicate now. But I do not have any repositories with Go files, and even if I did I have not opened any Golang files. I am going to close this issue, but will re-open if I see this again with the output from the Extension Host log.

@thernstig
Copy link
Author

thernstig commented Nov 15, 2024

@hyangah I am reopening this temporarily to ask for consultation if this should change or not. I now found out why I see the error, and also understand why.

I am opening a .tmpl file.

As can be seen here, any .tmpl file is considered a gotmpl language identifier:

https://github.com/golang/vscode-go/blob/9eedcfc824ef099d7dbef7aee567d501dde917f8/extension/package.json#L161C1-L170C8

The problem here is, there are multiple languages that use .tmpl as their extension. There is no conflict resolution done when this happens, see microsoft/vscode-docs#2862. It most likely chose the extension that come first in alphabetical order.

Question

Should this extension in reality contribute the .tmpl file as it is so ambiguous and can be used by other languages?

I also wrote microsoft/vscode#233894

@thernstig thernstig reopened this Nov 15, 2024
@hyangah hyangah added FeatureRequest and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Nov 18, 2024
@hyangah hyangah changed the title Consider not activating the extension until a go file is open or a user explicitly requests (command/setting) extension: do not classify '.tmpl' as 'gotmpl' by default Nov 18, 2024
@hyangah
Copy link
Contributor

hyangah commented Nov 18, 2024

Thanks @thernstig
I repurposed this issue to discuss on .tmpl.

Actually, .tmpl was the file extension first mentioned in the Go template support FR. #609 so I think changing this will affect existing users.

You can configure your setting

    "files.associations": {
        "*.tmpl": "plaintext"
    }

(This will prevent from activating the Go extension just because you opened .tmpl file...)

or by interactively selecting the language by clicking the language status bar on the bottom right.

@thernstig
Copy link
Author

@hyangah it is possible for me to reconfigure the file association, but I think the core of the problem is microsoft/vscode#233894

Maybe you can help upvote that? I am closing this issue again, as I understand the rationale why you have it as you do. It is just hard for many users who work in multiple languages, where various files might have .tmpl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants