renaming package fails with unknown workspace edit error
See original GitHub issueUnknown workspace edit change received:
{
"oldUri": "file:///c:/GIT/repro/renaming/somepackage",
"newUri": "file:///c:/GIT/repro/renaming/package1",
"options": {
"overwrite": true,
"ignoreIfExists": true
}
}
Repro steps:
- Create this package layout
somemodule.py: contents
def do_something():
print('something')
myscript.py: contents
from somepackage.somemodule import do_something
def run():
do_something()
run()
- Place cursor on
somepackage
inmyscript.py
, and rename it.
LSP messages trace:
[Trace - 6:29:50 PM] Sending request 'textDocument/rename - (8)'.
Params: {
"textDocument": {
"uri": "file:///c%3A/GIT/repro/renaming/myscript.py"
},
"position": {
"line": 0,
"character": 13
},
"newName": "package1"
}
[Trace - 6:29:50 PM] Received response 'textDocument/rename - (8)' in 8ms.
Result: {
"documentChanges": [
{
"textDocument": {
"uri": "file:///c:/GIT/repro/renaming/myscript.py",
"version": 0
},
"edits": [
{
"range": {
"start": {
"line": 0,
"character": 5
},
"end": {
"line": 0,
"character": 9
}
},
"newText": ""
},
{
"range": {
"start": {
"line": 0,
"character": 16
},
"end": {
"line": 0,
"character": 16
}
},
"newText": "1"
},
{
"range": {
"start": {
"line": 0,
"character": 47
},
"end": {
"line": 0,
"character": 47
}
},
"newText": "\r"
},
{
"range": {
"start": {
"line": 1,
"character": 0
},
"end": {
"line": 1,
"character": 0
}
},
"newText": "\r"
},
{
"range": {
"start": {
"line": 2,
"character": 10
},
"end": {
"line": 2,
"character": 10
}
},
"newText": "\r"
},
{
"range": {
"start": {
"line": 3,
"character": 18
},
"end": {
"line": 3,
"character": 18
}
},
"newText": "\r"
},
{
"range": {
"start": {
"line": 4,
"character": 0
},
"end": {
"line": 4,
"character": 0
}
},
"newText": "\r"
},
{
"range": {
"start": {
"line": 5,
"character": 0
},
"end": {
"line": 5,
"character": 0
}
},
"newText": "\r"
}
]
},
{
"oldUri": "file:///c:/GIT/repro/renaming/somepackage",
"newUri": "file:///c:/GIT/repro/renaming/package1",
"options": {
"overwrite": true,
"ignoreIfExists": true
}
}
]
}
Proably just missing edit kind:
{
"kind": "rename", // <------------- This field is required and is missing.
"oldUri": "file:///c:/GIT/repro/renaming/somepackage",
"newUri": "file:///c:/GIT/repro/renaming/package1",
"options": {
"overwrite": true,
"ignoreIfExists": true
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Unknown workspace edit change received: #1385 - GitHub
The error message is: Unknown workspace edit change received Script file looks like: #load ".paket/load/netcoreapp3.1/Snowflake.
Read more >NPM: ENOENT: no such file or directory, rename
When I got this error I looked for all running instances of node in my task manager (i use process explorer ...
Read more >Specifying Dependencies - The Cargo Book
Note: crates.io does not allow packages to be published with dependencies on other registries. Specifying dependencies from git repositories. To depend on a ......
Read more >Known issues - Relativity Documentation
When a user opens a workspace with no categorization sets and open a document, they might see a failed network call (404). Yes....
Read more >Troubleshoot issues in Omnichannel for Customer Service
Errors occur when I try to open Omnichannel for Customer Service or Customer Service workspace with Omnichannel enabled. Issue.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So it looks like we need a fix in
jedi-language-server
, we will need to passkind
to RenameFile here: https://github.com/pappasam/jedi-language-server/blob/b408d6852921c98f5bbaf9942bbbf40f4cd30f07/jedi_language_server/text_edit_utils.py#L60-L66With the above issue fixed, it looks like
jedi
itself might need a fix, trying to rename a namespace package leads to this error. The rename works fine if it has a__init__.py
@pappasam I have created a fix for this. Please have a look.