diff options
author | Aleksey Kladov <[email protected]> | 2020-05-21 23:28:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-21 23:28:49 +0100 |
commit | 5ef4ebff2017d7bdfa03f0eccb9960a86c9b94ca (patch) | |
tree | 6458549d833ba628fd86d050cb5dd1238c590fc3 /docs | |
parent | 59732df8d40dfadc6dcf5951265416576399712a (diff) |
Use WorkspaceEdit for ssr
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/lsp-extensions.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 0e3a0af1c..7c45aef4c 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -84,3 +84,38 @@ fn main() { | |||
84 | * What is the position of the cursor after `joinLines`? | 84 | * What is the position of the cursor after `joinLines`? |
85 | Currently this is left to editor's discretion, but it might be useful to specify on the server via snippets. | 85 | Currently this is left to editor's discretion, but it might be useful to specify on the server via snippets. |
86 | However, it then becomes unclear how it works with multi cursor. | 86 | However, it then becomes unclear how it works with multi cursor. |
87 | |||
88 | ## Structural Search Replace (SSR) | ||
89 | |||
90 | **Server Capability:** `{ "ssr": boolean }` | ||
91 | |||
92 | This request is send from client to server to handle structural search replace -- automated syntax tree based transformation of the source. | ||
93 | |||
94 | **Method:** `experimental/ssr` | ||
95 | |||
96 | **Request:** | ||
97 | |||
98 | ```typescript | ||
99 | interface SsrParams { | ||
100 | /// Search query. | ||
101 | /// The specific syntax is specified outside of the protocol. | ||
102 | query: string, | ||
103 | /// If true, only check the syntax of the query and don't compute the actual edit. | ||
104 | parseOnly: bool, | ||
105 | } | ||
106 | ``` | ||
107 | |||
108 | **Response:** | ||
109 | |||
110 | ```typescript | ||
111 | WorkspaceEdit | ||
112 | ``` | ||
113 | |||
114 | ### Example | ||
115 | |||
116 | SSR with query `foo($a:expr, $b:expr) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)` into `(y + 5).foo(z)`. | ||
117 | |||
118 | ### Unresolved Question | ||
119 | |||
120 | * Probably needs search without replace mode | ||
121 | * Needs a way to limit the scope to certain files. | ||