Conversation
|
This looks pretty interesting. Looking. |
|
@amiralies I tried on |
| send(definitionResponse); | ||
| } else if (msg.method === p.RenameRequest.method) { | ||
| // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename | ||
| let params = msg.params as p.RenameParams; |
There was a problem hiding this comment.
There's a bit of code duplication with the rename command.
Maybe it makes sense to move out functionality that could lead to errors in future. E.g. definitely the way the references command is called, which parameters, etc. So that a future edit does not change only one place out of two, by mistake.
server/src/server.ts
Outdated
| let params = msg.params as p.ReferenceParams; | ||
| let filePath = fileURLToPath(params.textDocument.uri); | ||
| let result: Location | null = utils.runAnalysisAfterSanityCheck( | ||
| let result: Location[] | null = utils.runAnalysisAfterSanityCheck( |
There was a problem hiding this comment.
Actually we had a few of these.
See this alternative way which I'm going to merge now:
#232
There was a problem hiding this comment.
Merged --- perhaps rebase on master instead.
There was a problem hiding this comment.
I'm not sure if the types on #232 are the correct types.
I've also took look at protocol types in ts and couldn't find correct types.
I think we should rely on manual types based on protocl docs. for example in the docs the response type for references request is Location[] | null but there's not type in ts spec for that.
I couldn't reproduce this, tested on vscode, nvim with coc and nvim with built in lsp recording.mp4Note that i close files before renaming. |
aadc95f to
bd06877
Compare
|
Would you try opening the editor from scratch. Open a single file, then do rename? |
Sure, It works on my desktop. recording.mp4 |
|
Actually, it works. Sorry for the mix-up. |
This PR adds lsp rename provider based on references ruquest on analysis cli.
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename
also fixed a small type error in references provider