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

Refactorings not working from Command Palette or shortcut - when the file URL includes embedded spaces #2604

Open
rachbowyer opened this issue Jul 15, 2024 · 0 comments

Comments

@rachbowyer
Copy link

I am able to run refactorings from the "light bulb", but not from the command palette or directly using a shortcut. An example
would be running "Thread last all" on this code:

	(defn- example []
  		(map #(* 2 %) (filter #(= 2 %) (range 10))))

After the refactoring the code looks like

	(defn- example []
  		(->> 10
      		range
       		(filter #(= 2 %))
       		(map #(* 2 %))))

The full project is here: refactor-example

This seems to be caused by having my project in a directory that has embedded spaces on the path. If I move the project to a directory without embedded spaces, then everything seems to be fine.

In the log attached below, the spaces are escaped correctly when highlighting text, but not when trying to run the refactor command.

[Trace - 12:51:05] Sending request 'textDocument/documentHighlight - (149)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/rachelbowyer/Library/Mobile%20Documents/com~apple~CloudDocs/Mathematics%20and%20technology/Clojure%20Projects/refactor-example/src/refactor_example/core.clj"
    },
    "position": {
        "line": 6,
        "character": 4
    }
}


[Trace - 12:51:05] Received response 'textDocument/documentHighlight - (149)' in 3ms.
Result: [
    {
        "range": {
            "start": {
                "line": 6,
                "character": 3
            },
            "end": {
                "line": 6,
                "character": 6
            }
        }
    }
]


[Trace - 12:51:13] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "jar:file%3A/Users/rachelbowyer/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar%21/clojure/core.clj",
        "languageId": "clojure",
        "version": 1,
        "text": ";  [REDACTED
        ] 
    }
}


[Trace - 12:51:13] Sending notification 'textDocument/didClose'.
Params: {
    "textDocument": {
        "uri": "jar:file%3A/Users/rachelbowyer/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar%21/clojure/core.clj"
    }
}


[Trace - 12:51:14] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "jar:file:/Users/rachelbowyer/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar!/clojure/core.clj",
    "diagnostics": []
}


[Trace - 12:51:34] Sending request 'textDocument/documentHighlight - (150)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/rachelbowyer/Library/Mobile%20Documents/com~apple~CloudDocs/Mathematics%20and%20technology/Clojure%20Projects/refactor-example/src/refactor_example/core.clj"
    },
    "position": {
        "line": 6,
        "character": 4
    }
}


[Trace - 12:51:34] Sending request 'workspace/executeCommand - (151)'.
Params: {
    "command": "thread-last-all",
    "arguments": [
        "file:///Users/rachelbowyer/Library/Mobile Documents/com~apple~CloudDocs/Mathematics and technology/Clojure Projects/refactor-example/src/refactor_example/core.clj",
        6,
        4
    ]
}


[Trace - 12:51:34] Received response 'textDocument/documentHighlight - (150)' in 3ms.
Result: [
    {
        "range": {
            "start": {
                "line": 6,
                "character": 3
            },
            "end": {
                "line": 6,
                "character": 6
            }
        }
    }
]


[Trace - 12:51:34] Received response 'workspace/executeCommand - (151)' in 2ms. Request failed: Could not find a form at this location. (-32602).
[Error - 12:51:34] Request workspace/executeCommand failed.
  Message: Could not find a form at this location.
  Code: -32602 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant