Go editor: local autocomplete works on other tracks but not on Go

Hi all,

I’ve been using Exercism for years and I’m on the Go track at the moment. In the online editor, if I’m filling in a stub like this:

func Welcome(name string) string {
	panic("Please implement the Welcome function")
}

and I go to use the name parameter, typing return na brings up nothing. Python suggests it in the same spot, and having it on Go would be really handy, since reaching for the parameter you were just handed is exactly when you want it.

The reason seems to be that autocompletion is on for every track (basicSetup in misc/CodeMirror.tsx), but the suggestions themselves come from what each language registers as autocomplete language data. Python gets that from @codemirror/lang-python. Go is still on @codemirror/legacy-modes/mode/go, which doesn’t register any, so there’s nothing for the editor to offer. Probably just timing: Go was added in May 2021 and @codemirror/lang-go wasn’t published until February 2024.

I did find the older Autocomplete in editor thread, so I should say this isn’t the language server idea. Nothing runs on the server, and it knows nothing about the standard library or other files. Just the names already typed in the file you’re looking at.

I opened a PR (#9420) before reading how contributions work here and it got closed automatically, sorry for the noise. It’s one case in languageCompartment.ts plus the dependency.

If you’re happy with the idea I’d be glad to make this my first contribution, the code is ready to go.

Thanks!