cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.09k stars 77 forks source link

Language scopes and visualiser is not working in golang files #2458

Closed slatermorgan closed 5 days ago

slatermorgan commented 5 days ago

When using VS code on windows, I'm unable to the func scope on any function within golang. Or any language specific scopes for that matter eg. arg, map, value, list.

example function:

func respondXML(w http.ResponseWriter, xml *XMLResponse) {
    w.Header().Set("Content-Type", "text/xml")
    w.WriteHeader(http.StatusOK)
    if _, err := w.Write(xml.Body); err != nil {
        log.Info.Printf("Error writing XML response: %v", err)
    }
}

I get Cannot read properties of undefined (reading 'endPosition')

Version 0.28.1150 Operating system: Windows 10

Version: 1.90.2 (user setup)
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:34:26.404Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.19044

Using non-language scopes seems to work fine such as block.

I also notice that the scope visualiser, when I click the dropdowns there is nothing in Present / Supported / Legacy. I can confirm that once I open a JSON file, scopes appear as expected - seems to be contained to the go language.

Updating to the latest version of go-pls now gives me the following error:

Language 'log' is not implemented yet; See https://www.cursorless.org/docs/contributing/adding-a-new-language/

So I assume it is incorrectly picking up the go language?

AndreasArvidsson commented 5 days ago

I just tested this on my own machine take funk works fine. The scope visualizer also works fine. Make sure you have the latest version of Cursorless and the parse tree extension

slatermorgan commented 5 days ago

Parse tree: v0.31.1 Cursorless: v0.28.1150

AndreasArvidsson commented 5 days ago

v0.31.1 is the latest version for the parse tree

slatermorgan commented 5 days ago

sorry that was a typo, I am on that version.

Interestingly, if I go into a JSON file, and then back to a golang file - scopes appear as expected - but using any go specific ones give me that wierd language log bug reported above.

AndreasArvidsson commented 5 days ago

Try uninstalling the Cursorless and other parse tree and reinstalling them?

AndreasArvidsson commented 5 days ago

You can also try disabling go-pls

slatermorgan commented 5 days ago

uninstalling and reinstalling now means that no cursorless commands work for me in VS code - the subtitle still comes up but no selections are made in the editor. eg. take file does nothing.

AndreasArvidsson commented 5 days ago

Make sure the command server is still installed. If not you will have errors about this in the Talon log.

slatermorgan commented 5 days ago

reinstalled command server and all my issues went away! So I assume it was something to do with the version of that extension. thanks for the help @AndreasArvidsson !!!

AndreasArvidsson commented 5 days ago

Weird that you would get into that kind of situation in the first place, but I'm happy it works now! :)