Stream: t-compiler/rust-analyzer

Topic: #6746 Extract Module to File assist


sasurau4 (Dec 16 2020 at 13:47, on Zulip):

I need help to implement #6746. How to get created file id from client? In more detail, desribed on https://github.com/rust-analyzer/rust-analyzer/pull/6746#discussion_r544302206

matklad (Dec 16 2020 at 15:09, on Zulip):

@sasurau4 good question! I think the best solution is to add "initial_contents: String" to FileSystemEdit::CreateFile.

matklad (Dec 16 2020 at 15:10, on Zulip):

Then, code around resource_op needs to be updated to lower CreateFile to a pari of ops: create new file,then set its contents

sasurau4 (Dec 16 2020 at 15:30, on Zulip):

When adding initial_contents to CreateFile, it seems to correspond to lsp's CreateFile opreration. How to handle initial_contents in to_proto module?

matklad (Dec 16 2020 at 15:31, on Zulip):

I don't think it's possible to specify initial contents in the LSP'sCreateFile

matklad (Dec 16 2020 at 15:31, on Zulip):

So server-side CreateFile should be lowered to two ResourceOps

sasurau4 (Dec 16 2020 at 15:44, on Zulip):

I see. Is server-side CreatFile to one lsp's ResourceOp and lsp's TextDocumentEdit? Because ResourceOp have only create, delete or rename not edit.

matklad (Dec 17 2020 at 10:29, on Zulip):

Oh, you are right of course

matklad (Dec 17 2020 at 10:29, on Zulip):

we should lower it to one resource op and one text document edit

Last update: Jul 29 2021 at 10:00UTC