summaryrefslogtreecommitdiffstats
path: root/vendor/lsp-types
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/lsp-types')
-rw-r--r--vendor/lsp-types/.cargo-checksum.json2
-rw-r--r--vendor/lsp-types/CHANGELOG.md584
-rw-r--r--vendor/lsp-types/Cargo.toml3
-rw-r--r--vendor/lsp-types/LICENSE44
-rw-r--r--vendor/lsp-types/README.md28
-rw-r--r--[-rwxr-xr-x]vendor/lsp-types/release.sh30
-rw-r--r--vendor/lsp-types/release.toml3
-rw-r--r--vendor/lsp-types/src/call_hierarchy.rs254
-rw-r--r--vendor/lsp-types/src/code_action.rs755
-rw-r--r--vendor/lsp-types/src/code_lens.rs132
-rw-r--r--vendor/lsp-types/src/color.rs244
-rw-r--r--vendor/lsp-types/src/completion.rs1216
-rw-r--r--vendor/lsp-types/src/document_highlight.rs102
-rw-r--r--vendor/lsp-types/src/document_link.rs134
-rw-r--r--vendor/lsp-types/src/document_symbols.rs264
-rw-r--r--vendor/lsp-types/src/error_codes.rs73
-rw-r--r--vendor/lsp-types/src/file_operations.rs426
-rw-r--r--vendor/lsp-types/src/folding_range.rs246
-rw-r--r--vendor/lsp-types/src/formatting.rs306
-rw-r--r--vendor/lsp-types/src/hover.rs172
-rw-r--r--vendor/lsp-types/src/inlay_hint.rs560
-rw-r--r--vendor/lsp-types/src/inline_value.rs217
-rw-r--r--vendor/lsp-types/src/lib.rs5490
-rw-r--r--vendor/lsp-types/src/linked_editing.rs122
-rw-r--r--vendor/lsp-types/src/lsif.rs676
-rw-r--r--vendor/lsp-types/src/moniker.rs184
-rw-r--r--vendor/lsp-types/src/notification.rs722
-rw-r--r--vendor/lsp-types/src/progress.rs268
-rw-r--r--vendor/lsp-types/src/references.rs60
-rw-r--r--vendor/lsp-types/src/rename.rs176
-rw-r--r--vendor/lsp-types/src/request.rs1890
-rw-r--r--vendor/lsp-types/src/selection_range.rs172
-rw-r--r--vendor/lsp-types/src/semantic_tokens.rs1472
-rw-r--r--vendor/lsp-types/src/signature_help.rs414
-rw-r--r--vendor/lsp-types/src/trace.rs164
-rw-r--r--vendor/lsp-types/src/type_hierarchy.rs90
-rw-r--r--vendor/lsp-types/src/window.rs352
-rw-r--r--vendor/lsp-types/src/workspace_folders.rs98
-rw-r--r--vendor/lsp-types/src/workspace_symbols.rs148
-rw-r--r--vendor/lsp-types/tests/lsif.rs32
-rw-r--r--vendor/lsp-types/tests/tsc-unix.lsif270
41 files changed, 9638 insertions, 8957 deletions
diff --git a/vendor/lsp-types/.cargo-checksum.json b/vendor/lsp-types/.cargo-checksum.json
index fe0d2bb53..a3fa12007 100644
--- a/vendor/lsp-types/.cargo-checksum.json
+++ b/vendor/lsp-types/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"fb3c66afb33dcad9d43aa5cb5e34de28ab8dcecdcef4f449ec5a4a5ad9a045cf","Cargo.toml":"3fa7da96cf40b1b3ba29a479dc428f2c43ecb3fd6e78bf3987639730dc96fa8f","LICENSE":"a11232911aa0d746688b560af367728021184084eeb6328a1922d60925c5eda0","README.md":"6814882daa9018d1d99ebdb7861d9759b3c96f976683fabfc8f4b9c9a05b032a","release.sh":"3bfea9a6cd08e825f3247a868338f3844d7f72f4342671898a6326a5df3c4e42","release.toml":"d4f0fecf904b64d9fc9babd3afeff77d3c102d8555b43ef83902c143e3becf16","src/call_hierarchy.rs":"a64967af04133a9c08838db19d2de665d2062ed294f6ca7d1d97edb49dc4096f","src/code_action.rs":"78813e0095a78e89a74d897e8dcb5876e1e1480c5e9e37d6f2fb22fdaecb6045","src/code_lens.rs":"169cc96d4ee9690d0e2e119aee7949006f0123c4a6b919bf7ac484258c93fa95","src/color.rs":"72846c6cda18691f5f9eaa29cb8df87bb4a10ae4e0803916244b250c68dc7701","src/completion.rs":"96681827c185732730e6b352e6259430a0585f92e34ff446b43b8d36e366a6db","src/document_highlight.rs":"491aad4beeb72ecc986d9f4cb43202d440304df3be861c41ab4e892b129212b5","src/document_link.rs":"8aab0d78081aa624290c712bacd30215553e7f0f99b300d3fefd103179fdfad0","src/document_symbols.rs":"063c29bf761c17f6f55c6812da0aad4a6aa04c6db3efbb6ca01b646b7757aabe","src/error_codes.rs":"60d4a1d00e797fe3f3f2c5ffd11be7fbaad82f4fc247ff98285566d6b777f0f7","src/file_operations.rs":"bfc413d4bbfd311c7a178863961e6cde6e8cc7a654370b3848ffd64941fea82a","src/folding_range.rs":"3dc85496b6f5b8c11f3a57f888c2febdac71c997010b13eec34736b29fb86965","src/formatting.rs":"548df3c2da1dec8a3a578b381249b6812f92e73c22257459653980492b21a2a2","src/hover.rs":"fece13f93144dfea0b3c3204f19fc7fc366b25a614515825a20a2596c88966c8","src/inlay_hint.rs":"26671f81e045b3dcca6af3222fd3d8095f061e46b8ff7fc738b6f481a0b631d4","src/lib.rs":"0c990f697238cf37f11fcbb3bc20690a90a0aaaed427d79bdbae3ffda0d38c3f","src/linked_editing.rs":"a840ee445fbcfe32e37191197fb37b19732260462a73cc4ba350b8d9a2c4e607","src/lsif.rs":"c3966583d9b0afc64e93d301c8e20f84ba875ffb6b5d4bbacf4ca4a12cc58e99","src/moniker.rs":"8d8c37daca1d2504c74c17e7195969efcfb42641392026a8e507490adf49d043","src/notification.rs":"67e831168d9e7898965d83a503a33ac10f36561bcdb07195f99769f8ff00340c","src/progress.rs":"2b2189b094fbe7b790a0895f96c29615b9375538760d413413c47ce882af2007","src/references.rs":"e824f6861f67c66af04f8f08afc174793a9662a0a67cc23ccd5240ac0d408212","src/rename.rs":"2980e9452a27868a972fc09d52ac7c000361be9f1efc2de4e20c9b99100010c8","src/request.rs":"3abac2c2390c82bf89180b1305984db2986c5bc716ae9f5dbbd0af0a783ab0f7","src/selection_range.rs":"238b14ba6ac2e45ec66fea32d8ebe5f1d235bde9bc69777a794e10d519bcac9c","src/semantic_tokens.rs":"e6af4475567efb67df53b756bb9b0c5d469f83ea0eba863209e4c151f8c60704","src/signature_help.rs":"02d6c70a6c803badd22a8a474233d1be0b169eb39a6ae668f744dcaee71045ab","src/trace.rs":"81ca45bf188452d074cb879060a88f6d6ec087d6e31e29c37db542fdb5363f5c","src/window.rs":"b380ed57b4a700514ec043310253f3fc57c51d35df18fff8283b685ee8aa17d2","src/workspace_folders.rs":"79b75c1d75a1d57892d515efd8a5cbf7c8fddce1b49dc7dfbd94e685b30fce27","src/workspace_symbols.rs":"a1f18eecc09c352b342c5cc011805457eb836432d5b8688dd2e447ac9bda407a","tests/lsif.rs":"89c7c7fa06a8b108f7519a9860d0e2a049ac66d35db3630697f2f33038513898","tests/tsc-unix.lsif":"5a85759de361285d806c8147cfc9f9cb5235a6a2253bacd8243174713419facd"},"package":"9be6e9c7e2d18f651974370d7aff703f9513e0df6e464fd795660edc77e6ca51"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"a404456dd81ff6bd6aacece55d460556fd5f923db0103d8a3d395761cb2fb2c2","Cargo.toml":"2fb86fa2dd87571fb8e625b68ada491b3c44aa7c2c3a1b739773664d50b44bf3","LICENSE":"005b90a7238f92fd39eaef0b4329a47e1cab351958d9e9bbed9b9c60b76bb2bb","README.md":"aa7b801527c8ed7d06285e86ea1ab224d4f314937631fa390fbcd5558088636e","release.sh":"a8f3c599bdb68a5fa47ec50b6d056ad8b0dcd6dda94b7fc9a7a1899ef4b86c1e","release.toml":"b5c002516befc380e4bf3712b06470fb74689cb0fb9fadb8a36478c596fe621a","src/call_hierarchy.rs":"31567e72d30c3939eb68fb492b6781e31ed0da56bbb4179e3176222f66bb1357","src/code_action.rs":"ace85a0ee6a3735d91d6c7c63ccb23fea8f1c22e0997337ea7fcdb0d235e5859","src/code_lens.rs":"6f0586b780950854d3c1ffbed414d1d9db8a111480f2e99132b4520d0b3a8f07","src/color.rs":"60549c5b20bcc87c954da32c58b00856ac4ab2b1a8b42fed0225d451d7c2f274","src/completion.rs":"3b2a72e3c8d709bd1b0c80035783502e647fd6da205376ecee7afa770e45f061","src/document_highlight.rs":"83c531ba4087538145fc7ff7d3e19bfc8e38441895f885296ea9e0925484dbd0","src/document_link.rs":"ef5ea30b8e761365cdf34666432567d9e5baf08469c4e4d9a51b5a500ffee4b7","src/document_symbols.rs":"fc1097290f9704550f75703524258c121484a9091284065c5318305f67179339","src/error_codes.rs":"06380abbd2970756a6f5c68ed4a47a9226403710b1beb014a790fffb23f6bdf1","src/file_operations.rs":"049b37d961522befc2df6df7f8172d4a122969c87873d4b9750746c46589db66","src/folding_range.rs":"f38500fbd7fa92b4b97c6092b2a2b4ca8649ad09a5a4ef7c532c551d7f70b872","src/formatting.rs":"79d8579fea1f582a4e09f1a63dacf5e504d41ce835a3a9de2ffe9d2ca9b4d686","src/hover.rs":"9feddaed11504a11f8d9cad5733ed3006c04300c2d75c8baee170ec0d68c14f5","src/inlay_hint.rs":"f5ee63e0e4c3c5877620d4c3d2942c8070bed66b6aeace6c2f7578084ff2a9ba","src/inline_value.rs":"34499bb445526b70ff370d507b098439f918b4007663761398af0b7c77d781bb","src/lib.rs":"ded25d5e58499d7e4e2f11665fde4d196fb80f85eee8939c6e8237c7e5019786","src/linked_editing.rs":"1a010996ff20012be72e2c611e5eb57d22f37a969216be4e6fc7b62c4281971e","src/lsif.rs":"747b9552ca4065fb56b887e9f40df8e8cc2502c68ffd305e0d9ca44eae377622","src/moniker.rs":"d59c8ce30f3babd86a7e3f0eac680be5111bf47e879f514afc3d894ddc874fe8","src/notification.rs":"c00b675ae519271827d15e9a8569b55e11233bd4db362110b98fccf65c00b68a","src/progress.rs":"2aaa8f5fb0cb14deb17b09ee29bc092f00ba23024fb0ec81138bb72abea91e4c","src/references.rs":"8d2d3b4622f680343da3622156df656495b3fa67ca4f3f6ecf673e77ec4d2cb8","src/rename.rs":"3f5f1106e9c926c09dadee03c1118e332c5e4fb59c0a71c7bb43800a6322c5bd","src/request.rs":"1a4703fecf7c459a6ed4f13658ecdeca44a2bb42a634e2077c183bb0f54fdc4d","src/selection_range.rs":"7e5d3cd207810f2a2f266960569d5b0adb3aff939b9b9aa0721c91f106a9f6e6","src/semantic_tokens.rs":"9cba9968aebd931de3e31d31564d0bc2c79a1bf28ac4b761b8cc59f3193326fa","src/signature_help.rs":"93440d96f04c01cd81ba13b0b7cb5859a4e8698a7007022f811d300f77090281","src/trace.rs":"338aa8faa6b8cec523d5d8bd08ad87f7a76fca7df64e2db6b2139a879f68bffd","src/type_hierarchy.rs":"d134db897e7cc8c3fb7b494ca8c36547421c46df780e63186d2bfcbac386a866","src/window.rs":"34b9e49217a44f2098708a4d256bab1ffafa13da8d7268fe9a234f427ab40525","src/workspace_folders.rs":"006216c7e0f8b3c50fab89c18231a4d08bf0994d1d8097564d6c1bec882f2975","src/workspace_symbols.rs":"48c9edfbb87b105925d1cd0956f456faa2b289fea7f7ebe85b0739170796b162","tests/lsif.rs":"075ebcdc8bbad2172fdeb72ce41656822e13153ef7b72bfed0b5cceba84fa090","tests/tsc-unix.lsif":"a6b171427afa74a648b0c633272958506ea7cf690b7ab8ba2548229fffd9c403"},"package":"0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237"} \ No newline at end of file
diff --git a/vendor/lsp-types/CHANGELOG.md b/vendor/lsp-types/CHANGELOG.md
index 35655f7fc..584b8ec8b 100644
--- a/vendor/lsp-types/CHANGELOG.md
+++ b/vendor/lsp-types/CHANGELOG.md
@@ -1,289 +1,295 @@
-<a name="v0.93.2"></a>
-### v0.93.2 (2022-10-21)
-
-
-
-
-<a name="v0.93.1"></a>
-### v0.93.1 (2022-08-23)
-
-
-
-
-<a name="v0.93.0"></a>
-## v0.93.0 (2022-04-08)
-
-
-#### Features
-
-* **helperTypes:** implement new JSON types ([bd9bb2e7](https://github.com/gluon-lang/lsp-types/commit/bd9bb2e74171b0194be51085c822c3ccbbb68b7b))
-
-
-
-<a name="v0.92.1"></a>
-### v0.92.1 (2022-03-21)
-
-
-#### Bug Fixes
-
-* **inlayHint:** typo in prop name ([7f7ada31](https://github.com/gluon-lang/lsp-types/commit/7f7ada310fa045ef628dc36f97b8564408fcec6a))
-
-#### Features
-
-* **inlayHint:**
- * add request impls ([393aefa1](https://github.com/gluon-lang/lsp-types/commit/393aefa18b3c900c3f1ac8f6337b7098bdc4365a))
- * add inlayHint provider ([69f21e71](https://github.com/gluon-lang/lsp-types/commit/69f21e714df305643aa727cbf745b439bbd8c112))
- * implement inlayHint basic types ([29a50e71](https://github.com/gluon-lang/lsp-types/commit/29a50e71461f72d2fa2aea90fa03f61adf062074))
-
-
-
-<a name="v0.92.0"></a>
-## v0.92.0 (2022-02-07)
-
-
-
-
-<a name="v0.91.2"></a>
-### v0.91.2 (2022-02-07)
-
-
-#### Features
-
-* Add a TryFrom<&str> implementation for enumerations ([19b85cf4](https://github.com/gluon-lang/lsp-types/commit/19b85cf4a7b5396a89d364e271c3867eb6c840e4), closes [#223](https://github.com/gluon-lang/lsp-types/issues/223))
-
-#### Bug Fixes
-
-* Ensure that the pascal_case_name is evaluated at compile time ([7337535b](https://github.com/gluon-lang/lsp-types/commit/7337535b79000912f859319455cd371af77d1899))
-
-
-
-<a name="v0.91.1"></a>
-### v0.91.1 (2021-11-01)
-
-
-#### Features
-
-* Print the name of know enumerations ([2877b6a1](https://github.com/gluon-lang/lsp-types/commit/2877b6a131ef5c28310b972126f6d1b23cd97788))
-
-
-
-<a name="v0.91.0"></a>
-## v0.91.0 (2021-10-18)
-
-
-
-
-<a name="v0.90.1"></a>
-### v0.90.1 (2021-10-11)
-
-
-#### Bug Fixes
-
-* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
-
-
-
-<a name="v0.90.1"></a>
-### v0.90.1 (2021-10-11)
-
-
-#### Bug Fixes
-
-* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
-
-
-
-<a name="v0.90.1"></a>
-### v0.90.1 (2021-10-11)
-
-
-#### Bug Fixes
-
-* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
-
-
-
-<a name="v0.90.1"></a>
-### v0.90.1 (2021-10-11)
-
-
-#### Bug Fixes
-
-* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
-
-
-
-<a name="v0.90.0"></a>
-## v0.90.0 (2021-09-25)
-
-
-
-
-<a name="v0.61.1"></a>
-### v0.61.1 (2021-06-10)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
-<a name="v0.89.1"></a>
-### v0.89.1 (2021-05-22)
-
-
-
-
-<a name="v0.89.0"></a>
-## v0.89.0 (2021-04-07)
-
-
-
-
-<a name="v0.88.0"></a>
-## v0.88.0 (2021-02-16)
-
-
-
-
-<a name="v0.87.0"></a>
-## v0.87.0 (2021-02-14)
-
-
-
-
-<a name="v0.86.0"></a>
-## v0.86.0 (2020-12-17)
-
-
-
-
-<a name="v0.85.0"></a>
-## v0.85.0 (2020-12-01)
-
-
-
-
-<a name="v0.84.0"></a>
-## v0.84.0 (2020-11-24)
-
-
-
-
-<a name="v0.83.1"></a>
-### v0.83.1 (2020-11-16)
-
-
-
-
-<a name="v0.82.0"></a>
-## v0.82.0 (2020-09-23)
-
-
-
-
-<a name="v0.80.0"></a>
-## v0.80.0 (2020-09-18)
-
-
-
-
-<a name="v0.80.0"></a>
-## v0.80.0 (2020-09-02)
-
-
-
-
-<a name="v0.79.0"></a>
-## v0.79.0 (2020-07-26)
-
-
-
-
-<a name="v0.77.0"></a>
-## v0.77.0 (2020-07-15)
-
-
-
-
-<a name="v0.76.1"></a>
-### v0.76.1 (2020-07-14)
-
-
-
-
-<a name="v0.74.2"></a>
-### v0.74.2 (2020-05-30)
-
-
-
-
-<a name="v0.74.1"></a>
-### v0.74.1 (2020-05-01)
-
-
-
-
-<a name="v0.74.0"></a>
-## v0.74.0 (2020-04-26)
-
-
-
-
-<a name="v0.74.0"></a>
-## v0.74.0 (2020-04-26)
-
-
-
-
-<a name="v0.72.0"></a>
-## v0.72.0 (2020-03-02)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
-<a name="v0.72.0"></a>
-## v0.72.0 (2020-03-02)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
-<a name="v0.72.0"></a>
-## v0.72.0 (2020-03-02)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
-<a name="v0.72.0"></a>
-## v0.72.0 (2020-03-02)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
-<a name="v0.72.0"></a>
-## v0.72.0 (2020-03-02)
-
-
-#### Features
-
-* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
-
-
-
+<a name="v0.94.0"></a>
+## v0.94.0 (2023-02-08)
+
+
+
+
+<a name="v0.93.2"></a>
+### v0.93.2 (2022-10-21)
+
+
+
+
+<a name="v0.93.1"></a>
+### v0.93.1 (2022-08-23)
+
+
+
+
+<a name="v0.93.0"></a>
+## v0.93.0 (2022-04-08)
+
+
+#### Features
+
+* **helperTypes:** implement new JSON types ([bd9bb2e7](https://github.com/gluon-lang/lsp-types/commit/bd9bb2e74171b0194be51085c822c3ccbbb68b7b))
+
+
+
+<a name="v0.92.1"></a>
+### v0.92.1 (2022-03-21)
+
+
+#### Bug Fixes
+
+* **inlayHint:** typo in prop name ([7f7ada31](https://github.com/gluon-lang/lsp-types/commit/7f7ada310fa045ef628dc36f97b8564408fcec6a))
+
+#### Features
+
+* **inlayHint:**
+ * add request impls ([393aefa1](https://github.com/gluon-lang/lsp-types/commit/393aefa18b3c900c3f1ac8f6337b7098bdc4365a))
+ * add inlayHint provider ([69f21e71](https://github.com/gluon-lang/lsp-types/commit/69f21e714df305643aa727cbf745b439bbd8c112))
+ * implement inlayHint basic types ([29a50e71](https://github.com/gluon-lang/lsp-types/commit/29a50e71461f72d2fa2aea90fa03f61adf062074))
+
+
+
+<a name="v0.92.0"></a>
+## v0.92.0 (2022-02-07)
+
+
+
+
+<a name="v0.91.2"></a>
+### v0.91.2 (2022-02-07)
+
+
+#### Features
+
+* Add a TryFrom<&str> implementation for enumerations ([19b85cf4](https://github.com/gluon-lang/lsp-types/commit/19b85cf4a7b5396a89d364e271c3867eb6c840e4), closes [#223](https://github.com/gluon-lang/lsp-types/issues/223))
+
+#### Bug Fixes
+
+* Ensure that the pascal_case_name is evaluated at compile time ([7337535b](https://github.com/gluon-lang/lsp-types/commit/7337535b79000912f859319455cd371af77d1899))
+
+
+
+<a name="v0.91.1"></a>
+### v0.91.1 (2021-11-01)
+
+
+#### Features
+
+* Print the name of know enumerations ([2877b6a1](https://github.com/gluon-lang/lsp-types/commit/2877b6a131ef5c28310b972126f6d1b23cd97788))
+
+
+
+<a name="v0.91.0"></a>
+## v0.91.0 (2021-10-18)
+
+
+
+
+<a name="v0.90.1"></a>
+### v0.90.1 (2021-10-11)
+
+
+#### Bug Fixes
+
+* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
+
+
+
+<a name="v0.90.1"></a>
+### v0.90.1 (2021-10-11)
+
+
+#### Bug Fixes
+
+* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
+
+
+
+<a name="v0.90.1"></a>
+### v0.90.1 (2021-10-11)
+
+
+#### Bug Fixes
+
+* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
+
+
+
+<a name="v0.90.1"></a>
+### v0.90.1 (2021-10-11)
+
+
+#### Bug Fixes
+
+* add missing rename_all serde attribute ([b403cba5](https://github.com/gluon-lang/lsp-types/commit/b403cba5fb568f7f1bda3ea2929822269797f7f3))
+
+
+
+<a name="v0.90.0"></a>
+## v0.90.0 (2021-09-25)
+
+
+
+
+<a name="v0.61.1"></a>
+### v0.61.1 (2021-06-10)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
+<a name="v0.89.1"></a>
+### v0.89.1 (2021-05-22)
+
+
+
+
+<a name="v0.89.0"></a>
+## v0.89.0 (2021-04-07)
+
+
+
+
+<a name="v0.88.0"></a>
+## v0.88.0 (2021-02-16)
+
+
+
+
+<a name="v0.87.0"></a>
+## v0.87.0 (2021-02-14)
+
+
+
+
+<a name="v0.86.0"></a>
+## v0.86.0 (2020-12-17)
+
+
+
+
+<a name="v0.85.0"></a>
+## v0.85.0 (2020-12-01)
+
+
+
+
+<a name="v0.84.0"></a>
+## v0.84.0 (2020-11-24)
+
+
+
+
+<a name="v0.83.1"></a>
+### v0.83.1 (2020-11-16)
+
+
+
+
+<a name="v0.82.0"></a>
+## v0.82.0 (2020-09-23)
+
+
+
+
+<a name="v0.80.0"></a>
+## v0.80.0 (2020-09-18)
+
+
+
+
+<a name="v0.80.0"></a>
+## v0.80.0 (2020-09-02)
+
+
+
+
+<a name="v0.79.0"></a>
+## v0.79.0 (2020-07-26)
+
+
+
+
+<a name="v0.77.0"></a>
+## v0.77.0 (2020-07-15)
+
+
+
+
+<a name="v0.76.1"></a>
+### v0.76.1 (2020-07-14)
+
+
+
+
+<a name="v0.74.2"></a>
+### v0.74.2 (2020-05-30)
+
+
+
+
+<a name="v0.74.1"></a>
+### v0.74.1 (2020-05-01)
+
+
+
+
+<a name="v0.74.0"></a>
+## v0.74.0 (2020-04-26)
+
+
+
+
+<a name="v0.74.0"></a>
+## v0.74.0 (2020-04-26)
+
+
+
+
+<a name="v0.72.0"></a>
+## v0.72.0 (2020-03-02)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
+<a name="v0.72.0"></a>
+## v0.72.0 (2020-03-02)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
+<a name="v0.72.0"></a>
+## v0.72.0 (2020-03-02)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
+<a name="v0.72.0"></a>
+## v0.72.0 (2020-03-02)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
+<a name="v0.72.0"></a>
+## v0.72.0 (2020-03-02)
+
+
+#### Features
+
+* Add DeserializeOwned + Serialize bounds on request/notifications ([fb945a93](https://github.com/gluon-lang/lsp-types/commit/fb945a9347b353dd9bc5aab99a86731bebd94c15), closes [#140](https://github.com/gluon-lang/lsp-types/issues/140))
+
+
+
diff --git a/vendor/lsp-types/Cargo.toml b/vendor/lsp-types/Cargo.toml
index fa39192e8..46a883b36 100644
--- a/vendor/lsp-types/Cargo.toml
+++ b/vendor/lsp-types/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "lsp-types"
-version = "0.93.2"
+version = "0.94.0"
authors = [
"Markus Westerlind <marwes91@gmail.com>",
"Bruno Medeiros <bruno.do.medeiros@gmail.com>",
@@ -29,7 +29,6 @@ keywords = [
]
license = "MIT"
repository = "https://github.com/gluon-lang/lsp-types"
-resolver = "1"
[dependencies.bitflags]
version = "1.0.1"
diff --git a/vendor/lsp-types/LICENSE b/vendor/lsp-types/LICENSE
index 32781d976..968950bbb 100644
--- a/vendor/lsp-types/LICENSE
+++ b/vendor/lsp-types/LICENSE
@@ -1,22 +1,22 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Markus Westerlind
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
+The MIT License (MIT)
+
+Copyright (c) 2016 Markus Westerlind
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/vendor/lsp-types/README.md b/vendor/lsp-types/README.md
index d46701166..86203e609 100644
--- a/vendor/lsp-types/README.md
+++ b/vendor/lsp-types/README.md
@@ -1,14 +1,14 @@
-# lsp-types [![Build Status](https://travis-ci.org/gluon-lang/lsp-types.svg?branch=master)](https://travis-ci.org/gluon-lang/lsp-types) [![Documentation](https://docs.rs/lsp-types/badge.svg)](https://docs.rs/crate/lsp-types)
-
-Types useful for interacting with a [language server](https://code.visualstudio.com/blogs/2016/06/27/common-language-protocol).
-
-Supports Language Server Protocol (LSP) version 3.16.0.
-
-Proposed 3.17 features can be activated using the `proposed` feature flag.
-- **NOTE** that these are unstable and may change between releases.
-
-## Links
-
-[Stable Protocol reference](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md)
-
-[Proposed Protocol reference](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.17/specification.md)
+# lsp-types [![Build Status](https://travis-ci.org/gluon-lang/lsp-types.svg?branch=master)](https://travis-ci.org/gluon-lang/lsp-types) [![Documentation](https://docs.rs/lsp-types/badge.svg)](https://docs.rs/crate/lsp-types)
+
+Types useful for interacting with a [language server](https://code.visualstudio.com/blogs/2016/06/27/common-language-protocol).
+
+Supports Language Server Protocol (LSP) version 3.16.0.
+
+Proposed 3.17 features can be activated using the `proposed` feature flag.
+- **NOTE** that these are unstable and may change between releases.
+
+## Links
+
+[Stable Protocol reference](https://github.com/microsoft/language-server-protocol/tree/gh-pages/_specifications/lsp/3.17/specification.md)
+
+[Proposed Protocol reference](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/lsp/3.18/specification.md)
diff --git a/vendor/lsp-types/release.sh b/vendor/lsp-types/release.sh
index 68e484455..642c5ec0d 100755..100644
--- a/vendor/lsp-types/release.sh
+++ b/vendor/lsp-types/release.sh
@@ -1,15 +1,15 @@
-#!/bin/sh
-set -ex
-
-LEVEL=$1
-if [ -z "$LEVEL" ]; then
- echo "Expected patch, minor or major"
- exit 1
-fi
-
-clog --$LEVEL
-
-git add CHANGELOG.md
-git commit -m "Update changelog"
-
-cargo release $LEVEL --execute
+#!/bin/sh
+set -ex
+
+LEVEL=$1
+if [ -z "$LEVEL" ]; then
+ echo "Expected patch, minor or major"
+ exit 1
+fi
+
+clog --$LEVEL
+
+git add CHANGELOG.md
+git commit -m "Update changelog"
+
+cargo release $LEVEL --execute
diff --git a/vendor/lsp-types/release.toml b/vendor/lsp-types/release.toml
index b4a3d205e..a1d785e19 100644
--- a/vendor/lsp-types/release.toml
+++ b/vendor/lsp-types/release.toml
@@ -1,2 +1 @@
-dev-version = false
-tag-message = "Version {{version}}"
+tag-message = "Version {{version}}"
diff --git a/vendor/lsp-types/src/call_hierarchy.rs b/vendor/lsp-types/src/call_hierarchy.rs
index 21d3ec462..e59f0d00b 100644
--- a/vendor/lsp-types/src/call_hierarchy.rs
+++ b/vendor/lsp-types/src/call_hierarchy.rs
@@ -1,127 +1,127 @@
-use serde::{Deserialize, Serialize};
-use serde_json::Value;
-use url::Url;
-
-use crate::{
- DynamicRegistrationClientCapabilities, PartialResultParams, Range, SymbolKind, SymbolTag,
- TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-
-pub type CallHierarchyClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum CallHierarchyServerCapability {
- Simple(bool),
- Options(CallHierarchyOptions),
-}
-
-impl From<CallHierarchyOptions> for CallHierarchyServerCapability {
- fn from(from: CallHierarchyOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for CallHierarchyServerCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyPrepareParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyItem {
- /// The name of this item.
- pub name: String,
-
- /// The kind of this item.
- pub kind: SymbolKind,
-
- /// Tags for this item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tags: Option<Vec<SymbolTag>>,
-
- /// More detail for this item, e.g. the signature of a function.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub detail: Option<String>,
-
- /// The resource identifier of this item.
- pub uri: Url,
-
- /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
- pub range: Range,
-
- /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
- /// Must be contained by the [`range`](#CallHierarchyItem.range).
- pub selection_range: Range,
-
- /// A data entry field that is preserved between a call hierarchy prepare and incloming calls or outgoing calls requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<Value>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyIncomingCallsParams {
- pub item: CallHierarchyItem,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// Represents an incoming call, e.g. a caller of a method or constructor.
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyIncomingCall {
- /// The item that makes the call.
- pub from: CallHierarchyItem,
-
- /// The range at which at which the calls appears. This is relative to the caller
- /// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
- pub from_ranges: Vec<Range>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyOutgoingCallsParams {
- pub item: CallHierarchyItem,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct CallHierarchyOutgoingCall {
- /// The item that is called.
- pub to: CallHierarchyItem,
-
- /// The range at which this item is called. This is the range relative to the caller, e.g the item
- /// passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
- /// and not [`this.to`](#CallHierarchyOutgoingCall.to).
- pub from_ranges: Vec<Range>,
-}
+use serde::{Deserialize, Serialize};
+use serde_json::Value;
+use url::Url;
+
+use crate::{
+ DynamicRegistrationClientCapabilities, PartialResultParams, Range, SymbolKind, SymbolTag,
+ TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+
+pub type CallHierarchyClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CallHierarchyServerCapability {
+ Simple(bool),
+ Options(CallHierarchyOptions),
+}
+
+impl From<CallHierarchyOptions> for CallHierarchyServerCapability {
+ fn from(from: CallHierarchyOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for CallHierarchyServerCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyPrepareParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyItem {
+ /// The name of this item.
+ pub name: String,
+
+ /// The kind of this item.
+ pub kind: SymbolKind,
+
+ /// Tags for this item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<SymbolTag>>,
+
+ /// More detail for this item, e.g. the signature of a function.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub detail: Option<String>,
+
+ /// The resource identifier of this item.
+ pub uri: Url,
+
+ /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
+ pub range: Range,
+
+ /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
+ /// Must be contained by the [`range`](#CallHierarchyItem.range).
+ pub selection_range: Range,
+
+ /// A data entry field that is preserved between a call hierarchy prepare and incloming calls or outgoing calls requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<Value>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyIncomingCallsParams {
+ pub item: CallHierarchyItem,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// Represents an incoming call, e.g. a caller of a method or constructor.
+#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyIncomingCall {
+ /// The item that makes the call.
+ pub from: CallHierarchyItem,
+
+ /// The range at which at which the calls appears. This is relative to the caller
+ /// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
+ pub from_ranges: Vec<Range>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyOutgoingCallsParams {
+ pub item: CallHierarchyItem,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
+#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct CallHierarchyOutgoingCall {
+ /// The item that is called.
+ pub to: CallHierarchyItem,
+
+ /// The range at which this item is called. This is the range relative to the caller, e.g the item
+ /// passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
+ /// and not [`this.to`](#CallHierarchyOutgoingCall.to).
+ pub from_ranges: Vec<Range>,
+}
diff --git a/vendor/lsp-types/src/code_action.rs b/vendor/lsp-types/src/code_action.rs
index 8859743d2..859fc1c02 100644
--- a/vendor/lsp-types/src/code_action.rs
+++ b/vendor/lsp-types/src/code_action.rs
@@ -1,360 +1,395 @@
-use crate::{
- Command, Diagnostic, PartialResultParams, Range, TextDocumentIdentifier,
- WorkDoneProgressOptions, WorkDoneProgressParams, WorkspaceEdit,
-};
-use serde::{Deserialize, Serialize};
-
-use serde_json::Value;
-
-use std::borrow::Cow;
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum CodeActionProviderCapability {
- Simple(bool),
- Options(CodeActionOptions),
-}
-
-impl From<CodeActionOptions> for CodeActionProviderCapability {
- fn from(from: CodeActionOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for CodeActionProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionClientCapabilities {
- ///
- /// This capability supports dynamic registration.
- ///
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client support code action literals as a valid
- /// response of the `textDocument/codeAction` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_action_literal_support: Option<CodeActionLiteralSupport>,
-
- /// Whether code action supports the `isPreferred` property.
- ///
- /// since 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub is_preferred_support: Option<bool>,
-
- /// Whether code action supports the `disabled` property.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub disabled_support: Option<bool>,
-
- /// Whether code action supports the `data` property which is
- /// preserved between a `textDocument/codeAction` and a
- /// `codeAction/resolve` request.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data_support: Option<bool>,
-
- /// Whether the client supports resolving additional code action
- /// properties via a separate `codeAction/resolve` request.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_support: Option<CodeActionCapabilityResolveSupport>,
-
- /// Whether the client honors the change annotations in
- /// text edits and resource operations returned via the
- /// `CodeAction#edit` property by for example presenting
- /// the workspace edit in the user interface and asking
- /// for confirmation.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub honors_change_annotations: Option<bool>,
-}
-
-/// Whether the client supports resolving additional code action
-/// properties via a separate `codeAction/resolve` request.
-///
-/// since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionCapabilityResolveSupport {
- /// The properties that a client can resolve lazily.
- pub properties: Vec<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionLiteralSupport {
- /// The code action kind is support with the following value set.
- pub code_action_kind: CodeActionKindLiteralSupport,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionKindLiteralSupport {
- /// The code action kind values the client supports. When this
- /// property exists the client also guarantees that it will
- /// handle values outside its set gracefully and falls back
- /// to a default value when unknown.
- pub value_set: Vec<String>,
-}
-
-/// Params for the CodeActionRequest
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionParams {
- /// The document in which the command was invoked.
- pub text_document: TextDocumentIdentifier,
-
- /// The range for which the command was invoked.
- pub range: Range,
-
- /// Context carrying additional information.
- pub context: CodeActionContext,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// response for CodeActionRequest
-pub type CodeActionResponse = Vec<CodeActionOrCommand>;
-
-#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum CodeActionOrCommand {
- Command(Command),
- CodeAction(CodeAction),
-}
-
-impl From<Command> for CodeActionOrCommand {
- fn from(comand: Command) -> Self {
- CodeActionOrCommand::Command(comand)
- }
-}
-
-impl From<CodeAction> for CodeActionOrCommand {
- fn from(action: CodeAction) -> Self {
- CodeActionOrCommand::CodeAction(action)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
-pub struct CodeActionKind(Cow<'static, str>);
-
-impl CodeActionKind {
- /// Empty kind.
- pub const EMPTY: CodeActionKind = CodeActionKind::new("");
-
- /// Base kind for quickfix actions: 'quickfix'
- pub const QUICKFIX: CodeActionKind = CodeActionKind::new("quickfix");
-
- /// Base kind for refactoring actions: 'refactor'
- pub const REFACTOR: CodeActionKind = CodeActionKind::new("refactor");
-
- /// Base kind for refactoring extraction actions: 'refactor.extract'
- ///
- /// Example extract actions:
- ///
- /// - Extract method
- /// - Extract function
- /// - Extract variable
- /// - Extract interface from class
- /// - ...
- pub const REFACTOR_EXTRACT: CodeActionKind = CodeActionKind::new("refactor.extract");
-
- /// Base kind for refactoring inline actions: 'refactor.inline'
- ///
- /// Example inline actions:
- ///
- /// - Inline function
- /// - Inline variable
- /// - Inline constant
- /// - ...
- pub const REFACTOR_INLINE: CodeActionKind = CodeActionKind::new("refactor.inline");
-
- /// Base kind for refactoring rewrite actions: 'refactor.rewrite'
- ///
- /// Example rewrite actions:
- ///
- /// - Convert JavaScript function to class
- /// - Add or remove parameter
- /// - Encapsulate field
- /// - Make method static
- /// - Move method to base class
- /// - ...
- pub const REFACTOR_REWRITE: CodeActionKind = CodeActionKind::new("refactor.rewrite");
-
- /// Base kind for source actions: `source`
- ///
- /// Source code actions apply to the entire file.
- pub const SOURCE: CodeActionKind = CodeActionKind::new("source");
-
- /// Base kind for an organize imports source action: `source.organizeImports`
- pub const SOURCE_ORGANIZE_IMPORTS: CodeActionKind =
- CodeActionKind::new("source.organizeImports");
-
- pub const fn new(tag: &'static str) -> Self {
- CodeActionKind(Cow::Borrowed(tag))
- }
-
- pub fn as_str(&self) -> &str {
- &self.0
- }
-}
-
-impl From<String> for CodeActionKind {
- fn from(from: String) -> Self {
- CodeActionKind(Cow::from(from))
- }
-}
-
-impl From<&'static str> for CodeActionKind {
- fn from(from: &'static str) -> Self {
- CodeActionKind::new(from)
- }
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeAction {
- /// A short, human-readable, title for this code action.
- pub title: String,
-
- /// The kind of the code action.
- /// Used to filter code actions.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<CodeActionKind>,
-
- /// The diagnostics that this code action resolves.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub diagnostics: Option<Vec<Diagnostic>>,
-
- /// The workspace edit this code action performs.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub edit: Option<WorkspaceEdit>,
-
- /// A command this code action executes. If a code action
- /// provides an edit and a command, first the edit is
- /// executed and then the command.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub command: Option<Command>,
-
- /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
- /// by keybindings.
- /// A quick fix should be marked preferred if it properly addresses the underlying error.
- /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
- ///
- /// since 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub is_preferred: Option<bool>,
-
- /// Marks that the code action cannot currently be applied.
- ///
- /// Clients should follow the following guidelines regarding disabled code actions:
- ///
- /// - Disabled code actions are not shown in automatic
- /// [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
- /// code action menu.
- ///
- /// - Disabled actions are shown as faded out in the code action menu when the user request
- /// a more specific type of code action, such as refactorings.
- ///
- /// - If the user has a keybinding that auto applies a code action and only a disabled code
- /// actions are returned, the client should show the user an error message with `reason`
- /// in the editor.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub disabled: Option<CodeActionDisabled>,
-
- /// A data entry field that is preserved on a code action between
- /// a `textDocument/codeAction` and a `codeAction/resolve` request.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<Value>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionDisabled {
- /// Human readable description of why the code action is currently disabled.
- ///
- /// This is displayed in the code actions UI.
- pub reason: String,
-}
-
-/// Contains additional diagnostic information about the context in which
-/// a code action is run.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct CodeActionContext {
- /// An array of diagnostics.
- pub diagnostics: Vec<Diagnostic>,
-
- /// Requested kind of actions to return.
- ///
- /// Actions not of this kind are filtered out by the client before being shown. So servers
- /// can omit computing them.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub only: Option<Vec<CodeActionKind>>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeActionOptions {
- /// CodeActionKinds that this server may return.
- ///
- /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
- /// may list out every specific kind they provide.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_action_kinds: Option<Vec<CodeActionKind>>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-
- /// The server provides support to resolve additional
- /// information for a code action.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_provider: Option<bool>,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::tests::test_serialization;
-
- #[test]
- fn test_code_action_response() {
- test_serialization(
- &vec![
- CodeActionOrCommand::Command(Command {
- title: "title".to_string(),
- command: "command".to_string(),
- arguments: None,
- }),
- CodeActionOrCommand::CodeAction(CodeAction {
- title: "title".to_string(),
- kind: Some(CodeActionKind::QUICKFIX),
- command: None,
- diagnostics: None,
- edit: None,
- is_preferred: None,
- ..CodeAction::default()
- }),
- ],
- r#"[{"title":"title","command":"command"},{"title":"title","kind":"quickfix"}]"#,
- )
- }
-}
+use crate::{
+ Command, Diagnostic, PartialResultParams, Range, TextDocumentIdentifier,
+ WorkDoneProgressOptions, WorkDoneProgressParams, WorkspaceEdit,
+};
+use serde::{Deserialize, Serialize};
+
+use serde_json::Value;
+
+use std::borrow::Cow;
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CodeActionProviderCapability {
+ Simple(bool),
+ Options(CodeActionOptions),
+}
+
+impl From<CodeActionOptions> for CodeActionProviderCapability {
+ fn from(from: CodeActionOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for CodeActionProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionClientCapabilities {
+ ///
+ /// This capability supports dynamic registration.
+ ///
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client support code action literals as a valid
+ /// response of the `textDocument/codeAction` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_action_literal_support: Option<CodeActionLiteralSupport>,
+
+ /// Whether code action supports the `isPreferred` property.
+ ///
+ /// since 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub is_preferred_support: Option<bool>,
+
+ /// Whether code action supports the `disabled` property.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub disabled_support: Option<bool>,
+
+ /// Whether code action supports the `data` property which is
+ /// preserved between a `textDocument/codeAction` and a
+ /// `codeAction/resolve` request.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data_support: Option<bool>,
+
+ /// Whether the client supports resolving additional code action
+ /// properties via a separate `codeAction/resolve` request.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_support: Option<CodeActionCapabilityResolveSupport>,
+
+ /// Whether the client honors the change annotations in
+ /// text edits and resource operations returned via the
+ /// `CodeAction#edit` property by for example presenting
+ /// the workspace edit in the user interface and asking
+ /// for confirmation.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub honors_change_annotations: Option<bool>,
+}
+
+/// Whether the client supports resolving additional code action
+/// properties via a separate `codeAction/resolve` request.
+///
+/// since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionCapabilityResolveSupport {
+ /// The properties that a client can resolve lazily.
+ pub properties: Vec<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionLiteralSupport {
+ /// The code action kind is support with the following value set.
+ pub code_action_kind: CodeActionKindLiteralSupport,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionKindLiteralSupport {
+ /// The code action kind values the client supports. When this
+ /// property exists the client also guarantees that it will
+ /// handle values outside its set gracefully and falls back
+ /// to a default value when unknown.
+ pub value_set: Vec<String>,
+}
+
+/// Params for the CodeActionRequest
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionParams {
+ /// The document in which the command was invoked.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The range for which the command was invoked.
+ pub range: Range,
+
+ /// Context carrying additional information.
+ pub context: CodeActionContext,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// response for CodeActionRequest
+pub type CodeActionResponse = Vec<CodeActionOrCommand>;
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CodeActionOrCommand {
+ Command(Command),
+ CodeAction(CodeAction),
+}
+
+impl From<Command> for CodeActionOrCommand {
+ fn from(comand: Command) -> Self {
+ CodeActionOrCommand::Command(comand)
+ }
+}
+
+impl From<CodeAction> for CodeActionOrCommand {
+ fn from(action: CodeAction) -> Self {
+ CodeActionOrCommand::CodeAction(action)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
+pub struct CodeActionKind(Cow<'static, str>);
+
+impl CodeActionKind {
+ /// Empty kind.
+ pub const EMPTY: CodeActionKind = CodeActionKind::new("");
+
+ /// Base kind for quickfix actions: 'quickfix'
+ pub const QUICKFIX: CodeActionKind = CodeActionKind::new("quickfix");
+
+ /// Base kind for refactoring actions: 'refactor'
+ pub const REFACTOR: CodeActionKind = CodeActionKind::new("refactor");
+
+ /// Base kind for refactoring extraction actions: 'refactor.extract'
+ ///
+ /// Example extract actions:
+ ///
+ /// - Extract method
+ /// - Extract function
+ /// - Extract variable
+ /// - Extract interface from class
+ /// - ...
+ pub const REFACTOR_EXTRACT: CodeActionKind = CodeActionKind::new("refactor.extract");
+
+ /// Base kind for refactoring inline actions: 'refactor.inline'
+ ///
+ /// Example inline actions:
+ ///
+ /// - Inline function
+ /// - Inline variable
+ /// - Inline constant
+ /// - ...
+ pub const REFACTOR_INLINE: CodeActionKind = CodeActionKind::new("refactor.inline");
+
+ /// Base kind for refactoring rewrite actions: 'refactor.rewrite'
+ ///
+ /// Example rewrite actions:
+ ///
+ /// - Convert JavaScript function to class
+ /// - Add or remove parameter
+ /// - Encapsulate field
+ /// - Make method static
+ /// - Move method to base class
+ /// - ...
+ pub const REFACTOR_REWRITE: CodeActionKind = CodeActionKind::new("refactor.rewrite");
+
+ /// Base kind for source actions: `source`
+ ///
+ /// Source code actions apply to the entire file.
+ pub const SOURCE: CodeActionKind = CodeActionKind::new("source");
+
+ /// Base kind for an organize imports source action: `source.organizeImports`
+ pub const SOURCE_ORGANIZE_IMPORTS: CodeActionKind =
+ CodeActionKind::new("source.organizeImports");
+
+ /// Base kind for a 'fix all' source action: `source.fixAll`.
+ ///
+ /// 'Fix all' actions automatically fix errors that have a clear fix that
+ /// do not require user input. They should not suppress errors or perform
+ /// unsafe fixes such as generating new types or classes.
+ ///
+ /// @since 3.17.0
+ pub const SOURCE_FIX_ALL: CodeActionKind = CodeActionKind::new("source.fixAll");
+
+ pub const fn new(tag: &'static str) -> Self {
+ CodeActionKind(Cow::Borrowed(tag))
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl From<String> for CodeActionKind {
+ fn from(from: String) -> Self {
+ CodeActionKind(Cow::from(from))
+ }
+}
+
+impl From<&'static str> for CodeActionKind {
+ fn from(from: &'static str) -> Self {
+ CodeActionKind::new(from)
+ }
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeAction {
+ /// A short, human-readable, title for this code action.
+ pub title: String,
+
+ /// The kind of the code action.
+ /// Used to filter code actions.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<CodeActionKind>,
+
+ /// The diagnostics that this code action resolves.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub diagnostics: Option<Vec<Diagnostic>>,
+
+ /// The workspace edit this code action performs.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub edit: Option<WorkspaceEdit>,
+
+ /// A command this code action executes. If a code action
+ /// provides an edit and a command, first the edit is
+ /// executed and then the command.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub command: Option<Command>,
+
+ /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
+ /// by keybindings.
+ /// A quick fix should be marked preferred if it properly addresses the underlying error.
+ /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
+ ///
+ /// since 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub is_preferred: Option<bool>,
+
+ /// Marks that the code action cannot currently be applied.
+ ///
+ /// Clients should follow the following guidelines regarding disabled code actions:
+ ///
+ /// - Disabled code actions are not shown in automatic
+ /// [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
+ /// code action menu.
+ ///
+ /// - Disabled actions are shown as faded out in the code action menu when the user request
+ /// a more specific type of code action, such as refactorings.
+ ///
+ /// - If the user has a keybinding that auto applies a code action and only a disabled code
+ /// actions are returned, the client should show the user an error message with `reason`
+ /// in the editor.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub disabled: Option<CodeActionDisabled>,
+
+ /// A data entry field that is preserved on a code action between
+ /// a `textDocument/codeAction` and a `codeAction/resolve` request.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<Value>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionDisabled {
+ /// Human readable description of why the code action is currently disabled.
+ ///
+ /// This is displayed in the code actions UI.
+ pub reason: String,
+}
+
+/// The reason why code actions were requested.
+///
+/// @since 3.17.0
+#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct CodeActionTriggerKind(i32);
+lsp_enum! {
+impl CodeActionTriggerKind {
+ /// Code actions were explicitly requested by the user or by an extension.
+ pub const INVOKED: CodeActionTriggerKind = CodeActionTriggerKind(1);
+
+ /// Code actions were requested automatically.
+ ///
+ /// This typically happens when current selection in a file changes, but can
+ /// also be triggered when file content changes.
+ pub const AUTOMATIC: CodeActionTriggerKind = CodeActionTriggerKind(2);
+}
+}
+
+/// Contains additional diagnostic information about the context in which
+/// a code action is run.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionContext {
+ /// An array of diagnostics.
+ pub diagnostics: Vec<Diagnostic>,
+
+ /// Requested kind of actions to return.
+ ///
+ /// Actions not of this kind are filtered out by the client before being shown. So servers
+ /// can omit computing them.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub only: Option<Vec<CodeActionKind>>,
+
+ /// The reason why code actions were requested.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trigger_kind: Option<CodeActionTriggerKind>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeActionOptions {
+ /// CodeActionKinds that this server may return.
+ ///
+ /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
+ /// may list out every specific kind they provide.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_action_kinds: Option<Vec<CodeActionKind>>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+
+ /// The server provides support to resolve additional
+ /// information for a code action.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::test_serialization;
+
+ #[test]
+ fn test_code_action_response() {
+ test_serialization(
+ &vec![
+ CodeActionOrCommand::Command(Command {
+ title: "title".to_string(),
+ command: "command".to_string(),
+ arguments: None,
+ }),
+ CodeActionOrCommand::CodeAction(CodeAction {
+ title: "title".to_string(),
+ kind: Some(CodeActionKind::QUICKFIX),
+ command: None,
+ diagnostics: None,
+ edit: None,
+ is_preferred: None,
+ ..CodeAction::default()
+ }),
+ ],
+ r#"[{"title":"title","command":"command"},{"title":"title","kind":"quickfix"}]"#,
+ )
+ }
+}
diff --git a/vendor/lsp-types/src/code_lens.rs b/vendor/lsp-types/src/code_lens.rs
index 2e4fa790f..e4f35c722 100644
--- a/vendor/lsp-types/src/code_lens.rs
+++ b/vendor/lsp-types/src/code_lens.rs
@@ -1,66 +1,66 @@
-use serde::{Deserialize, Serialize};
-use serde_json::Value;
-
-use crate::{
- Command, DynamicRegistrationClientCapabilities, PartialResultParams, Range,
- TextDocumentIdentifier, WorkDoneProgressParams,
-};
-
-pub type CodeLensClientCapabilities = DynamicRegistrationClientCapabilities;
-
-/// Code Lens options.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeLensOptions {
- /// Code lens has a resolve provider as well.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_provider: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeLensParams {
- /// The document to request code lens for.
- pub text_document: TextDocumentIdentifier,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// A code lens represents a command that should be shown along with
-/// source text, like the number of references, a way to run tests, etc.
-///
-/// A code lens is _unresolved_ when no command is associated to it. For performance
-/// reasons the creation of a code lens and resolving should be done in two stages.
-#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeLens {
- /// The range in which this code lens is valid. Should only span a single line.
- pub range: Range,
-
- /// The command this code lens represents.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub command: Option<Command>,
-
- /// A data entry field that is preserved on a code lens item between
- /// a code lens and a code lens resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<Value>,
-}
-
-#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeLensWorkspaceClientCapabilities {
- /// Whether the client implementation supports a refresh request sent from the
- /// server to the client.
- ///
- /// Note that this event is global and will force the client to refresh all
- /// code lenses currently shown. It should be used with absolute care and is
- /// useful for situation where a server for example detect a project wide
- /// change that requires such a calculation.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub refresh_support: Option<bool>,
-}
+use serde::{Deserialize, Serialize};
+use serde_json::Value;
+
+use crate::{
+ Command, DynamicRegistrationClientCapabilities, PartialResultParams, Range,
+ TextDocumentIdentifier, WorkDoneProgressParams,
+};
+
+pub type CodeLensClientCapabilities = DynamicRegistrationClientCapabilities;
+
+/// Code Lens options.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeLensOptions {
+ /// Code lens has a resolve provider as well.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeLensParams {
+ /// The document to request code lens for.
+ pub text_document: TextDocumentIdentifier,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// A code lens represents a command that should be shown along with
+/// source text, like the number of references, a way to run tests, etc.
+///
+/// A code lens is _unresolved_ when no command is associated to it. For performance
+/// reasons the creation of a code lens and resolving should be done in two stages.
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeLens {
+ /// The range in which this code lens is valid. Should only span a single line.
+ pub range: Range,
+
+ /// The command this code lens represents.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub command: Option<Command>,
+
+ /// A data entry field that is preserved on a code lens item between
+ /// a code lens and a code lens resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<Value>,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeLensWorkspaceClientCapabilities {
+ /// Whether the client implementation supports a refresh request sent from the
+ /// server to the client.
+ ///
+ /// Note that this event is global and will force the client to refresh all
+ /// code lenses currently shown. It should be used with absolute care and is
+ /// useful for situation where a server for example detect a project wide
+ /// change that requires such a calculation.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub refresh_support: Option<bool>,
+}
diff --git a/vendor/lsp-types/src/color.rs b/vendor/lsp-types/src/color.rs
index ef9e858af..a3999683a 100644
--- a/vendor/lsp-types/src/color.rs
+++ b/vendor/lsp-types/src/color.rs
@@ -1,122 +1,122 @@
-use crate::{
- DocumentSelector, DynamicRegistrationClientCapabilities, PartialResultParams, Range,
- TextDocumentIdentifier, TextEdit, WorkDoneProgressParams,
-};
-use serde::{Deserialize, Serialize};
-
-pub type DocumentColorClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ColorProviderOptions {}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct StaticTextDocumentColorProviderOptions {
- /// A document selector to identify the scope of the registration. If set to null
- /// the document selector provided on the client side will be used.
- pub document_selector: Option<DocumentSelector>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub id: Option<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum ColorProviderCapability {
- Simple(bool),
- ColorProvider(ColorProviderOptions),
- Options(StaticTextDocumentColorProviderOptions),
-}
-
-impl From<ColorProviderOptions> for ColorProviderCapability {
- fn from(from: ColorProviderOptions) -> Self {
- Self::ColorProvider(from)
- }
-}
-
-impl From<StaticTextDocumentColorProviderOptions> for ColorProviderCapability {
- fn from(from: StaticTextDocumentColorProviderOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for ColorProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentColorParams {
- /// The text document
- pub text_document: TextDocumentIdentifier,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ColorInformation {
- /// The range in the document where this color appears.
- pub range: Range,
- /// The actual color value for this color range.
- pub color: Color,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Color {
- /// The red component of this color in the range [0-1].
- pub red: f32,
- /// The green component of this color in the range [0-1].
- pub green: f32,
- /// The blue component of this color in the range [0-1].
- pub blue: f32,
- /// The alpha component of this color in the range [0-1].
- pub alpha: f32,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ColorPresentationParams {
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The color information to request presentations for.
- pub color: Color,
-
- /// The range where the color would be inserted. Serves as a context.
- pub range: Range,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Default, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct ColorPresentation {
- /// The label of this color presentation. It will be shown on the color
- /// picker header. By default this is also the text that is inserted when selecting
- /// this color presentation.
- pub label: String,
-
- /// An [edit](#TextEdit) which is applied to a document when selecting
- /// this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
- /// is used.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text_edit: Option<TextEdit>,
-
- /// An optional array of additional [text edits](#TextEdit) that are applied when
- /// selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub additional_text_edits: Option<Vec<TextEdit>>,
-}
+use crate::{
+ DocumentSelector, DynamicRegistrationClientCapabilities, PartialResultParams, Range,
+ TextDocumentIdentifier, TextEdit, WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+
+pub type DocumentColorClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ColorProviderOptions {}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StaticTextDocumentColorProviderOptions {
+ /// A document selector to identify the scope of the registration. If set to null
+ /// the document selector provided on the client side will be used.
+ pub document_selector: Option<DocumentSelector>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub id: Option<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum ColorProviderCapability {
+ Simple(bool),
+ ColorProvider(ColorProviderOptions),
+ Options(StaticTextDocumentColorProviderOptions),
+}
+
+impl From<ColorProviderOptions> for ColorProviderCapability {
+ fn from(from: ColorProviderOptions) -> Self {
+ Self::ColorProvider(from)
+ }
+}
+
+impl From<StaticTextDocumentColorProviderOptions> for ColorProviderCapability {
+ fn from(from: StaticTextDocumentColorProviderOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for ColorProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentColorParams {
+ /// The text document
+ pub text_document: TextDocumentIdentifier,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ColorInformation {
+ /// The range in the document where this color appears.
+ pub range: Range,
+ /// The actual color value for this color range.
+ pub color: Color,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Color {
+ /// The red component of this color in the range [0-1].
+ pub red: f32,
+ /// The green component of this color in the range [0-1].
+ pub green: f32,
+ /// The blue component of this color in the range [0-1].
+ pub blue: f32,
+ /// The alpha component of this color in the range [0-1].
+ pub alpha: f32,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ColorPresentationParams {
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The color information to request presentations for.
+ pub color: Color,
+
+ /// The range where the color would be inserted. Serves as a context.
+ pub range: Range,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Default, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct ColorPresentation {
+ /// The label of this color presentation. It will be shown on the color
+ /// picker header. By default this is also the text that is inserted when selecting
+ /// this color presentation.
+ pub label: String,
+
+ /// An [edit](#TextEdit) which is applied to a document when selecting
+ /// this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
+ /// is used.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text_edit: Option<TextEdit>,
+
+ /// An optional array of additional [text edits](#TextEdit) that are applied when
+ /// selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub additional_text_edits: Option<Vec<TextEdit>>,
+}
diff --git a/vendor/lsp-types/src/completion.rs b/vendor/lsp-types/src/completion.rs
index 5f9277a35..4884960a0 100644
--- a/vendor/lsp-types/src/completion.rs
+++ b/vendor/lsp-types/src/completion.rs
@@ -1,600 +1,616 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- Command, Documentation, MarkupKind, PartialResultParams, TagSupport,
- TextDocumentPositionParams, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions,
- WorkDoneProgressParams,
-};
-
-use crate::Range;
-use serde_json::Value;
-use std::fmt::Debug;
-
-/// Defines how to interpret the insert text in a completion item
-#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct InsertTextFormat(i32);
-lsp_enum! {
-impl InsertTextFormat {
- pub const PLAIN_TEXT: InsertTextFormat = InsertTextFormat(1);
- pub const SNIPPET: InsertTextFormat = InsertTextFormat(2);
-}
-}
-
-/// The kind of a completion entry.
-#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct CompletionItemKind(i32);
-lsp_enum! {
-impl CompletionItemKind {
- pub const TEXT: CompletionItemKind = CompletionItemKind(1);
- pub const METHOD: CompletionItemKind = CompletionItemKind(2);
- pub const FUNCTION: CompletionItemKind = CompletionItemKind(3);
- pub const CONSTRUCTOR: CompletionItemKind = CompletionItemKind(4);
- pub const FIELD: CompletionItemKind = CompletionItemKind(5);
- pub const VARIABLE: CompletionItemKind = CompletionItemKind(6);
- pub const CLASS: CompletionItemKind = CompletionItemKind(7);
- pub const INTERFACE: CompletionItemKind = CompletionItemKind(8);
- pub const MODULE: CompletionItemKind = CompletionItemKind(9);
- pub const PROPERTY: CompletionItemKind = CompletionItemKind(10);
- pub const UNIT: CompletionItemKind = CompletionItemKind(11);
- pub const VALUE: CompletionItemKind = CompletionItemKind(12);
- pub const ENUM: CompletionItemKind = CompletionItemKind(13);
- pub const KEYWORD: CompletionItemKind = CompletionItemKind(14);
- pub const SNIPPET: CompletionItemKind = CompletionItemKind(15);
- pub const COLOR: CompletionItemKind = CompletionItemKind(16);
- pub const FILE: CompletionItemKind = CompletionItemKind(17);
- pub const REFERENCE: CompletionItemKind = CompletionItemKind(18);
- pub const FOLDER: CompletionItemKind = CompletionItemKind(19);
- pub const ENUM_MEMBER: CompletionItemKind = CompletionItemKind(20);
- pub const CONSTANT: CompletionItemKind = CompletionItemKind(21);
- pub const STRUCT: CompletionItemKind = CompletionItemKind(22);
- pub const EVENT: CompletionItemKind = CompletionItemKind(23);
- pub const OPERATOR: CompletionItemKind = CompletionItemKind(24);
- pub const TYPE_PARAMETER: CompletionItemKind = CompletionItemKind(25);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionItemCapability {
- /// Client supports snippets as insert text.
- ///
- /// A snippet can define tab stops and placeholders with `$1`, `$2`
- /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
- /// the end of the snippet. Placeholders with equal identifiers are linked,
- /// that is typing in one will update others too.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub snippet_support: Option<bool>,
-
- /// Client supports commit characters on a completion item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub commit_characters_support: Option<bool>,
-
- /// Client supports the follow content formats for the documentation
- /// property. The order describes the preferred format of the client.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub documentation_format: Option<Vec<MarkupKind>>,
-
- /// Client supports the deprecated property on a completion item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub deprecated_support: Option<bool>,
-
- /// Client supports the preselect property on a completion item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub preselect_support: Option<bool>,
-
- /// Client supports the tag property on a completion item. Clients supporting
- /// tags have to handle unknown tags gracefully. Clients especially need to
- /// preserve unknown tags when sending a completion item back to the server in
- /// a resolve call.
- #[serde(
- default,
- skip_serializing_if = "Option::is_none",
- deserialize_with = "TagSupport::deserialize_compat"
- )]
- pub tag_support: Option<TagSupport<CompletionItemTag>>,
-
- /// Client support insert replace edit to control different behavior if a
- /// completion item is inserted in the text or should replace text.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_replace_support: Option<bool>,
-
- /// Indicates which properties a client can resolve lazily on a completion
- /// item. Before version 3.16.0 only the predefined properties `documentation`
- /// and `details` could be resolved lazily.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_support: Option<CompletionItemCapabilityResolveSupport>,
-
- /// The client supports the `insertTextMode` property on
- /// a completion item to override the whitespace handling mode
- /// as defined by the client.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_text_mode_support: Option<InsertTextModeSupport>,
-
- /// The client has support for completion item label
- /// details (see also `CompletionItemLabelDetails`).
- ///
- /// @since 3.17.0 - proposed state
- ///
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label_details_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionItemCapabilityResolveSupport {
- /// The properties that a client can resolve lazily.
- pub properties: Vec<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InsertTextModeSupport {
- pub value_set: Vec<InsertTextMode>,
-}
-
-/// How whitespace and indentation is handled during completion
-/// item insertion.
-///
-/// @since 3.16.0
-#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct InsertTextMode(i32);
-lsp_enum! {
-impl InsertTextMode {
- /// The insertion or replace strings is taken as it is. If the
- /// value is multi line the lines below the cursor will be
- /// inserted using the indentation defined in the string value.
- /// The client will not apply any kind of adjustments to the
- /// string.
- pub const AS_IS: InsertTextMode = InsertTextMode(1);
-
- /// The editor adjusts leading whitespace of new lines so that
- /// they match the indentation up to the cursor of the line for
- /// which the item is accepted.
- ///
- /// Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
- /// multi line completion item is indented using 2 tabs all
- /// following lines inserted will be indented using 2 tabs as well.
- pub const ADJUST_INDENTATION: InsertTextMode = InsertTextMode(2);
-}
-}
-
-#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct CompletionItemTag(i32);
-lsp_enum! {
-impl CompletionItemTag {
- pub const DEPRECATED: CompletionItemTag = CompletionItemTag(1);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionItemKindCapability {
- /// The completion item kind values the client supports. When this
- /// property exists the client also guarantees that it will
- /// handle values outside its set gracefully and falls back
- /// to a default value when unknown.
- ///
- /// If this property is not present the client only supports
- /// the completion items kinds from `Text` to `Reference` as defined in
- /// the initial version of the protocol.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub value_set: Option<Vec<CompletionItemKind>>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionClientCapabilities {
- /// Whether completion supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client supports the following `CompletionItem` specific
- /// capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub completion_item: Option<CompletionItemCapability>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub completion_item_kind: Option<CompletionItemKindCapability>,
-
- /// The client supports to send additional context information for a
- /// `textDocument/completion` requestion.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub context_support: Option<bool>,
-
- /// The client's default when the completion item doesn't provide a
- /// `insertTextMode` property.
- ///
- /// @since 3.17.0
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_text_mode: Option<InsertTextMode>,
-}
-
-/// A special text edit to provide an insert and a replace operation.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InsertReplaceEdit {
- /// The string to be inserted.
- pub new_text: String,
-
- /// The range if the insert is requested
- pub insert: Range,
-
- /// The range if the replace is requested.
- pub replace: Range,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum CompletionTextEdit {
- Edit(TextEdit),
- InsertAndReplace(InsertReplaceEdit),
-}
-
-impl From<TextEdit> for CompletionTextEdit {
- fn from(edit: TextEdit) -> Self {
- CompletionTextEdit::Edit(edit)
- }
-}
-
-impl From<InsertReplaceEdit> for CompletionTextEdit {
- fn from(edit: InsertReplaceEdit) -> Self {
- CompletionTextEdit::InsertAndReplace(edit)
- }
-}
-
-/// Completion options.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionOptions {
- /// The server provides support to resolve additional information for a completion item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_provider: Option<bool>,
-
- /// Most tools trigger completion request automatically without explicitly
- /// requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they
- /// do so when the user starts to type an identifier. For example if the user
- /// types `c` in a JavaScript file code complete will automatically pop up
- /// present `console` besides others as a completion item. Characters that
- /// make up identifiers don't need to be listed here.
- ///
- /// If code complete should automatically be trigger on characters not being
- /// valid inside an identifier (for example `.` in JavaScript) list them in
- /// `triggerCharacters`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trigger_characters: Option<Vec<String>>,
-
- /// The list of all possible characters that commit a completion. This field
- /// can be used if clients don't support individual commit characters per
- /// completion item. See client capability
- /// `completion.completionItem.commitCharactersSupport`.
- ///
- /// If a server provides both `allCommitCharacters` and commit characters on
- /// an individual completion item the ones on the completion item win.
- ///
- /// @since 3.2.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub all_commit_characters: Option<Vec<String>>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-
- /// The server supports the following `CompletionItem` specific
- /// capabilities.
- ///
- /// @since 3.17.0 - proposed state
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub completion_item: Option<CompletionOptionsCompletionItem>,
-}
-
-#[cfg(feature = "proposed")]
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionOptionsCompletionItem {
- /// The server has support for completion item label
- /// details (see also `CompletionItemLabelDetails`) when receiving
- /// a completion item in a resolve call.
- ///
- /// @since 3.17.0 - proposed state
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label_details_support: Option<bool>,
-}
-
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-pub struct CompletionRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub completion_options: CompletionOptions,
-}
-
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum CompletionResponse {
- Array(Vec<CompletionItem>),
- List(CompletionList),
-}
-
-impl From<Vec<CompletionItem>> for CompletionResponse {
- fn from(items: Vec<CompletionItem>) -> Self {
- CompletionResponse::Array(items)
- }
-}
-
-impl From<CompletionList> for CompletionResponse {
- fn from(list: CompletionList) -> Self {
- CompletionResponse::List(list)
- }
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionParams {
- // This field was "mixed-in" from TextDocumentPositionParams
- #[serde(flatten)]
- pub text_document_position: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- // CompletionParams properties:
- #[serde(skip_serializing_if = "Option::is_none")]
- pub context: Option<CompletionContext>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionContext {
- /// How the completion was triggered.
- pub trigger_kind: CompletionTriggerKind,
-
- /// The trigger character (a single character) that has trigger code complete.
- /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trigger_character: Option<String>,
-}
-
-/// How a completion was triggered.
-#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct CompletionTriggerKind(i32);
-lsp_enum! {
-impl CompletionTriggerKind {
- pub const INVOKED: CompletionTriggerKind = CompletionTriggerKind(1);
- pub const TRIGGER_CHARACTER: CompletionTriggerKind = CompletionTriggerKind(2);
- pub const TRIGGER_FOR_INCOMPLETE_COMPLETIONS: CompletionTriggerKind = CompletionTriggerKind(3);
-}
-}
-
-/// Represents a collection of [completion items](#CompletionItem) to be presented
-/// in the editor.
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionList {
- /// This list it not complete. Further typing should result in recomputing
- /// this list.
- pub is_incomplete: bool,
-
- /// The completion items.
- pub items: Vec<CompletionItem>,
-}
-
-#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionItem {
- /// The label of this completion item. By default
- /// also the text that is inserted when selecting
- /// this completion.
- pub label: String,
-
- /// Additional details for the label
- ///
- /// @since 3.17.0 - proposed state
- ///
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label_details: Option<CompletionItemLabelDetails>,
-
- /// The kind of this completion item. Based of the kind
- /// an icon is chosen by the editor.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<CompletionItemKind>,
-
- /// A human-readable string with additional information
- /// about this item, like type or symbol information.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub detail: Option<String>,
-
- /// A human-readable string that represents a doc-comment.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub documentation: Option<Documentation>,
-
- /// Indicates if this item is deprecated.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub deprecated: Option<bool>,
-
- /// Select this item when showing.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub preselect: Option<bool>,
-
- /// A string that should be used when comparing this item
- /// with other items. When `falsy` the label is used
- /// as the sort text for this item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub sort_text: Option<String>,
-
- /// A string that should be used when filtering a set of
- /// completion items. When `falsy` the label is used as the
- /// filter text for this item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub filter_text: Option<String>,
-
- /// A string that should be inserted into a document when selecting
- /// this completion. When `falsy` the label is used as the insert text
- /// for this item.
- ///
- /// The `insertText` is subject to interpretation by the client side.
- /// Some tools might not take the string literally. For example
- /// VS Code when code complete is requested in this example
- /// `con<cursor position>` and a completion item with an `insertText` of
- /// `console` is provided it will only insert `sole`. Therefore it is
- /// recommended to use `textEdit` instead since it avoids additional client
- /// side interpretation.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_text: Option<String>,
-
- /// The format of the insert text. The format applies to both the `insertText` property
- /// and the `newText` property of a provided `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_text_format: Option<InsertTextFormat>,
-
- /// How whitespace and indentation is handled during completion
- /// item insertion. If not provided the client's default value is used.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_text_mode: Option<InsertTextMode>,
-
- /// An edit which is applied to a document when selecting
- /// this completion. When an edit is provided the value of
- /// insertText is ignored.
- ///
- /// Most editors support two different operation when accepting a completion item. One is to insert a
-
- /// completion text and the other is to replace an existing text with a completion text. Since this can
- /// usually not predetermined by a server it can report both ranges. Clients need to signal support for
- /// `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
- /// property.
- ///
- /// *Note 1:* The text edit's range as well as both ranges from a insert replace edit must be a
- /// [single line] and they must contain the position at which completion has been requested.
- /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range must be a prefix of
- /// the edit's replace range, that means it must be contained and starting at the same position.
- ///
- /// @since 3.16.0 additional type `InsertReplaceEdit`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text_edit: Option<CompletionTextEdit>,
-
- /// An optional array of additional text edits that are applied when
- /// selecting this completion. Edits must not overlap with the main edit
- /// nor with themselves.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub additional_text_edits: Option<Vec<TextEdit>>,
-
- /// An optional command that is executed *after* inserting this completion. *Note* that
- /// additional modifications to the current document should be described with the
- /// additionalTextEdits-property.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub command: Option<Command>,
-
- /// An optional set of characters that when pressed while this completion is
- /// active will accept it first and then type that character. *Note* that all
- /// commit characters should have `length=1` and that superfluous characters
- /// will be ignored.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub commit_characters: Option<Vec<String>>,
-
- /// An data entry field that is preserved on a completion item between
- /// a completion and a completion resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<Value>,
-
- /// Tags for this completion item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tags: Option<Vec<CompletionItemTag>>,
-}
-
-impl CompletionItem {
- /// Create a CompletionItem with the minimum possible info (label and detail).
- pub fn new_simple(label: String, detail: String) -> CompletionItem {
- CompletionItem {
- label,
- detail: Some(detail),
- ..Self::default()
- }
- }
-}
-
-/// Additional details for a completion item label.
-///
-/// @since 3.17.0 - proposed state
-#[cfg(feature = "proposed")]
-#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct CompletionItemLabelDetails {
- /// An optional string which is rendered less prominently directly after
- /// {@link CompletionItemLabel.label label}, without any spacing. Should be
- /// used for function signatures or type annotations.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub detail: Option<String>,
-
- /// An optional string which is rendered less prominently after
- /// {@link CompletionItemLabel.detail}. Should be used for fully qualified
- /// names or file path.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub description: Option<String>,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::tests::test_deserialization;
-
- #[test]
- fn test_tag_support_deserialization() {
- let mut empty = CompletionItemCapability::default();
- empty.tag_support = None;
-
- test_deserialization(r#"{}"#, &empty);
- test_deserialization(r#"{"tagSupport": false}"#, &empty);
-
- let mut t = CompletionItemCapability::default();
- t.tag_support = Some(TagSupport { value_set: vec![] });
- test_deserialization(r#"{"tagSupport": true}"#, &t);
-
- let mut t = CompletionItemCapability::default();
- t.tag_support = Some(TagSupport {
- value_set: vec![CompletionItemTag::DEPRECATED],
- });
- test_deserialization(r#"{"tagSupport": {"valueSet": [1]}}"#, &t);
- }
-
- #[test]
- fn test_debug_enum() {
- assert_eq!(format!("{:?}", CompletionItemKind::TEXT), "Text");
- assert_eq!(
- format!("{:?}", CompletionItemKind::TYPE_PARAMETER),
- "TypeParameter"
- );
- }
-
- #[test]
- fn test_try_from_enum() {
- use std::convert::TryInto;
- assert_eq!("Text".try_into(), Ok(CompletionItemKind::TEXT));
- assert_eq!(
- "TypeParameter".try_into(),
- Ok(CompletionItemKind::TYPE_PARAMETER)
- );
- }
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ Command, Documentation, MarkupKind, PartialResultParams, TagSupport,
+ TextDocumentPositionParams, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions,
+ WorkDoneProgressParams,
+};
+
+use crate::Range;
+use serde_json::Value;
+use std::fmt::Debug;
+
+/// Defines how to interpret the insert text in a completion item
+#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct InsertTextFormat(i32);
+lsp_enum! {
+impl InsertTextFormat {
+ pub const PLAIN_TEXT: InsertTextFormat = InsertTextFormat(1);
+ pub const SNIPPET: InsertTextFormat = InsertTextFormat(2);
+}
+}
+
+/// The kind of a completion entry.
+#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct CompletionItemKind(i32);
+lsp_enum! {
+impl CompletionItemKind {
+ pub const TEXT: CompletionItemKind = CompletionItemKind(1);
+ pub const METHOD: CompletionItemKind = CompletionItemKind(2);
+ pub const FUNCTION: CompletionItemKind = CompletionItemKind(3);
+ pub const CONSTRUCTOR: CompletionItemKind = CompletionItemKind(4);
+ pub const FIELD: CompletionItemKind = CompletionItemKind(5);
+ pub const VARIABLE: CompletionItemKind = CompletionItemKind(6);
+ pub const CLASS: CompletionItemKind = CompletionItemKind(7);
+ pub const INTERFACE: CompletionItemKind = CompletionItemKind(8);
+ pub const MODULE: CompletionItemKind = CompletionItemKind(9);
+ pub const PROPERTY: CompletionItemKind = CompletionItemKind(10);
+ pub const UNIT: CompletionItemKind = CompletionItemKind(11);
+ pub const VALUE: CompletionItemKind = CompletionItemKind(12);
+ pub const ENUM: CompletionItemKind = CompletionItemKind(13);
+ pub const KEYWORD: CompletionItemKind = CompletionItemKind(14);
+ pub const SNIPPET: CompletionItemKind = CompletionItemKind(15);
+ pub const COLOR: CompletionItemKind = CompletionItemKind(16);
+ pub const FILE: CompletionItemKind = CompletionItemKind(17);
+ pub const REFERENCE: CompletionItemKind = CompletionItemKind(18);
+ pub const FOLDER: CompletionItemKind = CompletionItemKind(19);
+ pub const ENUM_MEMBER: CompletionItemKind = CompletionItemKind(20);
+ pub const CONSTANT: CompletionItemKind = CompletionItemKind(21);
+ pub const STRUCT: CompletionItemKind = CompletionItemKind(22);
+ pub const EVENT: CompletionItemKind = CompletionItemKind(23);
+ pub const OPERATOR: CompletionItemKind = CompletionItemKind(24);
+ pub const TYPE_PARAMETER: CompletionItemKind = CompletionItemKind(25);
+}
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionItemCapability {
+ /// Client supports snippets as insert text.
+ ///
+ /// A snippet can define tab stops and placeholders with `$1`, `$2`
+ /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+ /// the end of the snippet. Placeholders with equal identifiers are linked,
+ /// that is typing in one will update others too.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub snippet_support: Option<bool>,
+
+ /// Client supports commit characters on a completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub commit_characters_support: Option<bool>,
+
+ /// Client supports the follow content formats for the documentation
+ /// property. The order describes the preferred format of the client.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub documentation_format: Option<Vec<MarkupKind>>,
+
+ /// Client supports the deprecated property on a completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub deprecated_support: Option<bool>,
+
+ /// Client supports the preselect property on a completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub preselect_support: Option<bool>,
+
+ /// Client supports the tag property on a completion item. Clients supporting
+ /// tags have to handle unknown tags gracefully. Clients especially need to
+ /// preserve unknown tags when sending a completion item back to the server in
+ /// a resolve call.
+ #[serde(
+ default,
+ skip_serializing_if = "Option::is_none",
+ deserialize_with = "TagSupport::deserialize_compat"
+ )]
+ pub tag_support: Option<TagSupport<CompletionItemTag>>,
+
+ /// Client support insert replace edit to control different behavior if a
+ /// completion item is inserted in the text or should replace text.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_replace_support: Option<bool>,
+
+ /// Indicates which properties a client can resolve lazily on a completion
+ /// item. Before version 3.16.0 only the predefined properties `documentation`
+ /// and `details` could be resolved lazily.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_support: Option<CompletionItemCapabilityResolveSupport>,
+
+ /// The client supports the `insertTextMode` property on
+ /// a completion item to override the whitespace handling mode
+ /// as defined by the client.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_text_mode_support: Option<InsertTextModeSupport>,
+
+ /// The client has support for completion item label
+ /// details (see also `CompletionItemLabelDetails`).
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label_details_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionItemCapabilityResolveSupport {
+ /// The properties that a client can resolve lazily.
+ pub properties: Vec<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InsertTextModeSupport {
+ pub value_set: Vec<InsertTextMode>,
+}
+
+/// How whitespace and indentation is handled during completion
+/// item insertion.
+///
+/// @since 3.16.0
+#[derive(Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct InsertTextMode(i32);
+lsp_enum! {
+impl InsertTextMode {
+ /// The insertion or replace strings is taken as it is. If the
+ /// value is multi line the lines below the cursor will be
+ /// inserted using the indentation defined in the string value.
+ /// The client will not apply any kind of adjustments to the
+ /// string.
+ pub const AS_IS: InsertTextMode = InsertTextMode(1);
+
+ /// The editor adjusts leading whitespace of new lines so that
+ /// they match the indentation up to the cursor of the line for
+ /// which the item is accepted.
+ ///
+ /// Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
+ /// multi line completion item is indented using 2 tabs all
+ /// following lines inserted will be indented using 2 tabs as well.
+ pub const ADJUST_INDENTATION: InsertTextMode = InsertTextMode(2);
+}
+}
+
+#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct CompletionItemTag(i32);
+lsp_enum! {
+impl CompletionItemTag {
+ pub const DEPRECATED: CompletionItemTag = CompletionItemTag(1);
+}
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionItemKindCapability {
+ /// The completion item kind values the client supports. When this
+ /// property exists the client also guarantees that it will
+ /// handle values outside its set gracefully and falls back
+ /// to a default value when unknown.
+ ///
+ /// If this property is not present the client only supports
+ /// the completion items kinds from `Text` to `Reference` as defined in
+ /// the initial version of the protocol.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub value_set: Option<Vec<CompletionItemKind>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionListCapability {
+ /// The client supports the following itemDefaults on
+ /// a completion list.
+ ///
+ /// The value lists the supported property names of the
+ /// `CompletionList.itemDefaults` object. If omitted
+ /// no properties are supported.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub item_defaults: Option<Vec<String>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionClientCapabilities {
+ /// Whether completion supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client supports the following `CompletionItem` specific
+ /// capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion_item: Option<CompletionItemCapability>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion_item_kind: Option<CompletionItemKindCapability>,
+
+ /// The client supports to send additional context information for a
+ /// `textDocument/completion` requestion.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub context_support: Option<bool>,
+
+ /// The client's default when the completion item doesn't provide a
+ /// `insertTextMode` property.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_text_mode: Option<InsertTextMode>,
+
+ /// The client supports the following `CompletionList` specific
+ /// capabilities.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion_list: Option<CompletionListCapability>,
+}
+
+/// A special text edit to provide an insert and a replace operation.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InsertReplaceEdit {
+ /// The string to be inserted.
+ pub new_text: String,
+
+ /// The range if the insert is requested
+ pub insert: Range,
+
+ /// The range if the replace is requested.
+ pub replace: Range,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum CompletionTextEdit {
+ Edit(TextEdit),
+ InsertAndReplace(InsertReplaceEdit),
+}
+
+impl From<TextEdit> for CompletionTextEdit {
+ fn from(edit: TextEdit) -> Self {
+ CompletionTextEdit::Edit(edit)
+ }
+}
+
+impl From<InsertReplaceEdit> for CompletionTextEdit {
+ fn from(edit: InsertReplaceEdit) -> Self {
+ CompletionTextEdit::InsertAndReplace(edit)
+ }
+}
+
+/// Completion options.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionOptions {
+ /// The server provides support to resolve additional information for a completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+
+ /// Most tools trigger completion request automatically without explicitly
+ /// requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they
+ /// do so when the user starts to type an identifier. For example if the user
+ /// types `c` in a JavaScript file code complete will automatically pop up
+ /// present `console` besides others as a completion item. Characters that
+ /// make up identifiers don't need to be listed here.
+ ///
+ /// If code complete should automatically be trigger on characters not being
+ /// valid inside an identifier (for example `.` in JavaScript) list them in
+ /// `triggerCharacters`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trigger_characters: Option<Vec<String>>,
+
+ /// The list of all possible characters that commit a completion. This field
+ /// can be used if clients don't support individual commit characters per
+ /// completion item. See client capability
+ /// `completion.completionItem.commitCharactersSupport`.
+ ///
+ /// If a server provides both `allCommitCharacters` and commit characters on
+ /// an individual completion item the ones on the completion item win.
+ ///
+ /// @since 3.2.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub all_commit_characters: Option<Vec<String>>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+
+ /// The server supports the following `CompletionItem` specific
+ /// capabilities.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion_item: Option<CompletionOptionsCompletionItem>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionOptionsCompletionItem {
+ /// The server has support for completion item label
+ /// details (see also `CompletionItemLabelDetails`) when receiving
+ /// a completion item in a resolve call.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label_details_support: Option<bool>,
+}
+
+#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+pub struct CompletionRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub completion_options: CompletionOptions,
+}
+
+#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum CompletionResponse {
+ Array(Vec<CompletionItem>),
+ List(CompletionList),
+}
+
+impl From<Vec<CompletionItem>> for CompletionResponse {
+ fn from(items: Vec<CompletionItem>) -> Self {
+ CompletionResponse::Array(items)
+ }
+}
+
+impl From<CompletionList> for CompletionResponse {
+ fn from(list: CompletionList) -> Self {
+ CompletionResponse::List(list)
+ }
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionParams {
+ // This field was "mixed-in" from TextDocumentPositionParams
+ #[serde(flatten)]
+ pub text_document_position: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ // CompletionParams properties:
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub context: Option<CompletionContext>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionContext {
+ /// How the completion was triggered.
+ pub trigger_kind: CompletionTriggerKind,
+
+ /// The trigger character (a single character) that has trigger code complete.
+ /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trigger_character: Option<String>,
+}
+
+/// How a completion was triggered.
+#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct CompletionTriggerKind(i32);
+lsp_enum! {
+impl CompletionTriggerKind {
+ pub const INVOKED: CompletionTriggerKind = CompletionTriggerKind(1);
+ pub const TRIGGER_CHARACTER: CompletionTriggerKind = CompletionTriggerKind(2);
+ pub const TRIGGER_FOR_INCOMPLETE_COMPLETIONS: CompletionTriggerKind = CompletionTriggerKind(3);
+}
+}
+
+/// Represents a collection of [completion items](#CompletionItem) to be presented
+/// in the editor.
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionList {
+ /// This list it not complete. Further typing should result in recomputing
+ /// this list.
+ pub is_incomplete: bool,
+
+ /// The completion items.
+ pub items: Vec<CompletionItem>,
+}
+
+#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionItem {
+ /// The label of this completion item. By default
+ /// also the text that is inserted when selecting
+ /// this completion.
+ pub label: String,
+
+ /// Additional details for the label
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label_details: Option<CompletionItemLabelDetails>,
+
+ /// The kind of this completion item. Based of the kind
+ /// an icon is chosen by the editor.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<CompletionItemKind>,
+
+ /// A human-readable string with additional information
+ /// about this item, like type or symbol information.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub detail: Option<String>,
+
+ /// A human-readable string that represents a doc-comment.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub documentation: Option<Documentation>,
+
+ /// Indicates if this item is deprecated.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub deprecated: Option<bool>,
+
+ /// Select this item when showing.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub preselect: Option<bool>,
+
+ /// A string that should be used when comparing this item
+ /// with other items. When `falsy` the label is used
+ /// as the sort text for this item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub sort_text: Option<String>,
+
+ /// A string that should be used when filtering a set of
+ /// completion items. When `falsy` the label is used as the
+ /// filter text for this item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub filter_text: Option<String>,
+
+ /// A string that should be inserted into a document when selecting
+ /// this completion. When `falsy` the label is used as the insert text
+ /// for this item.
+ ///
+ /// The `insertText` is subject to interpretation by the client side.
+ /// Some tools might not take the string literally. For example
+ /// VS Code when code complete is requested in this example
+ /// `con<cursor position>` and a completion item with an `insertText` of
+ /// `console` is provided it will only insert `sole`. Therefore it is
+ /// recommended to use `textEdit` instead since it avoids additional client
+ /// side interpretation.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_text: Option<String>,
+
+ /// The format of the insert text. The format applies to both the `insertText` property
+ /// and the `newText` property of a provided `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_text_format: Option<InsertTextFormat>,
+
+ /// How whitespace and indentation is handled during completion
+ /// item insertion. If not provided the client's default value depends on
+ /// the `textDocument.completion.insertTextMode` client capability.
+ ///
+ /// @since 3.16.0
+ /// @since 3.17.0 - support for `textDocument.completion.insertTextMode`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_text_mode: Option<InsertTextMode>,
+
+ /// An edit which is applied to a document when selecting
+ /// this completion. When an edit is provided the value of
+ /// insertText is ignored.
+ ///
+ /// Most editors support two different operation when accepting a completion item. One is to insert a
+
+ /// completion text and the other is to replace an existing text with a completion text. Since this can
+ /// usually not predetermined by a server it can report both ranges. Clients need to signal support for
+ /// `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
+ /// property.
+ ///
+ /// *Note 1:* The text edit's range as well as both ranges from a insert replace edit must be a
+ /// [single line] and they must contain the position at which completion has been requested.
+ /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range must be a prefix of
+ /// the edit's replace range, that means it must be contained and starting at the same position.
+ ///
+ /// @since 3.16.0 additional type `InsertReplaceEdit`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text_edit: Option<CompletionTextEdit>,
+
+ /// An optional array of additional text edits that are applied when
+ /// selecting this completion. Edits must not overlap with the main edit
+ /// nor with themselves.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub additional_text_edits: Option<Vec<TextEdit>>,
+
+ /// An optional command that is executed *after* inserting this completion. *Note* that
+ /// additional modifications to the current document should be described with the
+ /// additionalTextEdits-property.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub command: Option<Command>,
+
+ /// An optional set of characters that when pressed while this completion is
+ /// active will accept it first and then type that character. *Note* that all
+ /// commit characters should have `length=1` and that superfluous characters
+ /// will be ignored.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub commit_characters: Option<Vec<String>>,
+
+ /// An data entry field that is preserved on a completion item between
+ /// a completion and a completion resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<Value>,
+
+ /// Tags for this completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<CompletionItemTag>>,
+}
+
+impl CompletionItem {
+ /// Create a CompletionItem with the minimum possible info (label and detail).
+ pub fn new_simple(label: String, detail: String) -> CompletionItem {
+ CompletionItem {
+ label,
+ detail: Some(detail),
+ ..Self::default()
+ }
+ }
+}
+
+/// Additional details for a completion item label.
+///
+/// @since 3.17.0
+#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct CompletionItemLabelDetails {
+ /// An optional string which is rendered less prominently directly after
+ /// {@link CompletionItemLabel.label label}, without any spacing. Should be
+ /// used for function signatures or type annotations.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub detail: Option<String>,
+
+ /// An optional string which is rendered less prominently after
+ /// {@link CompletionItemLabel.detail}. Should be used for fully qualified
+ /// names or file path.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::test_deserialization;
+
+ #[test]
+ fn test_tag_support_deserialization() {
+ let mut empty = CompletionItemCapability::default();
+ empty.tag_support = None;
+
+ test_deserialization(r#"{}"#, &empty);
+ test_deserialization(r#"{"tagSupport": false}"#, &empty);
+
+ let mut t = CompletionItemCapability::default();
+ t.tag_support = Some(TagSupport { value_set: vec![] });
+ test_deserialization(r#"{"tagSupport": true}"#, &t);
+
+ let mut t = CompletionItemCapability::default();
+ t.tag_support = Some(TagSupport {
+ value_set: vec![CompletionItemTag::DEPRECATED],
+ });
+ test_deserialization(r#"{"tagSupport": {"valueSet": [1]}}"#, &t);
+ }
+
+ #[test]
+ fn test_debug_enum() {
+ assert_eq!(format!("{:?}", CompletionItemKind::TEXT), "Text");
+ assert_eq!(
+ format!("{:?}", CompletionItemKind::TYPE_PARAMETER),
+ "TypeParameter"
+ );
+ }
+
+ #[test]
+ fn test_try_from_enum() {
+ use std::convert::TryInto;
+ assert_eq!("Text".try_into(), Ok(CompletionItemKind::TEXT));
+ assert_eq!(
+ "TypeParameter".try_into(),
+ Ok(CompletionItemKind::TYPE_PARAMETER)
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/document_highlight.rs b/vendor/lsp-types/src/document_highlight.rs
index 9a97c104b..d7cd1ae18 100644
--- a/vendor/lsp-types/src/document_highlight.rs
+++ b/vendor/lsp-types/src/document_highlight.rs
@@ -1,51 +1,51 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- DynamicRegistrationClientCapabilities, PartialResultParams, Range, TextDocumentPositionParams,
- WorkDoneProgressParams,
-};
-
-pub type DocumentHighlightClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentHighlightParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// A document highlight is a range inside a text document which deserves
-/// special attention. Usually a document highlight is visualized by changing
-/// the background color of its range.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DocumentHighlight {
- /// The range this highlight applies to.
- pub range: Range,
-
- /// The highlight kind, default is DocumentHighlightKind.Text.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<DocumentHighlightKind>,
-}
-
-/// A document highlight kind.
-#[derive(Eq, PartialEq, Copy, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct DocumentHighlightKind(i32);
-lsp_enum! {
-impl DocumentHighlightKind {
- /// A textual occurrance.
- pub const TEXT: DocumentHighlightKind = DocumentHighlightKind(1);
-
- /// Read-access of a symbol, like reading a variable.
- pub const READ: DocumentHighlightKind = DocumentHighlightKind(2);
-
- /// Write-access of a symbol, like writing to a variable.
- pub const WRITE: DocumentHighlightKind = DocumentHighlightKind(3);
-}
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ DynamicRegistrationClientCapabilities, PartialResultParams, Range, TextDocumentPositionParams,
+ WorkDoneProgressParams,
+};
+
+pub type DocumentHighlightClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentHighlightParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// A document highlight is a range inside a text document which deserves
+/// special attention. Usually a document highlight is visualized by changing
+/// the background color of its range.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DocumentHighlight {
+ /// The range this highlight applies to.
+ pub range: Range,
+
+ /// The highlight kind, default is DocumentHighlightKind.Text.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<DocumentHighlightKind>,
+}
+
+/// A document highlight kind.
+#[derive(Eq, PartialEq, Copy, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct DocumentHighlightKind(i32);
+lsp_enum! {
+impl DocumentHighlightKind {
+ /// A textual occurrance.
+ pub const TEXT: DocumentHighlightKind = DocumentHighlightKind(1);
+
+ /// Read-access of a symbol, like reading a variable.
+ pub const READ: DocumentHighlightKind = DocumentHighlightKind(2);
+
+ /// Write-access of a symbol, like writing to a variable.
+ pub const WRITE: DocumentHighlightKind = DocumentHighlightKind(3);
+}
+}
diff --git a/vendor/lsp-types/src/document_link.rs b/vendor/lsp-types/src/document_link.rs
index 1400dd96b..df57df29f 100644
--- a/vendor/lsp-types/src/document_link.rs
+++ b/vendor/lsp-types/src/document_link.rs
@@ -1,67 +1,67 @@
-use crate::{
- PartialResultParams, Range, TextDocumentIdentifier, WorkDoneProgressOptions,
- WorkDoneProgressParams,
-};
-use serde::{Deserialize, Serialize};
-use serde_json::Value;
-use url::Url;
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentLinkClientCapabilities {
- /// Whether document link supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Whether the client support the `tooltip` property on `DocumentLink`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tooltip_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentLinkOptions {
- /// Document links have a resolve provider as well.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_provider: Option<bool>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentLinkParams {
- /// The document to provide document links for.
- pub text_document: TextDocumentIdentifier,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// A document link is a range in a text document that links to an internal or external resource, like another
-/// text document or a web site.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DocumentLink {
- /// The range this link applies to.
- pub range: Range,
- /// The uri this link points to.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub target: Option<Url>,
-
- /// The tooltip text when you hover over this link.
- ///
- /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to
- /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
- /// user settings, and localization.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tooltip: Option<String>,
-
- /// A data entry field that is preserved on a document link between a DocumentLinkRequest
- /// and a DocumentLinkResolveRequest.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<Value>,
-}
+use crate::{
+ PartialResultParams, Range, TextDocumentIdentifier, WorkDoneProgressOptions,
+ WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+use serde_json::Value;
+use url::Url;
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentLinkClientCapabilities {
+ /// Whether document link supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Whether the client support the `tooltip` property on `DocumentLink`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tooltip_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentLinkOptions {
+ /// Document links have a resolve provider as well.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentLinkParams {
+ /// The document to provide document links for.
+ pub text_document: TextDocumentIdentifier,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// A document link is a range in a text document that links to an internal or external resource, like another
+/// text document or a web site.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DocumentLink {
+ /// The range this link applies to.
+ pub range: Range,
+ /// The uri this link points to.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub target: Option<Url>,
+
+ /// The tooltip text when you hover over this link.
+ ///
+ /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to
+ /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
+ /// user settings, and localization.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tooltip: Option<String>,
+
+ /// A data entry field that is preserved on a document link between a DocumentLinkRequest
+ /// and a DocumentLinkResolveRequest.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<Value>,
+}
diff --git a/vendor/lsp-types/src/document_symbols.rs b/vendor/lsp-types/src/document_symbols.rs
index f8b166f57..61d0c2520 100644
--- a/vendor/lsp-types/src/document_symbols.rs
+++ b/vendor/lsp-types/src/document_symbols.rs
@@ -1,132 +1,132 @@
-use crate::{
- Location, PartialResultParams, Range, SymbolKind, SymbolKindCapability, TextDocumentIdentifier,
- WorkDoneProgressParams,
-};
-
-use crate::{SymbolTag, TagSupport};
-
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentSymbolClientCapabilities {
- /// This capability supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Specific capabilities for the `SymbolKind`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub symbol_kind: Option<SymbolKindCapability>,
-
- /// The client support hierarchical document symbols.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub hierarchical_document_symbol_support: Option<bool>,
-
- /// The client supports tags on `SymbolInformation`. Tags are supported on
- /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
- /// Clients supporting tags have to handle unknown tags gracefully.
- ///
- /// @since 3.16.0
- #[serde(
- default,
- skip_serializing_if = "Option::is_none",
- deserialize_with = "TagSupport::deserialize_compat"
- )]
- pub tag_support: Option<TagSupport<SymbolTag>>,
-}
-
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum DocumentSymbolResponse {
- Flat(Vec<SymbolInformation>),
- Nested(Vec<DocumentSymbol>),
-}
-
-impl From<Vec<SymbolInformation>> for DocumentSymbolResponse {
- fn from(info: Vec<SymbolInformation>) -> Self {
- DocumentSymbolResponse::Flat(info)
- }
-}
-
-impl From<Vec<DocumentSymbol>> for DocumentSymbolResponse {
- fn from(symbols: Vec<DocumentSymbol>) -> Self {
- DocumentSymbolResponse::Nested(symbols)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentSymbolParams {
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// Represents programming constructs like variables, classes, interfaces etc.
-/// that appear in a document. Document symbols can be hierarchical and they have two ranges:
-/// one that encloses its definition and one that points to its most interesting range,
-/// e.g. the range of an identifier.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentSymbol {
- /// The name of this symbol.
- pub name: String,
- /// More detail for this symbol, e.g the signature of a function. If not provided the
- /// name is used.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub detail: Option<String>,
- /// The kind of this symbol.
- pub kind: SymbolKind,
- /// Tags for this completion item.
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tags: Option<Vec<SymbolTag>>,
- /// Indicates if this symbol is deprecated.
- #[serde(skip_serializing_if = "Option::is_none")]
- #[deprecated(note = "Use tags instead")]
- pub deprecated: Option<bool>,
- /// The range enclosing this symbol not including leading/trailing whitespace but everything else
- /// like comments. This information is typically used to determine if the the clients cursor is
- /// inside the symbol to reveal in the symbol in the UI.
- pub range: Range,
- /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
- /// Must be contained by the the `range`.
- pub selection_range: Range,
- /// Children of this symbol, e.g. properties of a class.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub children: Option<Vec<DocumentSymbol>>,
-}
-
-/// Represents information about programming constructs like variables, classes,
-/// interfaces etc.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SymbolInformation {
- /// The name of this symbol.
- pub name: String,
-
- /// The kind of this symbol.
- pub kind: SymbolKind,
-
- /// Tags for this completion item.
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tags: Option<Vec<SymbolTag>>,
-
- /// Indicates if this symbol is deprecated.
- #[serde(skip_serializing_if = "Option::is_none")]
- #[deprecated(note = "Use tags instead")]
- pub deprecated: Option<bool>,
-
- /// The location of this symbol.
- pub location: Location,
-
- /// The name of the symbol containing this symbol.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub container_name: Option<String>,
-}
+use crate::{
+ Location, PartialResultParams, Range, SymbolKind, SymbolKindCapability, TextDocumentIdentifier,
+ WorkDoneProgressParams,
+};
+
+use crate::{SymbolTag, TagSupport};
+
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentSymbolClientCapabilities {
+ /// This capability supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Specific capabilities for the `SymbolKind`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub symbol_kind: Option<SymbolKindCapability>,
+
+ /// The client support hierarchical document symbols.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub hierarchical_document_symbol_support: Option<bool>,
+
+ /// The client supports tags on `SymbolInformation`. Tags are supported on
+ /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
+ /// Clients supporting tags have to handle unknown tags gracefully.
+ ///
+ /// @since 3.16.0
+ #[serde(
+ default,
+ skip_serializing_if = "Option::is_none",
+ deserialize_with = "TagSupport::deserialize_compat"
+ )]
+ pub tag_support: Option<TagSupport<SymbolTag>>,
+}
+
+#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum DocumentSymbolResponse {
+ Flat(Vec<SymbolInformation>),
+ Nested(Vec<DocumentSymbol>),
+}
+
+impl From<Vec<SymbolInformation>> for DocumentSymbolResponse {
+ fn from(info: Vec<SymbolInformation>) -> Self {
+ DocumentSymbolResponse::Flat(info)
+ }
+}
+
+impl From<Vec<DocumentSymbol>> for DocumentSymbolResponse {
+ fn from(symbols: Vec<DocumentSymbol>) -> Self {
+ DocumentSymbolResponse::Nested(symbols)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentSymbolParams {
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// Represents programming constructs like variables, classes, interfaces etc.
+/// that appear in a document. Document symbols can be hierarchical and they have two ranges:
+/// one that encloses its definition and one that points to its most interesting range,
+/// e.g. the range of an identifier.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentSymbol {
+ /// The name of this symbol.
+ pub name: String,
+ /// More detail for this symbol, e.g the signature of a function. If not provided the
+ /// name is used.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub detail: Option<String>,
+ /// The kind of this symbol.
+ pub kind: SymbolKind,
+ /// Tags for this completion item.
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<SymbolTag>>,
+ /// Indicates if this symbol is deprecated.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[deprecated(note = "Use tags instead")]
+ pub deprecated: Option<bool>,
+ /// The range enclosing this symbol not including leading/trailing whitespace but everything else
+ /// like comments. This information is typically used to determine if the the clients cursor is
+ /// inside the symbol to reveal in the symbol in the UI.
+ pub range: Range,
+ /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
+ /// Must be contained by the the `range`.
+ pub selection_range: Range,
+ /// Children of this symbol, e.g. properties of a class.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub children: Option<Vec<DocumentSymbol>>,
+}
+
+/// Represents information about programming constructs like variables, classes,
+/// interfaces etc.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SymbolInformation {
+ /// The name of this symbol.
+ pub name: String,
+
+ /// The kind of this symbol.
+ pub kind: SymbolKind,
+
+ /// Tags for this completion item.
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<SymbolTag>>,
+
+ /// Indicates if this symbol is deprecated.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[deprecated(note = "Use tags instead")]
+ pub deprecated: Option<bool>,
+
+ /// The location of this symbol.
+ pub location: Location,
+
+ /// The name of the symbol containing this symbol.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub container_name: Option<String>,
+}
diff --git a/vendor/lsp-types/src/error_codes.rs b/vendor/lsp-types/src/error_codes.rs
index 9435a7261..1d0c1d571 100644
--- a/vendor/lsp-types/src/error_codes.rs
+++ b/vendor/lsp-types/src/error_codes.rs
@@ -1,37 +1,36 @@
-//! In this module we only define constants for lsp specific error codes.
-//! There are other error codes that are defined in the
-//! [JSON RPC specification](https://www.jsonrpc.org/specification#error_object).
-
-// This is the start range of LSP reserved error codes.
-// It doesn't denote a real error code.
-//
-// @since 3.16.0
-pub const LSP_RESERVED_ERROR_RANGE_START: i64 = -32899;
-
-// The server cancelled the request. This error code should
-// only be used for requests that explicitly support being
-// server cancellable.
-//
-// @since 3.17.0
-#[cfg(feature = "proposed")]
-pub const SERVER_CANCELLED: i64 = -32802;
-
-// The server detected that the content of a document got
-// modified outside normal conditions. A server should
-// NOT send this error code if it detects a content change
-// in it unprocessed messages. The result even computed
-// on an older state might still be useful for the client.
-//
-// If a client decides that a result is not of any use anymore
-// the client should cancel the request.
-pub const CONTENT_MODIFIED: i64 = -32801;
-
-// The client has canceled a request and a server as detected
-// the cancel.
-pub const REQUEST_CANCELLED: i64 = -32800;
-
-// This is the end range of LSP reserved error codes.
-// It doesn't denote a real error code.
-//
-// @since 3.16.0
-pub const LSP_RESERVED_ERROR_RANGE_END: i64 = -32800;
+//! In this module we only define constants for lsp specific error codes.
+//! There are other error codes that are defined in the
+//! [JSON RPC specification](https://www.jsonrpc.org/specification#error_object).
+
+// This is the start range of LSP reserved error codes.
+// It doesn't denote a real error code.
+//
+// @since 3.16.0
+pub const LSP_RESERVED_ERROR_RANGE_START: i64 = -32899;
+
+// The server cancelled the request. This error code should
+// only be used for requests that explicitly support being
+// server cancellable.
+//
+// @since 3.17.0
+pub const SERVER_CANCELLED: i64 = -32802;
+
+// The server detected that the content of a document got
+// modified outside normal conditions. A server should
+// NOT send this error code if it detects a content change
+// in it unprocessed messages. The result even computed
+// on an older state might still be useful for the client.
+//
+// If a client decides that a result is not of any use anymore
+// the client should cancel the request.
+pub const CONTENT_MODIFIED: i64 = -32801;
+
+// The client has canceled a request and a server as detected
+// the cancel.
+pub const REQUEST_CANCELLED: i64 = -32800;
+
+// This is the end range of LSP reserved error codes.
+// It doesn't denote a real error code.
+//
+// @since 3.16.0
+pub const LSP_RESERVED_ERROR_RANGE_END: i64 = -32800;
diff --git a/vendor/lsp-types/src/file_operations.rs b/vendor/lsp-types/src/file_operations.rs
index 4092d931b..5adcb9838 100644
--- a/vendor/lsp-types/src/file_operations.rs
+++ b/vendor/lsp-types/src/file_operations.rs
@@ -1,213 +1,213 @@
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceFileOperationsClientCapabilities {
- /// Whether the client supports dynamic registration for file
- /// requests/notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client has support for sending didCreateFiles notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_create: Option<bool>,
-
- /// The server is interested in receiving willCreateFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_create: Option<bool>,
-
- /// The server is interested in receiving didRenameFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_rename: Option<bool>,
-
- /// The server is interested in receiving willRenameFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_rename: Option<bool>,
-
- /// The server is interested in receiving didDeleteFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_delete: Option<bool>,
-
- /// The server is interested in receiving willDeleteFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_delete: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceFileOperationsServerCapabilities {
- /// The server is interested in receiving didCreateFiles
- /// notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_create: Option<FileOperationRegistrationOptions>,
-
- /// The server is interested in receiving willCreateFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_create: Option<FileOperationRegistrationOptions>,
-
- /// The server is interested in receiving didRenameFiles
- /// notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_rename: Option<FileOperationRegistrationOptions>,
-
- /// The server is interested in receiving willRenameFiles requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_rename: Option<FileOperationRegistrationOptions>,
-
- /// The server is interested in receiving didDeleteFiles file
- /// notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_delete: Option<FileOperationRegistrationOptions>,
-
- /// The server is interested in receiving willDeleteFiles file
- /// requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_delete: Option<FileOperationRegistrationOptions>,
-}
-
-/// The options to register for file operations.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileOperationRegistrationOptions {
- /// The actual filters.
- pub filters: Vec<FileOperationFilter>,
-}
-
-/// A filter to describe in which file operation requests or notifications
-/// the server is interested in.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileOperationFilter {
- /// A Uri like `file` or `untitled`.
- pub scheme: Option<String>,
-
- /// The actual file operation pattern.
- pub pattern: FileOperationPattern,
-}
-
-/// A pattern kind describing if a glob pattern matches a file a folder or
-/// both.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum FileOperationPatternKind {
- /// The pattern matches a file only.
- File,
-
- /// The pattern matches a folder only.
- Folder,
-}
-
-/// Matching options for the file operation pattern.
-///
-/// @since 3.16.0
-///
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileOperationPatternOptions {
- /// The pattern should be matched ignoring casing.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub ignore_case: Option<bool>,
-}
-
-/// A pattern to describe in which file operation requests or notifications
-/// the server is interested in.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileOperationPattern {
- /// The glob pattern to match. Glob patterns can have the following syntax:
- /// - `*` to match one or more characters in a path segment
- /// - `?` to match on one character in a path segment
- /// - `**` to match any number of path segments, including none
- /// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript
- /// and JavaScript files)
- /// - `[]` to declare a range of characters to match in a path segment
- /// (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
- /// - `[!...]` to negate a range of characters to match in a path segment
- /// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
- /// not `example.0`)
- pub glob: String,
-
- /// Whether to match files or folders with this pattern.
- ///
- /// Matches both if undefined.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub matches: Option<FileOperationPatternKind>,
-
- /// Additional options used during matching.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub options: Option<FileOperationPatternOptions>,
-}
-
-/// The parameters sent in notifications/requests for user-initiated creation
-/// of files.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateFilesParams {
- /// An array of all files/folders created in this operation.
- pub files: Vec<FileCreate>,
-}
-/// Represents information on a file/folder create.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileCreate {
- /// A file:// URI for the location of the file/folder being created.
- pub uri: String,
-}
-
-/// The parameters sent in notifications/requests for user-initiated renames
-/// of files.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameFilesParams {
- /// An array of all files/folders renamed in this operation. When a folder
- /// is renamed, only the folder will be included, and not its children.
- pub files: Vec<FileRename>,
-}
-
-/// Represents information on a file/folder rename.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileRename {
- /// A file:// URI for the original location of the file/folder being renamed.
- pub old_uri: String,
-
- /// A file:// URI for the new location of the file/folder being renamed.
- pub new_uri: String,
-}
-
-/// The parameters sent in notifications/requests for user-initiated deletes
-/// of files.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeleteFilesParams {
- /// An array of all files/folders deleted in this operation.
- pub files: Vec<FileDelete>,
-}
-
-/// Represents information on a file/folder delete.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileDelete {
- /// A file:// URI for the location of the file/folder being deleted.
- pub uri: String,
-}
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceFileOperationsClientCapabilities {
+ /// Whether the client supports dynamic registration for file
+ /// requests/notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client has support for sending didCreateFiles notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_create: Option<bool>,
+
+ /// The server is interested in receiving willCreateFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_create: Option<bool>,
+
+ /// The server is interested in receiving didRenameFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_rename: Option<bool>,
+
+ /// The server is interested in receiving willRenameFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_rename: Option<bool>,
+
+ /// The server is interested in receiving didDeleteFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_delete: Option<bool>,
+
+ /// The server is interested in receiving willDeleteFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_delete: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceFileOperationsServerCapabilities {
+ /// The server is interested in receiving didCreateFiles
+ /// notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_create: Option<FileOperationRegistrationOptions>,
+
+ /// The server is interested in receiving willCreateFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_create: Option<FileOperationRegistrationOptions>,
+
+ /// The server is interested in receiving didRenameFiles
+ /// notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_rename: Option<FileOperationRegistrationOptions>,
+
+ /// The server is interested in receiving willRenameFiles requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_rename: Option<FileOperationRegistrationOptions>,
+
+ /// The server is interested in receiving didDeleteFiles file
+ /// notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_delete: Option<FileOperationRegistrationOptions>,
+
+ /// The server is interested in receiving willDeleteFiles file
+ /// requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_delete: Option<FileOperationRegistrationOptions>,
+}
+
+/// The options to register for file operations.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileOperationRegistrationOptions {
+ /// The actual filters.
+ pub filters: Vec<FileOperationFilter>,
+}
+
+/// A filter to describe in which file operation requests or notifications
+/// the server is interested in.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileOperationFilter {
+ /// A Uri like `file` or `untitled`.
+ pub scheme: Option<String>,
+
+ /// The actual file operation pattern.
+ pub pattern: FileOperationPattern,
+}
+
+/// A pattern kind describing if a glob pattern matches a file a folder or
+/// both.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum FileOperationPatternKind {
+ /// The pattern matches a file only.
+ File,
+
+ /// The pattern matches a folder only.
+ Folder,
+}
+
+/// Matching options for the file operation pattern.
+///
+/// @since 3.16.0
+///
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileOperationPatternOptions {
+ /// The pattern should be matched ignoring casing.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ignore_case: Option<bool>,
+}
+
+/// A pattern to describe in which file operation requests or notifications
+/// the server is interested in.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileOperationPattern {
+ /// The glob pattern to match. Glob patterns can have the following syntax:
+ /// - `*` to match one or more characters in a path segment
+ /// - `?` to match on one character in a path segment
+ /// - `**` to match any number of path segments, including none
+ /// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript
+ /// and JavaScript files)
+ /// - `[]` to declare a range of characters to match in a path segment
+ /// (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+ /// - `[!...]` to negate a range of characters to match in a path segment
+ /// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
+ /// not `example.0`)
+ pub glob: String,
+
+ /// Whether to match files or folders with this pattern.
+ ///
+ /// Matches both if undefined.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub matches: Option<FileOperationPatternKind>,
+
+ /// Additional options used during matching.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub options: Option<FileOperationPatternOptions>,
+}
+
+/// The parameters sent in notifications/requests for user-initiated creation
+/// of files.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateFilesParams {
+ /// An array of all files/folders created in this operation.
+ pub files: Vec<FileCreate>,
+}
+/// Represents information on a file/folder create.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileCreate {
+ /// A file:// URI for the location of the file/folder being created.
+ pub uri: String,
+}
+
+/// The parameters sent in notifications/requests for user-initiated renames
+/// of files.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameFilesParams {
+ /// An array of all files/folders renamed in this operation. When a folder
+ /// is renamed, only the folder will be included, and not its children.
+ pub files: Vec<FileRename>,
+}
+
+/// Represents information on a file/folder rename.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileRename {
+ /// A file:// URI for the original location of the file/folder being renamed.
+ pub old_uri: String,
+
+ /// A file:// URI for the new location of the file/folder being renamed.
+ pub new_uri: String,
+}
+
+/// The parameters sent in notifications/requests for user-initiated deletes
+/// of files.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeleteFilesParams {
+ /// An array of all files/folders deleted in this operation.
+ pub files: Vec<FileDelete>,
+}
+
+/// Represents information on a file/folder delete.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileDelete {
+ /// A file:// URI for the location of the file/folder being deleted.
+ pub uri: String,
+}
diff --git a/vendor/lsp-types/src/folding_range.rs b/vendor/lsp-types/src/folding_range.rs
index 60adaaa18..d3cd01f4f 100644
--- a/vendor/lsp-types/src/folding_range.rs
+++ b/vendor/lsp-types/src/folding_range.rs
@@ -1,102 +1,144 @@
-use crate::{
- PartialResultParams, StaticTextDocumentColorProviderOptions, TextDocumentIdentifier,
- WorkDoneProgressParams,
-};
-use serde::{Deserialize, Serialize};
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FoldingRangeParams {
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum FoldingRangeProviderCapability {
- Simple(bool),
- FoldingProvider(FoldingProviderOptions),
- Options(StaticTextDocumentColorProviderOptions),
-}
-
-impl From<StaticTextDocumentColorProviderOptions> for FoldingRangeProviderCapability {
- fn from(from: StaticTextDocumentColorProviderOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<FoldingProviderOptions> for FoldingRangeProviderCapability {
- fn from(from: FoldingProviderOptions) -> Self {
- Self::FoldingProvider(from)
- }
-}
-
-impl From<bool> for FoldingRangeProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct FoldingProviderOptions {}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FoldingRangeClientCapabilities {
- /// Whether implementation supports dynamic registration for folding range providers. If this is set to `true`
- /// the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- /// return value for the corresponding server capability as well.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The maximum number of folding ranges that the client prefers to receive per document. The value serves as a
- /// hint, servers are free to follow the limit.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range_limit: Option<u32>,
- /// If set, the client signals that it only supports folding complete lines. If set, client will
- /// ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub line_folding_only: Option<bool>,
-}
-
-/// Enum of known range kinds
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum FoldingRangeKind {
- /// Folding range for a comment
- Comment,
- /// Folding range for a imports or includes
- Imports,
- /// Folding range for a region (e.g. `#region`)
- Region,
-}
-
-/// Represents a folding range.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FoldingRange {
- /// The zero-based line number from where the folded range starts.
- pub start_line: u32,
-
- /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub start_character: Option<u32>,
-
- /// The zero-based line number where the folded range ends.
- pub end_line: u32,
-
- /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub end_character: Option<u32>,
-
- /// Describes the kind of the folding range such as `comment' or 'region'. The kind
- /// is used to categorize folding ranges and used by commands like 'Fold all comments'. See
- /// [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<FoldingRangeKind>,
-}
+use crate::{
+ PartialResultParams, StaticTextDocumentColorProviderOptions, TextDocumentIdentifier,
+ WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FoldingRangeParams {
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum FoldingRangeProviderCapability {
+ Simple(bool),
+ FoldingProvider(FoldingProviderOptions),
+ Options(StaticTextDocumentColorProviderOptions),
+}
+
+impl From<StaticTextDocumentColorProviderOptions> for FoldingRangeProviderCapability {
+ fn from(from: StaticTextDocumentColorProviderOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<FoldingProviderOptions> for FoldingRangeProviderCapability {
+ fn from(from: FoldingProviderOptions) -> Self {
+ Self::FoldingProvider(from)
+ }
+}
+
+impl From<bool> for FoldingRangeProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct FoldingProviderOptions {}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FoldingRangeKindCapability {
+ /// The folding range kind values the client supports. When this
+ /// property exists the client also guarantees that it will
+ /// handle values outside its set gracefully and falls back
+ /// to a default value when unknown.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub value_set: Option<Vec<FoldingRangeKind>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FoldingRangeCapability {
+ /// If set, the client signals that it supports setting collapsedText on
+ /// folding ranges to display custom labels instead of the default text.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub collapsed_text: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FoldingRangeClientCapabilities {
+ /// Whether implementation supports dynamic registration for folding range providers. If this is set to `true`
+ /// the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+ /// return value for the corresponding server capability as well.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The maximum number of folding ranges that the client prefers to receive per document. The value serves as a
+ /// hint, servers are free to follow the limit.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range_limit: Option<u32>,
+
+ /// If set, the client signals that it only supports folding complete lines. If set, client will
+ /// ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub line_folding_only: Option<bool>,
+
+ /// Specific options for the folding range kind.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub folding_range_kind: Option<FoldingRangeKindCapability>,
+
+ /// Specific options for the folding range.
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub folding_range: Option<FoldingRangeCapability>,
+}
+
+/// Enum of known range kinds
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum FoldingRangeKind {
+ /// Folding range for a comment
+ Comment,
+ /// Folding range for a imports or includes
+ Imports,
+ /// Folding range for a region (e.g. `#region`)
+ Region,
+}
+
+/// Represents a folding range.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FoldingRange {
+ /// The zero-based line number from where the folded range starts.
+ pub start_line: u32,
+
+ /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub start_character: Option<u32>,
+
+ /// The zero-based line number where the folded range ends.
+ pub end_line: u32,
+
+ /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub end_character: Option<u32>,
+
+ /// Describes the kind of the folding range such as `comment' or 'region'. The kind
+ /// is used to categorize folding ranges and used by commands like 'Fold all comments'. See
+ /// [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<FoldingRangeKind>,
+
+ /// The text that the client should show when the specified range is
+ /// collapsed. If not defined or not supported by the client, a default
+ /// will be chosen by the client.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub collapsed_text: Option<String>,
+}
diff --git a/vendor/lsp-types/src/formatting.rs b/vendor/lsp-types/src/formatting.rs
index 2fb5e6b63..4c9a5b45a 100644
--- a/vendor/lsp-types/src/formatting.rs
+++ b/vendor/lsp-types/src/formatting.rs
@@ -1,153 +1,153 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- DocumentSelector, DynamicRegistrationClientCapabilities, Range, TextDocumentIdentifier,
- TextDocumentPositionParams, WorkDoneProgressParams,
-};
-
-use std::collections::HashMap;
-
-pub type DocumentFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
-pub type DocumentRangeFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
-pub type DocumentOnTypeFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
-
-/// Format document on type options
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentOnTypeFormattingOptions {
- /// A character on which formatting should be triggered, like `}`.
- pub first_trigger_character: String,
-
- /// More trigger characters.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub more_trigger_character: Option<Vec<String>>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentFormattingParams {
- /// The document to format.
- pub text_document: TextDocumentIdentifier,
-
- /// The format options.
- pub options: FormattingOptions,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-/// Value-object describing what options formatting should use.
-#[derive(Debug, PartialEq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FormattingOptions {
- /// Size of a tab in spaces.
- pub tab_size: u32,
-
- /// Prefer spaces over tabs.
- pub insert_spaces: bool,
-
- /// Signature for further properties.
- #[serde(flatten)]
- pub properties: HashMap<String, FormattingProperty>,
-
- /// Trim trailing whitespaces on a line.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trim_trailing_whitespace: Option<bool>,
-
- /// Insert a newline character at the end of the file if one does not exist.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub insert_final_newline: Option<bool>,
-
- /// Trim all newlines after the final newline at the end of the file.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trim_final_newlines: Option<bool>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum FormattingProperty {
- Bool(bool),
- Number(i32),
- String(String),
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentRangeFormattingParams {
- /// The document to format.
- pub text_document: TextDocumentIdentifier,
-
- /// The range to format
- pub range: Range,
-
- /// The format options
- pub options: FormattingOptions,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentOnTypeFormattingParams {
- /// Text Document and Position fields.
- #[serde(flatten)]
- pub text_document_position: TextDocumentPositionParams,
-
- /// The character that has been typed.
- pub ch: String,
-
- /// The format options.
- pub options: FormattingOptions,
-}
-
-/// Extends TextDocumentRegistrationOptions
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentOnTypeFormattingRegistrationOptions {
- /// A document selector to identify the scope of the registration. If set to null
- /// the document selector provided on the client side will be used.
- pub document_selector: Option<DocumentSelector>,
-
- /// A character on which formatting should be triggered, like `}`.
- pub first_trigger_character: String,
-
- /// More trigger characters.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub more_trigger_character: Option<Vec<String>>,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::tests::test_serialization;
-
- #[test]
- fn formatting_options() {
- test_serialization(
- &FormattingOptions {
- tab_size: 123,
- insert_spaces: true,
- properties: HashMap::new(),
- trim_trailing_whitespace: None,
- insert_final_newline: None,
- trim_final_newlines: None,
- },
- r#"{"tabSize":123,"insertSpaces":true}"#,
- );
-
- test_serialization(
- &FormattingOptions {
- tab_size: 123,
- insert_spaces: true,
- properties: vec![("prop".to_string(), FormattingProperty::Number(1))]
- .into_iter()
- .collect(),
- trim_trailing_whitespace: None,
- insert_final_newline: None,
- trim_final_newlines: None,
- },
- r#"{"tabSize":123,"insertSpaces":true,"prop":1}"#,
- );
- }
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ DocumentSelector, DynamicRegistrationClientCapabilities, Range, TextDocumentIdentifier,
+ TextDocumentPositionParams, WorkDoneProgressParams,
+};
+
+use std::collections::HashMap;
+
+pub type DocumentFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
+pub type DocumentRangeFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
+pub type DocumentOnTypeFormattingClientCapabilities = DynamicRegistrationClientCapabilities;
+
+/// Format document on type options
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentOnTypeFormattingOptions {
+ /// A character on which formatting should be triggered, like `}`.
+ pub first_trigger_character: String,
+
+ /// More trigger characters.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub more_trigger_character: Option<Vec<String>>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentFormattingParams {
+ /// The document to format.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The format options.
+ pub options: FormattingOptions,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+/// Value-object describing what options formatting should use.
+#[derive(Debug, PartialEq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FormattingOptions {
+ /// Size of a tab in spaces.
+ pub tab_size: u32,
+
+ /// Prefer spaces over tabs.
+ pub insert_spaces: bool,
+
+ /// Signature for further properties.
+ #[serde(flatten)]
+ pub properties: HashMap<String, FormattingProperty>,
+
+ /// Trim trailing whitespaces on a line.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trim_trailing_whitespace: Option<bool>,
+
+ /// Insert a newline character at the end of the file if one does not exist.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub insert_final_newline: Option<bool>,
+
+ /// Trim all newlines after the final newline at the end of the file.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trim_final_newlines: Option<bool>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum FormattingProperty {
+ Bool(bool),
+ Number(i32),
+ String(String),
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentRangeFormattingParams {
+ /// The document to format.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The range to format
+ pub range: Range,
+
+ /// The format options
+ pub options: FormattingOptions,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentOnTypeFormattingParams {
+ /// Text Document and Position fields.
+ #[serde(flatten)]
+ pub text_document_position: TextDocumentPositionParams,
+
+ /// The character that has been typed.
+ pub ch: String,
+
+ /// The format options.
+ pub options: FormattingOptions,
+}
+
+/// Extends TextDocumentRegistrationOptions
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentOnTypeFormattingRegistrationOptions {
+ /// A document selector to identify the scope of the registration. If set to null
+ /// the document selector provided on the client side will be used.
+ pub document_selector: Option<DocumentSelector>,
+
+ /// A character on which formatting should be triggered, like `}`.
+ pub first_trigger_character: String,
+
+ /// More trigger characters.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub more_trigger_character: Option<Vec<String>>,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::test_serialization;
+
+ #[test]
+ fn formatting_options() {
+ test_serialization(
+ &FormattingOptions {
+ tab_size: 123,
+ insert_spaces: true,
+ properties: HashMap::new(),
+ trim_trailing_whitespace: None,
+ insert_final_newline: None,
+ trim_final_newlines: None,
+ },
+ r#"{"tabSize":123,"insertSpaces":true}"#,
+ );
+
+ test_serialization(
+ &FormattingOptions {
+ tab_size: 123,
+ insert_spaces: true,
+ properties: vec![("prop".to_string(), FormattingProperty::Number(1))]
+ .into_iter()
+ .collect(),
+ trim_trailing_whitespace: None,
+ insert_final_newline: None,
+ trim_final_newlines: None,
+ },
+ r#"{"tabSize":123,"insertSpaces":true,"prop":1}"#,
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/hover.rs b/vendor/lsp-types/src/hover.rs
index 01bd2f8d1..4c94055e6 100644
--- a/vendor/lsp-types/src/hover.rs
+++ b/vendor/lsp-types/src/hover.rs
@@ -1,86 +1,86 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- MarkedString, MarkupContent, MarkupKind, Range, TextDocumentPositionParams,
- TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct HoverClientCapabilities {
- /// Whether completion supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Client supports the follow content formats for the content
- /// property. The order describes the preferred format of the client.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub content_format: Option<Vec<MarkupKind>>,
-}
-
-/// Hover options.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct HoverOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct HoverRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub hover_options: HoverOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum HoverProviderCapability {
- Simple(bool),
- Options(HoverOptions),
-}
-
-impl From<HoverOptions> for HoverProviderCapability {
- fn from(from: HoverOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for HoverProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct HoverParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-/// The result of a hover request.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct Hover {
- /// The hover's content
- pub contents: HoverContents,
- /// An optional range is a range inside a text document
- /// that is used to visualize a hover, e.g. by changing the background color.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range: Option<Range>,
-}
-
-/// Hover contents could be single entry or multiple entries.
-#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum HoverContents {
- Scalar(MarkedString),
- Array(Vec<MarkedString>),
- Markup(MarkupContent),
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ MarkedString, MarkupContent, MarkupKind, Range, TextDocumentPositionParams,
+ TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct HoverClientCapabilities {
+ /// Whether completion supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Client supports the follow content formats for the content
+ /// property. The order describes the preferred format of the client.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub content_format: Option<Vec<MarkupKind>>,
+}
+
+/// Hover options.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct HoverOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct HoverRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub hover_options: HoverOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum HoverProviderCapability {
+ Simple(bool),
+ Options(HoverOptions),
+}
+
+impl From<HoverOptions> for HoverProviderCapability {
+ fn from(from: HoverOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for HoverProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct HoverParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+/// The result of a hover request.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct Hover {
+ /// The hover's content
+ pub contents: HoverContents,
+ /// An optional range is a range inside a text document
+ /// that is used to visualize a hover, e.g. by changing the background color.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range: Option<Range>,
+}
+
+/// Hover contents could be single entry or multiple entries.
+#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum HoverContents {
+ Scalar(MarkedString),
+ Array(Vec<MarkedString>),
+ Markup(MarkupContent),
+}
diff --git a/vendor/lsp-types/src/inlay_hint.rs b/vendor/lsp-types/src/inlay_hint.rs
index c1482c907..cdc9a0b70 100644
--- a/vendor/lsp-types/src/inlay_hint.rs
+++ b/vendor/lsp-types/src/inlay_hint.rs
@@ -1,279 +1,281 @@
-#![cfg(feature = "proposed")]
-
-use crate::{
- Command, LSPAny, Location, MarkupContent, Position, Range, StaticRegistrationOptions,
- TextDocumentIdentifier, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions,
- WorkDoneProgressParams,
-};
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum InlayHintServerCapabilities {
- Options(InlayHintOptions),
- RegistrationOptions(InlayHintRegistrationOptions),
-}
-
-/// Inlay hint client capabilities.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintClientCapabilities {
- /// Whether inlay hints support dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Indicates which properties a client can resolve lazily on a inlay
- /// hint.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_support: Option<InlayHintResolveClientCapabilities>,
-}
-
-/// Inlay hint options used during static registration.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-
- /// The server provides support to resolve additional
- /// information for an inlay hint item.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resolve_provider: Option<bool>,
-}
-
-/// Inlay hint options used during static or dynamic registration.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintRegistrationOptions {
- #[serde(flatten)]
- pub inlay_hint_options: InlayHintOptions,
-
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub static_registration_options: StaticRegistrationOptions,
-}
-
-/// A parameter literal used in inlay hint requests.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintParams {
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The visible document range for which inlay hints should be computed.
- pub range: Range,
-}
-
-/// Inlay hint information.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHint {
- /// The position of this hint.
- pub position: Position,
-
- /// The label of this hint. A human readable string or an array of
- /// InlayHintLabelPart label parts.
- ///
- /// *Note* that neither the string nor the label part can be empty.
- pub label: InlayHintLabel,
-
- /// The kind of this hint. Can be omitted in which case the client
- /// should fall back to a reasonable default.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<InlayHintKind>,
-
- /// Optional text edits that are performed when accepting this inlay hint.
- ///
- /// *Note* that edits are expected to change the document so that the inlay
- /// hint (or its nearest variant) is now part of the document and the inlay
- /// hint itself is now obsolete.
- ///
- /// Depending on the client capability `inlayHint.resolveSupport` clients
- /// might resolve this property late using the resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text_edits: Option<Vec<TextEdit>>,
-
- /// The tooltip text when you hover over this item.
- ///
- /// Depending on the client capability `inlayHint.resolveSupport` clients
- /// might resolve this property late using the resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tooltip: Option<InlayHintTooltip>,
-
- /// Render padding before the hint.
- ///
- /// Note: Padding should use the editor's background color, not the
- /// background color of the hint itself. That means padding can be used
- /// to visually align/separate an inlay hint.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub padding_left: Option<bool>,
-
- /// Render padding after the hint.
- ///
- /// Note: Padding should use the editor's background color, not the
- /// background color of the hint itself. That means padding can be used
- /// to visually align/separate an inlay hint.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub padding_right: Option<bool>,
-
- /// A data entry field that is preserved on a inlay hint between
- /// a `textDocument/inlayHint` and a `inlayHint/resolve` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<LSPAny>,
-}
-
-#[derive(Debug, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum InlayHintLabel {
- String(String),
- LabelParts(Vec<InlayHintLabelPart>),
-}
-
-impl From<String> for InlayHintLabel {
- #[inline]
- fn from(from: String) -> Self {
- Self::String(from)
- }
-}
-
-impl From<Vec<InlayHintLabelPart>> for InlayHintLabel {
- #[inline]
- fn from(from: Vec<InlayHintLabelPart>) -> Self {
- Self::LabelParts(from)
- }
-}
-
-#[derive(Debug, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum InlayHintTooltip {
- String(String),
- MarkupContent(MarkupContent),
-}
-
-impl From<String> for InlayHintTooltip {
- #[inline]
- fn from(from: String) -> Self {
- Self::String(from)
- }
-}
-
-impl From<MarkupContent> for InlayHintTooltip {
- #[inline]
- fn from(from: MarkupContent) -> Self {
- Self::MarkupContent(from)
- }
-}
-
-/// An inlay hint label part allows for interactive and composite labels
-/// of inlay hints.
-#[derive(Debug, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintLabelPart {
- /// The value of this label part.
- pub value: String,
-
- /// The tooltip text when you hover over this label part. Depending on
- /// the client capability `inlayHint.resolveSupport` clients might resolve
- /// this property late using the resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tooltip: Option<InlayHintLabelPartTooltip>,
-
- /// An optional source code location that represents this
- /// label part.
- ///
- /// The editor will use this location for the hover and for code navigation
- /// features: This part will become a clickable link that resolves to the
- /// definition of the symbol at the given location (not necessarily the
- /// location itself), it shows the hover that shows at the given location,
- /// and it shows a context menu with further code navigation commands.
- ///
- /// Depending on the client capability `inlayHint.resolveSupport` clients
- /// might resolve this property late using the resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub location: Option<Location>,
-
- /// An optional command for this label part.
- ///
- /// Depending on the client capability `inlayHint.resolveSupport` clients
- /// might resolve this property late using the resolve request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub command: Option<Command>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum InlayHintLabelPartTooltip {
- String(String),
- MarkupContent(MarkupContent),
-}
-
-impl From<String> for InlayHintLabelPartTooltip {
- #[inline]
- fn from(from: String) -> Self {
- Self::String(from)
- }
-}
-
-impl From<MarkupContent> for InlayHintLabelPartTooltip {
- #[inline]
- fn from(from: MarkupContent) -> Self {
- Self::MarkupContent(from)
- }
-}
-
-/// Inlay hint kinds.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct InlayHintKind(i32);
-lsp_enum! {
-impl InlayHintKind {
- /// An inlay hint that for a type annotation.
- pub const TYPE: InlayHintKind = InlayHintKind(1);
-
- /// An inlay hint that is for a parameter.
- pub const PARAMETER: InlayHintKind = InlayHintKind(2);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintResolveClientCapabilities {
- pub properties: Vec<String>,
-}
-
-/// Client workspace capabilities specific to inlay hints.
-///
-/// @since 3.17.0 - proposed state
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InlayHintWorkspaceClientCapabilities {
- /// Whether the client implementation supports a refresh request sent from
- /// the server to the client.
- ///
- /// Note that this event is global and will force the client to refresh all
- /// inlay hints currently shown. It should be used with absolute care and
- /// is useful for situation where a server for example detects a project wide
- /// change that requires such a calculation.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub refresh_support: Option<bool>,
-}
-
-// TODO(sno2): add tests once stabilized
+use crate::{
+ Command, LSPAny, Location, MarkupContent, Position, Range, StaticRegistrationOptions,
+ TextDocumentIdentifier, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions,
+ WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum InlayHintServerCapabilities {
+ Options(InlayHintOptions),
+ RegistrationOptions(InlayHintRegistrationOptions),
+}
+
+/// Inlay hint client capabilities.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintClientCapabilities {
+ /// Whether inlay hints support dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Indicates which properties a client can resolve lazily on a inlay
+ /// hint.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_support: Option<InlayHintResolveClientCapabilities>,
+}
+
+/// Inlay hint options used during static registration.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+
+ /// The server provides support to resolve additional
+ /// information for an inlay hint item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+}
+
+/// Inlay hint options used during static or dynamic registration.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintRegistrationOptions {
+ #[serde(flatten)]
+ pub inlay_hint_options: InlayHintOptions,
+
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+/// A parameter literal used in inlay hint requests.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintParams {
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The visible document range for which inlay hints should be computed.
+ pub range: Range,
+}
+
+/// Inlay hint information.
+///
+/// @since 3.17.0
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHint {
+ /// The position of this hint.
+ pub position: Position,
+
+ /// The label of this hint. A human readable string or an array of
+ /// InlayHintLabelPart label parts.
+ ///
+ /// *Note* that neither the string nor the label part can be empty.
+ pub label: InlayHintLabel,
+
+ /// The kind of this hint. Can be omitted in which case the client
+ /// should fall back to a reasonable default.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<InlayHintKind>,
+
+ /// Optional text edits that are performed when accepting this inlay hint.
+ ///
+ /// *Note* that edits are expected to change the document so that the inlay
+ /// hint (or its nearest variant) is now part of the document and the inlay
+ /// hint itself is now obsolete.
+ ///
+ /// Depending on the client capability `inlayHint.resolveSupport` clients
+ /// might resolve this property late using the resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text_edits: Option<Vec<TextEdit>>,
+
+ /// The tooltip text when you hover over this item.
+ ///
+ /// Depending on the client capability `inlayHint.resolveSupport` clients
+ /// might resolve this property late using the resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tooltip: Option<InlayHintTooltip>,
+
+ /// Render padding before the hint.
+ ///
+ /// Note: Padding should use the editor's background color, not the
+ /// background color of the hint itself. That means padding can be used
+ /// to visually align/separate an inlay hint.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub padding_left: Option<bool>,
+
+ /// Render padding after the hint.
+ ///
+ /// Note: Padding should use the editor's background color, not the
+ /// background color of the hint itself. That means padding can be used
+ /// to visually align/separate an inlay hint.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub padding_right: Option<bool>,
+
+ /// A data entry field that is preserved on a inlay hint between
+ /// a `textDocument/inlayHint` and a `inlayHint/resolve` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<LSPAny>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlayHintLabel {
+ String(String),
+ LabelParts(Vec<InlayHintLabelPart>),
+}
+
+impl From<String> for InlayHintLabel {
+ #[inline]
+ fn from(from: String) -> Self {
+ Self::String(from)
+ }
+}
+
+impl From<Vec<InlayHintLabelPart>> for InlayHintLabel {
+ #[inline]
+ fn from(from: Vec<InlayHintLabelPart>) -> Self {
+ Self::LabelParts(from)
+ }
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlayHintTooltip {
+ String(String),
+ MarkupContent(MarkupContent),
+}
+
+impl From<String> for InlayHintTooltip {
+ #[inline]
+ fn from(from: String) -> Self {
+ Self::String(from)
+ }
+}
+
+impl From<MarkupContent> for InlayHintTooltip {
+ #[inline]
+ fn from(from: MarkupContent) -> Self {
+ Self::MarkupContent(from)
+ }
+}
+
+/// An inlay hint label part allows for interactive and composite labels
+/// of inlay hints.
+#[derive(Debug, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintLabelPart {
+ /// The value of this label part.
+ pub value: String,
+
+ /// The tooltip text when you hover over this label part. Depending on
+ /// the client capability `inlayHint.resolveSupport` clients might resolve
+ /// this property late using the resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tooltip: Option<InlayHintLabelPartTooltip>,
+
+ /// An optional source code location that represents this
+ /// label part.
+ ///
+ /// The editor will use this location for the hover and for code navigation
+ /// features: This part will become a clickable link that resolves to the
+ /// definition of the symbol at the given location (not necessarily the
+ /// location itself), it shows the hover that shows at the given location,
+ /// and it shows a context menu with further code navigation commands.
+ ///
+ /// Depending on the client capability `inlayHint.resolveSupport` clients
+ /// might resolve this property late using the resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub location: Option<Location>,
+
+ /// An optional command for this label part.
+ ///
+ /// Depending on the client capability `inlayHint.resolveSupport` clients
+ /// might resolve this property late using the resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub command: Option<Command>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlayHintLabelPartTooltip {
+ String(String),
+ MarkupContent(MarkupContent),
+}
+
+impl From<String> for InlayHintLabelPartTooltip {
+ #[inline]
+ fn from(from: String) -> Self {
+ Self::String(from)
+ }
+}
+
+impl From<MarkupContent> for InlayHintLabelPartTooltip {
+ #[inline]
+ fn from(from: MarkupContent) -> Self {
+ Self::MarkupContent(from)
+ }
+}
+
+/// Inlay hint kinds.
+///
+/// @since 3.17.0
+#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct InlayHintKind(i32);
+lsp_enum! {
+impl InlayHintKind {
+ /// An inlay hint that for a type annotation.
+ pub const TYPE: InlayHintKind = InlayHintKind(1);
+
+ /// An inlay hint that is for a parameter.
+ pub const PARAMETER: InlayHintKind = InlayHintKind(2);
+}
+}
+
+/// Inlay hint client capabilities.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintResolveClientCapabilities {
+ /// The properties that a client can resolve lazily.
+ pub properties: Vec<String>,
+}
+
+/// Client workspace capabilities specific to inlay hints.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintWorkspaceClientCapabilities {
+ /// Whether the client implementation supports a refresh request sent from
+ /// the server to the client.
+ ///
+ /// Note that this event is global and will force the client to refresh all
+ /// inlay hints currently shown. It should be used with absolute care and
+ /// is useful for situation where a server for example detects a project wide
+ /// change that requires such a calculation.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub refresh_support: Option<bool>,
+}
+
+// TODO(sno2): add tests once stabilized
diff --git a/vendor/lsp-types/src/inline_value.rs b/vendor/lsp-types/src/inline_value.rs
new file mode 100644
index 000000000..35dae188f
--- /dev/null
+++ b/vendor/lsp-types/src/inline_value.rs
@@ -0,0 +1,217 @@
+use crate::{
+ DynamicRegistrationClientCapabilities, Range, StaticRegistrationOptions,
+ TextDocumentIdentifier, TextDocumentRegistrationOptions, WorkDoneProgressOptions,
+ WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+
+pub type InlineValueClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlineValueServerCapabilities {
+ Options(InlineValueOptions),
+ RegistrationOptions(InlineValueRegistrationOptions),
+}
+
+/// Inline value options used during static registration.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct InlineValueOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+/// Inline value options used during static or dynamic registration.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct InlineValueRegistrationOptions {
+ #[serde(flatten)]
+ pub inline_value_options: InlineValueOptions,
+
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+/// A parameter literal used in inline value requests.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlineValueParams {
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The document range for which inline values should be computed.
+ pub range: Range,
+
+ /// Additional information about the context in which inline values were
+ /// requested.
+ pub context: InlineValueContext,
+}
+
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlineValueContext {
+ /// The stack frame (as a DAP Id) where the execution has stopped.
+ pub frame_id: i32,
+
+ /// The document range where execution has stopped.
+ /// Typically the end position of the range denotes the line where the
+ /// inline values are shown.
+ pub stopped_location: Range,
+}
+
+/// Provide inline value as text.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct InlineValueText {
+ /// The document range for which the inline value applies.
+ pub range: Range,
+
+ /// The text of the inline value.
+ pub text: String,
+}
+
+/// Provide inline value through a variable lookup.
+///
+/// If only a range is specified, the variable name will be extracted from
+/// the underlying document.
+///
+/// An optional variable name can be used to override the extracted name.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlineValueVariableLookup {
+ /// The document range for which the inline value applies.
+ /// The range is used to extract the variable name from the underlying
+ /// document.
+ pub range: Range,
+
+ /// If specified the name of the variable to look up.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub variable_name: Option<String>,
+
+ /// How to perform the lookup.
+ pub case_sensitive_lookup: bool,
+}
+
+/// Provide an inline value through an expression evaluation.
+///
+/// If only a range is specified, the expression will be extracted from the
+/// underlying document.
+///
+/// An optional expression can be used to override the extracted expression.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlineValueEvaluatableExpression {
+ /// The document range for which the inline value applies.
+ /// The range is used to extract the evaluatable expression from the
+ /// underlying document.
+ pub range: Range,
+
+ /// If specified the expression overrides the extracted expression.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub expression: Option<String>,
+}
+
+/// Inline value information can be provided by different means:
+/// - directly as a text value (class InlineValueText).
+/// - as a name to use for a variable lookup (class InlineValueVariableLookup)
+/// - as an evaluatable expression (class InlineValueEvaluatableExpression)
+/// The InlineValue types combines all inline value types into one type.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlineValue {
+ Text(InlineValueText),
+ VariableLookup(InlineValueVariableLookup),
+ EvaluatableExpression(InlineValueEvaluatableExpression),
+}
+
+impl From<InlineValueText> for InlineValue {
+ #[inline]
+ fn from(from: InlineValueText) -> Self {
+ Self::Text(from)
+ }
+}
+
+impl From<InlineValueVariableLookup> for InlineValue {
+ #[inline]
+ fn from(from: InlineValueVariableLookup) -> Self {
+ Self::VariableLookup(from)
+ }
+}
+
+impl From<InlineValueEvaluatableExpression> for InlineValue {
+ #[inline]
+ fn from(from: InlineValueEvaluatableExpression) -> Self {
+ Self::EvaluatableExpression(from)
+ }
+}
+
+/// Client workspace capabilities specific to inline values.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+///
+/// @since 3.17.0
+#[serde(rename_all = "camelCase")]
+pub struct InlineValueWorkspaceClientCapabilities {
+ /// Whether the client implementation supports a refresh request sent from
+ /// the server to the client.
+ ///
+ /// Note that this event is global and will force the client to refresh all
+ /// inline values currently shown. It should be used with absolute care and
+ /// is useful for situation where a server for example detect a project wide
+ /// change that requires such a calculation.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub refresh_support: Option<bool>,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::test_serialization;
+ use crate::Position;
+
+ #[test]
+ fn inline_values() {
+ test_serialization(
+ &InlineValueText {
+ range: Range::new(Position::new(0, 0), Position::new(0, 4)),
+ text: "one".to_owned(),
+ },
+ r#"{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":4}},"text":"one"}"#,
+ );
+
+ test_serialization(
+ &InlineValue::VariableLookup(InlineValueVariableLookup {
+ range: Range::new(Position::new(1, 0), Position::new(1, 4)),
+ variable_name: None,
+ case_sensitive_lookup: false,
+ }),
+ r#"{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":4}},"caseSensitiveLookup":false}"#,
+ );
+
+ test_serialization(
+ &InlineValue::EvaluatableExpression(InlineValueEvaluatableExpression {
+ range: Range::new(Position::new(2, 0), Position::new(2, 4)),
+ expression: None,
+ }),
+ r#"{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":4}}}"#,
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/lib.rs b/vendor/lsp-types/src/lib.rs
index 7469e67a6..027e9ef89 100644
--- a/vendor/lsp-types/src/lib.rs
+++ b/vendor/lsp-types/src/lib.rs
@@ -1,2692 +1,2798 @@
-/*!
-
-Language Server Protocol types for Rust.
-
-Based on: <https://microsoft.github.io/language-server-protocol/specification>
-
-This library uses the URL crate for parsing URIs. Note that there is
-some confusion on the meaning of URLs vs URIs:
-<http://stackoverflow.com/a/28865728/393898>. According to that
-information, on the classical sense of "URLs", "URLs" are a subset of
-URIs, But on the modern/new meaning of URLs, they are the same as
-URIs. The important take-away aspect is that the URL crate should be
-able to parse any URI, such as `urn:isbn:0451450523`.
-
-
-*/
-#![allow(non_upper_case_globals)]
-#[forbid(unsafe_code)]
-#[macro_use]
-extern crate bitflags;
-
-use std::{collections::HashMap, fmt::Debug};
-
-use serde::{de, de::Error as Error_, Deserialize, Serialize};
-use serde_json::Value;
-pub use url::Url;
-
-// Large enough to contain any enumeration name defined in this crate
-type PascalCaseBuf = [u8; 32];
-const fn fmt_pascal_case_const(name: &str) -> (PascalCaseBuf, usize) {
- let mut buf = [0; 32];
- let mut buf_i = 0;
- let mut name_i = 0;
- let name = name.as_bytes();
- while name_i < name.len() {
- let first = name[name_i];
- name_i += 1;
-
- buf[buf_i] = first;
- buf_i += 1;
-
- while name_i < name.len() {
- let rest = name[name_i];
- name_i += 1;
- if rest == b'_' {
- break;
- }
-
- buf[buf_i] = rest.to_ascii_lowercase();
- buf_i += 1;
- }
- }
- (buf, buf_i)
-}
-
-fn fmt_pascal_case(f: &mut std::fmt::Formatter<'_>, name: &str) -> std::fmt::Result {
- for word in name.split('_') {
- let mut chars = word.chars();
- let first = chars.next().unwrap();
- write!(f, "{}", first)?;
- for rest in chars {
- write!(f, "{}", rest.to_lowercase())?;
- }
- }
- Ok(())
-}
-
-macro_rules! lsp_enum {
- (impl $typ: ident { $( $(#[$attr:meta])* pub const $name: ident : $enum_type: ty = $value: expr; )* }) => {
- impl $typ {
- $(
- $(#[$attr])*
- pub const $name: $enum_type = $value;
- )*
- }
-
- impl std::fmt::Debug for $typ {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match *self {
- $(
- Self::$name => crate::fmt_pascal_case(f, stringify!($name)),
- )*
- _ => write!(f, "{}({})", stringify!($typ), self.0),
- }
- }
- }
-
- impl std::convert::TryFrom<&str> for $typ {
- type Error = &'static str;
- fn try_from(value: &str) -> Result<Self, Self::Error> {
- match () {
- $(
- _ if {
- const X: (crate::PascalCaseBuf, usize) = crate::fmt_pascal_case_const(stringify!($name));
- let (buf, len) = X;
- &buf[..len] == value.as_bytes()
- } => Ok(Self::$name),
- )*
- _ => Err("unknown enum variant"),
- }
- }
- }
-
- }
-}
-
-pub mod error_codes;
-pub mod notification;
-pub mod request;
-
-mod call_hierarchy;
-pub use call_hierarchy::*;
-
-mod code_action;
-pub use code_action::*;
-
-mod code_lens;
-pub use code_lens::*;
-
-mod color;
-pub use color::*;
-
-mod completion;
-pub use completion::*;
-
-mod document_highlight;
-pub use document_highlight::*;
-
-mod document_link;
-pub use document_link::*;
-
-mod document_symbols;
-pub use document_symbols::*;
-
-mod file_operations;
-pub use file_operations::*;
-
-mod folding_range;
-pub use folding_range::*;
-
-mod formatting;
-pub use formatting::*;
-
-mod hover;
-pub use hover::*;
-
-#[cfg(feature = "proposed")]
-mod inlay_hint;
-#[cfg(feature = "proposed")]
-pub use inlay_hint::*;
-
-mod moniker;
-pub use moniker::*;
-
-mod progress;
-pub use progress::*;
-
-mod references;
-pub use references::*;
-
-mod rename;
-pub use rename::*;
-
-pub mod selection_range;
-pub use selection_range::*;
-
-mod semantic_tokens;
-pub use semantic_tokens::*;
-
-mod signature_help;
-pub use signature_help::*;
-
-mod linked_editing;
-pub use linked_editing::*;
-
-mod window;
-pub use window::*;
-
-mod workspace_folders;
-pub use workspace_folders::*;
-
-mod workspace_symbols;
-pub use workspace_symbols::*;
-
-pub mod lsif;
-
-mod trace;
-pub use trace::*;
-
-/* ----------------- Auxiliary types ----------------- */
-
-#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum NumberOrString {
- Number(i32),
- String(String),
-}
-
-/* ----------------- Cancel support ----------------- */
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct CancelParams {
- /// The request id to cancel.
- pub id: NumberOrString,
-}
-
-/* ----------------- Basic JSON Structures ----------------- */
-
-/// The LSP any type
-///
-/// @since 3.17.0
-#[cfg(feature = "proposed")]
-pub type LSPAny = serde_json::Value;
-
-/// LSP object definition.
-///
-/// @since 3.17.0
-#[cfg(feature = "proposed")]
-pub type LSPObject = serde_json::Map<String, serde_json::Value>;
-
-/// LSP arrays.
-///
-/// @since 3.17.0
-#[cfg(feature = "proposed")]
-pub type LSPArray = Vec<serde_json::Value>;
-
-/// Position in a text document expressed as zero-based line and character offset.
-/// A position is between two characters like an 'insert' cursor in a editor.
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize)]
-pub struct Position {
- /// Line position in a document (zero-based).
- pub line: u32,
- /// Character offset on a line in a document (zero-based). The meaning of this
- /// offset is determined by the negotiated `PositionEncodingKind`.
- ///
- /// If the character value is greater than the line length it defaults back
- /// to the line length.
- pub character: u32,
-}
-
-impl Position {
- pub fn new(line: u32, character: u32) -> Position {
- Position { line, character }
- }
-}
-
-/// A range in a text document expressed as (zero-based) start and end positions.
-/// A range is comparable to a selection in an editor. Therefore the end position is exclusive.
-#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Deserialize, Serialize)]
-pub struct Range {
- /// The range's start position.
- pub start: Position,
- /// The range's end position.
- pub end: Position,
-}
-
-impl Range {
- pub fn new(start: Position, end: Position) -> Range {
- Range { start, end }
- }
-}
-
-/// Represents a location inside a resource, such as a line inside a text file.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct Location {
- pub uri: Url,
- pub range: Range,
-}
-
-impl Location {
- pub fn new(uri: Url, range: Range) -> Location {
- Location { uri, range }
- }
-}
-
-/// Represents a link between a source and a target location.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LocationLink {
- /// Span of the origin of this link.
- ///
- /// Used as the underlined span for mouse interaction. Defaults to the word range at
- /// the mouse position.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub origin_selection_range: Option<Range>,
-
- /// The target resource identifier of this link.
- pub target_uri: Url,
-
- /// The full target range of this link.
- pub target_range: Range,
-
- /// The span of this link.
- pub target_selection_range: Range,
-}
-
-/// A type indicating how positions are encoded,
-/// specifically what column offsets mean.
-///
-/// @since 3.17.0
-#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
-#[cfg(feature = "proposed")]
-pub struct PositionEncodingKind(std::borrow::Cow<'static, str>);
-
-#[cfg(feature = "proposed")]
-impl PositionEncodingKind {
- /// Character offsets count UTF-8 code units.
- pub const UTF8: PositionEncodingKind = PositionEncodingKind::new("utf-8");
-
- /// Character offsets count UTF-16 code units.
- ///
- /// This is the default and must always be supported
- /// by servers
- pub const UTF16: PositionEncodingKind = PositionEncodingKind::new("utf-16");
-
- /// Character offsets count UTF-32 code units.
- ///
- /// Implementation note: these are the same as Unicode code points,
- /// so this `PositionEncodingKind` may also be used for an
- /// encoding-agnostic representation of character offsets.
- pub const UTF32: PositionEncodingKind = PositionEncodingKind::new("utf-32");
-
- pub const fn new(tag: &'static str) -> Self {
- PositionEncodingKind(std::borrow::Cow::Borrowed(tag))
- }
-
- pub fn as_str(&self) -> &str {
- &self.0
- }
-}
-
-#[cfg(feature = "proposed")]
-impl From<String> for PositionEncodingKind {
- fn from(from: String) -> Self {
- PositionEncodingKind(std::borrow::Cow::from(from))
- }
-}
-
-#[cfg(feature = "proposed")]
-impl From<&'static str> for PositionEncodingKind {
- fn from(from: &'static str) -> Self {
- PositionEncodingKind::new(from)
- }
-}
-
-/// Represents a diagnostic, such as a compiler error or warning.
-/// Diagnostic objects are only valid in the scope of a resource.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Diagnostic {
- /// The range at which the message applies.
- pub range: Range,
-
- /// The diagnostic's severity. Can be omitted. If omitted it is up to the
- /// client to interpret diagnostics as error, warning, info or hint.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub severity: Option<DiagnosticSeverity>,
-
- /// The diagnostic's code. Can be omitted.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code: Option<NumberOrString>,
-
- /// An optional property to describe the error code.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_description: Option<CodeDescription>,
-
- /// A human-readable string describing the source of this
- /// diagnostic, e.g. 'typescript' or 'super lint'.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub source: Option<String>,
-
- /// The diagnostic's message.
- pub message: String,
-
- /// An array of related diagnostic information, e.g. when symbol-names within
- /// a scope collide all definitions can be marked via this property.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub related_information: Option<Vec<DiagnosticRelatedInformation>>,
-
- /// Additional metadata about the diagnostic.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tags: Option<Vec<DiagnosticTag>>,
-
- /// A data entry field that is preserved between a `textDocument/publishDiagnostics`
- /// notification and `textDocument/codeAction` request.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data: Option<serde_json::Value>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CodeDescription {
- pub href: Url,
-}
-
-impl Diagnostic {
- pub fn new(
- range: Range,
- severity: Option<DiagnosticSeverity>,
- code: Option<NumberOrString>,
- source: Option<String>,
- message: String,
- related_information: Option<Vec<DiagnosticRelatedInformation>>,
- tags: Option<Vec<DiagnosticTag>>,
- ) -> Diagnostic {
- Diagnostic {
- range,
- severity,
- code,
- source,
- message,
- related_information,
- tags,
- ..Diagnostic::default()
- }
- }
-
- pub fn new_simple(range: Range, message: String) -> Diagnostic {
- Self::new(range, None, None, None, message, None, None)
- }
-
- pub fn new_with_code_number(
- range: Range,
- severity: DiagnosticSeverity,
- code_number: i32,
- source: Option<String>,
- message: String,
- ) -> Diagnostic {
- let code = Some(NumberOrString::Number(code_number));
- Self::new(range, Some(severity), code, source, message, None, None)
- }
-}
-
-/// The protocol currently supports the following diagnostic severities:
-#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct DiagnosticSeverity(i32);
-lsp_enum! {
-impl DiagnosticSeverity {
- /// Reports an error.
- pub const ERROR: DiagnosticSeverity = DiagnosticSeverity(1);
- /// Reports a warning.
- pub const WARNING: DiagnosticSeverity = DiagnosticSeverity(2);
- /// Reports an information.
- pub const INFORMATION: DiagnosticSeverity = DiagnosticSeverity(3);
- /// Reports a hint.
- pub const HINT: DiagnosticSeverity = DiagnosticSeverity(4);
-}
-}
-
-/// Represents a related message and source code location for a diagnostic. This
-/// should be used to point to code locations that cause or related to a
-/// diagnostics, e.g when duplicating a symbol in a scope.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DiagnosticRelatedInformation {
- /// The location of this related diagnostic information.
- pub location: Location,
-
- /// The message of this related diagnostic information.
- pub message: String,
-}
-
-/// The diagnostic tags.
-#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct DiagnosticTag(i32);
-lsp_enum! {
-impl DiagnosticTag {
- /// Unused or unnecessary code.
- /// Clients are allowed to render diagnostics with this tag faded out instead of having
- /// an error squiggle.
- pub const UNNECESSARY: DiagnosticTag = DiagnosticTag(1);
-
- /// Deprecated or obsolete code.
- /// Clients are allowed to rendered diagnostics with this tag strike through.
- pub const DEPRECATED: DiagnosticTag = DiagnosticTag(2);
-}
-}
-
-/// Represents a reference to a command. Provides a title which will be used to represent a command in the UI.
-/// Commands are identitifed using a string identifier and the protocol currently doesn't specify a set of
-/// well known commands. So executing a command requires some tool extension code.
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct Command {
- /// Title of the command, like `save`.
- pub title: String,
- /// The identifier of the actual command handler.
- pub command: String,
- /// Arguments that the command handler should be
- /// invoked with.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub arguments: Option<Vec<Value>>,
-}
-
-impl Command {
- pub fn new(title: String, command: String, arguments: Option<Vec<Value>>) -> Command {
- Command {
- title,
- command,
- arguments,
- }
- }
-}
-
-/// A textual edit applicable to a text document.
-///
-/// If n `TextEdit`s are applied to a text document all text edits describe changes to the initial document version.
-/// Execution wise text edits should applied from the bottom to the top of the text document. Overlapping text edits
-/// are not supported.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextEdit {
- /// The range of the text document to be manipulated. To insert
- /// text into a document create a range where start === end.
- pub range: Range,
- /// The string to be inserted. For delete operations use an
- /// empty string.
- pub new_text: String,
-}
-
-impl TextEdit {
- pub fn new(range: Range, new_text: String) -> TextEdit {
- TextEdit { range, new_text }
- }
-}
-
-/// An identifier referring to a change annotation managed by a workspace
-/// edit.
-///
-/// @since 3.16.0.
-pub type ChangeAnnotationIdentifier = String;
-
-/// A special text edit with an additional change annotation.
-///
-/// @since 3.16.0.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct AnnotatedTextEdit {
- #[serde(flatten)]
- pub text_edit: TextEdit,
-
- /// The actual annotation
- pub annotation_id: ChangeAnnotationIdentifier,
-}
-
-/// Describes textual changes on a single text document. The text document is referred to as a
-/// `OptionalVersionedTextDocumentIdentifier` to allow clients to check the text document version before an
-/// edit is applied. A `TextDocumentEdit` describes all changes on a version Si and after they are
-/// applied move the document to version Si+1. So the creator of a `TextDocumentEdit` doesn't need to
-/// sort the array or do any kind of ordering. However the edits must be non overlapping.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentEdit {
- /// The text document to change.
- pub text_document: OptionalVersionedTextDocumentIdentifier,
-
- /// The edits to be applied.
- ///
- /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the
- /// client capability `workspace.workspaceEdit.changeAnnotationSupport`
- pub edits: Vec<OneOf<TextEdit, AnnotatedTextEdit>>,
-}
-
-/// Additional information that describes document changes.
-///
-/// @since 3.16.0.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ChangeAnnotation {
- /// A human-readable string describing the actual change. The string
- /// is rendered prominent in the user interface.
- pub label: String,
-
- /// A flag which indicates that user confirmation is needed
- /// before applying the change.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub needs_confirmation: Option<bool>,
-
- /// A human-readable string which is rendered less prominent in
- /// the user interface.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub description: Option<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ChangeAnnotationWorkspaceEditClientCapabilities {
- /// Whether the client groups edits with equal labels into tree nodes,
- /// for instance all edits labelled with "Changes in Strings" would
- /// be a tree node.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub groups_on_label: Option<bool>,
-}
-
-/// Options to create a file.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateFileOptions {
- /// Overwrite existing file. Overwrite wins over `ignoreIfExists`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub overwrite: Option<bool>,
- /// Ignore if exists.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub ignore_if_exists: Option<bool>,
-}
-
-/// Create file operation
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateFile {
- /// The resource to create.
- pub uri: Url,
- /// Additional options
- #[serde(skip_serializing_if = "Option::is_none")]
- pub options: Option<CreateFileOptions>,
-
- /// An optional annotation identifer describing the operation.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub annotation_id: Option<ChangeAnnotationIdentifier>,
-}
-
-/// Rename file options
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameFileOptions {
- /// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub overwrite: Option<bool>,
- /// Ignores if target exists.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub ignore_if_exists: Option<bool>,
-}
-
-/// Rename file operation
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameFile {
- /// The old (existing) location.
- pub old_uri: Url,
- /// The new location.
- pub new_uri: Url,
- /// Rename options.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub options: Option<RenameFileOptions>,
-
- /// An optional annotation identifer describing the operation.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub annotation_id: Option<ChangeAnnotationIdentifier>,
-}
-
-/// Delete file options
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeleteFileOptions {
- /// Delete the content recursively if a folder is denoted.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub recursive: Option<bool>,
- /// Ignore the operation if the file doesn't exist.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub ignore_if_not_exists: Option<bool>,
-
- /// An optional annotation identifer describing the operation.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub annotation_id: Option<ChangeAnnotationIdentifier>,
-}
-
-/// Delete file operation
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeleteFile {
- /// The file to delete.
- pub uri: Url,
- /// Delete options.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub options: Option<DeleteFileOptions>,
-}
-
-/// A workspace edit represents changes to many resources managed in the workspace.
-/// The edit should either provide `changes` or `documentChanges`.
-/// If the client can handle versioned document edits and if `documentChanges` are present,
-/// the latter are preferred over `changes`.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceEdit {
- /// Holds changes to existing resources.
- #[serde(with = "url_map")]
- #[serde(skip_serializing_if = "Option::is_none")]
- #[serde(default)]
- pub changes: Option<HashMap<Url, Vec<TextEdit>>>, // changes?: { [uri: string]: TextEdit[]; };
-
- /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
- /// are either an array of `TextDocumentEdit`s to express changes to n different text documents
- /// where each text document edit addresses a specific version of a text document. Or it can contain
- /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
- ///
- /// Whether a client supports versioned document edits is expressed via
- /// `workspace.workspaceEdit.documentChanges` client capability.
- ///
- /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
- /// only plain `TextEdit`s using the `changes` property are supported.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_changes: Option<DocumentChanges>,
-
- /// A map of change annotations that can be referenced in
- /// `AnnotatedTextEdit`s or create, rename and delete file / folder
- /// operations.
- ///
- /// Whether clients honor this property depends on the client capability
- /// `workspace.changeAnnotationSupport`.
- ///
- /// @since 3.16.0
- ///
- #[serde(skip_serializing_if = "Option::is_none")]
- pub change_annotations: Option<HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum DocumentChanges {
- Edits(Vec<TextDocumentEdit>),
- Operations(Vec<DocumentChangeOperation>),
-}
-
-// TODO: Once https://github.com/serde-rs/serde/issues/912 is solved
-// we can remove ResourceOp and switch to the following implementation
-// of DocumentChangeOperation:
-//
-// #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-// #[serde(tag = "kind", rename_all="lowercase" )]
-// pub enum DocumentChangeOperation {
-// Create(CreateFile),
-// Rename(RenameFile),
-// Delete(DeleteFile),
-//
-// #[serde(other)]
-// Edit(TextDocumentEdit),
-// }
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged, rename_all = "lowercase")]
-pub enum DocumentChangeOperation {
- Op(ResourceOp),
- Edit(TextDocumentEdit),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(tag = "kind", rename_all = "lowercase")]
-pub enum ResourceOp {
- Create(CreateFile),
- Rename(RenameFile),
- Delete(DeleteFile),
-}
-
-pub type DidChangeConfigurationClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ConfigurationParams {
- pub items: Vec<ConfigurationItem>,
-}
-
-#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ConfigurationItem {
- /// The scope to get the configuration section for.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub scope_uri: Option<Url>,
-
- ///The configuration section asked for.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub section: Option<String>,
-}
-
-mod url_map {
- use std::fmt;
-
- use super::*;
-
- pub fn deserialize<'de, D>(
- deserializer: D,
- ) -> Result<Option<HashMap<Url, Vec<TextEdit>>>, D::Error>
- where
- D: serde::Deserializer<'de>,
- {
- struct UrlMapVisitor;
- impl<'de> de::Visitor<'de> for UrlMapVisitor {
- type Value = HashMap<Url, Vec<TextEdit>>;
-
- fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("map")
- }
-
- fn visit_map<M>(self, mut visitor: M) -> Result<Self::Value, M::Error>
- where
- M: de::MapAccess<'de>,
- {
- let mut values = HashMap::with_capacity(visitor.size_hint().unwrap_or(0));
-
- // While there are entries remaining in the input, add them
- // into our map.
- while let Some((key, value)) = visitor.next_entry::<Url, _>()? {
- values.insert(key, value);
- }
-
- Ok(values)
- }
- }
-
- struct OptionUrlMapVisitor;
- impl<'de> de::Visitor<'de> for OptionUrlMapVisitor {
- type Value = Option<HashMap<Url, Vec<TextEdit>>>;
-
- fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("option")
- }
-
- #[inline]
- fn visit_unit<E>(self) -> Result<Self::Value, E>
- where
- E: serde::de::Error,
- {
- Ok(None)
- }
-
- #[inline]
- fn visit_none<E>(self) -> Result<Self::Value, E>
- where
- E: serde::de::Error,
- {
- Ok(None)
- }
-
- #[inline]
- fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
- where
- D: serde::Deserializer<'de>,
- {
- deserializer.deserialize_map(UrlMapVisitor).map(Some)
- }
- }
-
- // Instantiate our Visitor and ask the Deserializer to drive
- // it over the input data, resulting in an instance of MyMap.
- deserializer.deserialize_option(OptionUrlMapVisitor)
- }
-
- pub fn serialize<S>(
- changes: &Option<HashMap<Url, Vec<TextEdit>>>,
- serializer: S,
- ) -> Result<S::Ok, S::Error>
- where
- S: serde::Serializer,
- {
- use serde::ser::SerializeMap;
-
- match *changes {
- Some(ref changes) => {
- let mut map = serializer.serialize_map(Some(changes.len()))?;
- for (k, v) in changes {
- map.serialize_entry(k.as_str(), v)?;
- }
- map.end()
- }
- None => serializer.serialize_none(),
- }
- }
-}
-
-impl WorkspaceEdit {
- pub fn new(changes: HashMap<Url, Vec<TextEdit>>) -> WorkspaceEdit {
- WorkspaceEdit {
- changes: Some(changes),
- document_changes: None,
- ..Default::default()
- }
- }
-}
-
-/// Text documents are identified using a URI. On the protocol level, URIs are passed as strings.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct TextDocumentIdentifier {
- // !!!!!! Note:
- // In the spec VersionedTextDocumentIdentifier extends TextDocumentIdentifier
- // This modelled by "mixing-in" TextDocumentIdentifier in VersionedTextDocumentIdentifier,
- // so any changes to this type must be effected in the sub-type as well.
- /// The text document's URI.
- pub uri: Url,
-}
-
-impl TextDocumentIdentifier {
- pub fn new(uri: Url) -> TextDocumentIdentifier {
- TextDocumentIdentifier { uri }
- }
-}
-
-/// An item to transfer a text document from the client to the server.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentItem {
- /// The text document's URI.
- pub uri: Url,
-
- /// The text document's language identifier.
- pub language_id: String,
-
- /// The version number of this document (it will strictly increase after each
- /// change, including undo/redo).
- pub version: i32,
-
- /// The content of the opened text document.
- pub text: String,
-}
-
-impl TextDocumentItem {
- pub fn new(uri: Url, language_id: String, version: i32, text: String) -> TextDocumentItem {
- TextDocumentItem {
- uri,
- language_id,
- version,
- text,
- }
- }
-}
-
-/// An identifier to denote a specific version of a text document. This information usually flows from the client to the server.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct VersionedTextDocumentIdentifier {
- // This field was "mixed-in" from TextDocumentIdentifier
- /// The text document's URI.
- pub uri: Url,
-
- /// The version number of this document.
- ///
- /// The version number of a document will increase after each change,
- /// including undo/redo. The number doesn't need to be consecutive.
- pub version: i32,
-}
-
-impl VersionedTextDocumentIdentifier {
- pub fn new(uri: Url, version: i32) -> VersionedTextDocumentIdentifier {
- VersionedTextDocumentIdentifier { uri, version }
- }
-}
-
-/// An identifier which optionally denotes a specific version of a text document. This information usually flows from the server to the client
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct OptionalVersionedTextDocumentIdentifier {
- // This field was "mixed-in" from TextDocumentIdentifier
- /// The text document's URI.
- pub uri: Url,
-
- /// The version number of this document. If an optional versioned text document
- /// identifier is sent from the server to the client and the file is not
- /// open in the editor (the server has not received an open notification
- /// before) the server can send `null` to indicate that the version is
- /// known and the content on disk is the master (as specified with document
- /// content ownership).
- ///
- /// The version number of a document will increase after each change,
- /// including undo/redo. The number doesn't need to be consecutive.
- pub version: Option<i32>,
-}
-
-impl OptionalVersionedTextDocumentIdentifier {
- pub fn new(uri: Url, version: i32) -> OptionalVersionedTextDocumentIdentifier {
- OptionalVersionedTextDocumentIdentifier {
- uri,
- version: Some(version),
- }
- }
-}
-
-/// A parameter literal used in requests to pass a text document and a position inside that document.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentPositionParams {
- // !!!!!! Note:
- // In the spec ReferenceParams extends TextDocumentPositionParams
- // This modelled by "mixing-in" TextDocumentPositionParams in ReferenceParams,
- // so any changes to this type must be effected in sub-type as well.
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The position inside the text document.
- pub position: Position,
-}
-
-impl TextDocumentPositionParams {
- pub fn new(
- text_document: TextDocumentIdentifier,
- position: Position,
- ) -> TextDocumentPositionParams {
- TextDocumentPositionParams {
- text_document,
- position,
- }
- }
-}
-
-/// A document filter denotes a document through properties like language, schema or pattern.
-/// Examples are a filter that applies to TypeScript files on disk or a filter the applies to JSON
-/// files with name package.json:
-///
-/// { language: 'typescript', scheme: 'file' }
-/// { language: 'json', pattern: '**/package.json' }
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DocumentFilter {
- /// A language id, like `typescript`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub language: Option<String>,
-
- /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub scheme: Option<String>,
-
- /// A glob pattern, like `*.{ts,js}`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub pattern: Option<String>,
-}
-
-/// A document selector is the combination of one or many document filters.
-pub type DocumentSelector = Vec<DocumentFilter>;
-
-// ========================= Actual Protocol =========================
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, Default)]
-#[serde(rename_all = "camelCase")]
-pub struct InitializeParams {
- /// The process Id of the parent process that started
- /// the server. Is null if the process has not been started by another process.
- /// If the parent process is not alive then the server should exit (see exit notification) its process.
- pub process_id: Option<u32>,
-
- /// The rootPath of the workspace. Is null
- /// if no folder is open.
- #[serde(skip_serializing_if = "Option::is_none")]
- #[deprecated(note = "Use `root_uri` instead when possible")]
- pub root_path: Option<String>,
-
- /// The rootUri of the workspace. Is null if no
- /// folder is open. If both `rootPath` and `rootUri` are set
- /// `rootUri` wins.
- ///
- /// Deprecated in favour of `workspaceFolders`
- #[serde(default)]
- pub root_uri: Option<Url>,
-
- /// User provided initialization options.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub initialization_options: Option<Value>,
-
- /// The capabilities provided by the client (editor or tool)
- pub capabilities: ClientCapabilities,
-
- /// The initial trace setting. If omitted trace is disabled ('off').
- #[serde(default)]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trace: Option<TraceValue>,
-
- /// The workspace folders configured in the client when the server starts.
- /// This property is only available if the client supports workspace folders.
- /// It can be `null` if the client supports workspace folders but none are
- /// configured.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace_folders: Option<Vec<WorkspaceFolder>>,
-
- /// Information about the client.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub client_info: Option<ClientInfo>,
-
- /// The locale the client is currently showing the user interface
- /// in. This must not necessarily be the locale of the operating
- /// system.
- ///
- /// Uses IETF language tags as the value's syntax
- /// (See <https://en.wikipedia.org/wiki/IETF_language_tag>)
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub locale: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-pub struct ClientInfo {
- /// The name of the client as defined by the client.
- pub name: String,
- /// The client's version as defined by the client.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Clone, Copy, Deserialize, Serialize)]
-pub struct InitializedParams {}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct GenericRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub options: GenericOptions,
-
- #[serde(flatten)]
- pub static_registration_options: StaticRegistrationOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct GenericOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct GenericParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DynamicRegistrationClientCapabilities {
- /// This capability supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GotoCapability {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client supports additional metadata in the form of definition links.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub link_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceEditClientCapabilities {
- /// The client supports versioned document changes in `WorkspaceEdit`s
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_changes: Option<bool>,
-
- /// The resource operations the client supports. Clients should at least
- /// support 'create', 'rename' and 'delete' files and folders.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resource_operations: Option<Vec<ResourceOperationKind>>,
-
- /// The failure handling strategy of a client if applying the workspace edit
- /// failes.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub failure_handling: Option<FailureHandlingKind>,
-
- /// Whether the client normalizes line endings to the client specific
- /// setting.
- /// If set to `true` the client will normalize line ending characters
- /// in a workspace edit containg to the client specific new line
- /// character.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub normalizes_line_endings: Option<bool>,
-
- /// Whether the client in general supports change annotations on text edits,
- /// create file, rename file and delete file changes.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub change_annotation_support: Option<ChangeAnnotationWorkspaceEditClientCapabilities>,
-}
-
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum ResourceOperationKind {
- Create,
- Rename,
- Delete,
-}
-
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
-#[serde(rename_all = "camelCase")]
-pub enum FailureHandlingKind {
- Abort,
- Transactional,
- TextOnlyTransactional,
- Undo,
-}
-
-/// A symbol kind.
-#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct SymbolKind(i32);
-lsp_enum! {
-impl SymbolKind {
- pub const FILE: SymbolKind = SymbolKind(1);
- pub const MODULE: SymbolKind = SymbolKind(2);
- pub const NAMESPACE: SymbolKind = SymbolKind(3);
- pub const PACKAGE: SymbolKind = SymbolKind(4);
- pub const CLASS: SymbolKind = SymbolKind(5);
- pub const METHOD: SymbolKind = SymbolKind(6);
- pub const PROPERTY: SymbolKind = SymbolKind(7);
- pub const FIELD: SymbolKind = SymbolKind(8);
- pub const CONSTRUCTOR: SymbolKind = SymbolKind(9);
- pub const ENUM: SymbolKind = SymbolKind(10);
- pub const INTERFACE: SymbolKind = SymbolKind(11);
- pub const FUNCTION: SymbolKind = SymbolKind(12);
- pub const VARIABLE: SymbolKind = SymbolKind(13);
- pub const CONSTANT: SymbolKind = SymbolKind(14);
- pub const STRING: SymbolKind = SymbolKind(15);
- pub const NUMBER: SymbolKind = SymbolKind(16);
- pub const BOOLEAN: SymbolKind = SymbolKind(17);
- pub const ARRAY: SymbolKind = SymbolKind(18);
- pub const OBJECT: SymbolKind = SymbolKind(19);
- pub const KEY: SymbolKind = SymbolKind(20);
- pub const NULL: SymbolKind = SymbolKind(21);
- pub const ENUM_MEMBER: SymbolKind = SymbolKind(22);
- pub const STRUCT: SymbolKind = SymbolKind(23);
- pub const EVENT: SymbolKind = SymbolKind(24);
- pub const OPERATOR: SymbolKind = SymbolKind(25);
- pub const TYPE_PARAMETER: SymbolKind = SymbolKind(26);
-}
-}
-
-/// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SymbolKindCapability {
- /// The symbol kind values the client supports. When this
- /// property exists the client also guarantees that it will
- /// handle values outside its set gracefully and falls back
- /// to a default value when unknown.
- ///
- /// If this property is not present the client only supports
- /// the symbol kinds from `File` to `Array` as defined in
- /// the initial version of the protocol.
- pub value_set: Option<Vec<SymbolKind>>,
-}
-
-/// Workspace specific client capabilities.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceClientCapabilities {
- /// The client supports applying batch edits to the workspace by supporting
- /// the request 'workspace/applyEdit'
- #[serde(skip_serializing_if = "Option::is_none")]
- pub apply_edit: Option<bool>,
-
- /// Capabilities specific to `WorkspaceEdit`s
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace_edit: Option<WorkspaceEditClientCapabilities>,
-
- /// Capabilities specific to the `workspace/didChangeConfiguration` notification.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_change_configuration: Option<DidChangeConfigurationClientCapabilities>,
-
- /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>,
-
- /// Capabilities specific to the `workspace/symbol` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub symbol: Option<WorkspaceSymbolClientCapabilities>,
-
- /// Capabilities specific to the `workspace/executeCommand` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub execute_command: Option<ExecuteCommandClientCapabilities>,
-
- /// The client has support for workspace folders.
- /// since 3.6.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace_folders: Option<bool>,
-
- /// The client supports `workspace/configuration` requests.
- /// since 3.6.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub configuration: Option<bool>,
-
- /// Capabilities specific to the semantic token requsts scoped to the workspace.
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>,
-
- /// Capabilities specific to the code lens requests scoped to the workspace.
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_lens: Option<CodeLensWorkspaceClientCapabilities>,
-
- /// The client has support for file requests/notifications.
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub file_operations: Option<WorkspaceFileOperationsClientCapabilities>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentSyncClientCapabilities {
- /// Whether text document synchronization supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client supports sending will save notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_save: Option<bool>,
-
- /// The client supports sending a will save request and
- /// waits for a response providing text edits which will
- /// be applied to the document before it is saved.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_save_wait_until: Option<bool>,
-
- /// The client supports did save notifications.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub did_save: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct PublishDiagnosticsClientCapabilities {
- /// Whether the clients accepts diagnostics with related information.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub related_information: Option<bool>,
-
- /// Client supports the tag property to provide meta data about a diagnostic.
- /// Clients supporting tags have to handle unknown tags gracefully.
- #[serde(
- default,
- skip_serializing_if = "Option::is_none",
- deserialize_with = "TagSupport::deserialize_compat"
- )]
- pub tag_support: Option<TagSupport<DiagnosticTag>>,
-
- /// Whether the client interprets the version property of the
- /// `textDocument/publishDiagnostics` notification's parameter.
- ///
- /// 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version_support: Option<bool>,
-
- /// Client supports a codeDescription property
- ///
- /// 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_description_support: Option<bool>,
-
- /// Whether code action supports the `data` property which is
- /// preserved between a `textDocument/publishDiagnostics` and
- /// `textDocument/codeAction` request.
- ///
- /// 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub data_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TagSupport<T> {
- /// The tags supported by the client.
- pub value_set: Vec<T>,
-}
-
-impl<T> TagSupport<T> {
- /// Support for deserializing a boolean tag Support, in case it's present.
- ///
- /// This is currently the case for vscode 1.41.1
- fn deserialize_compat<'de, S>(serializer: S) -> Result<Option<TagSupport<T>>, S::Error>
- where
- S: serde::Deserializer<'de>,
- T: serde::Deserialize<'de>,
- {
- Ok(
- match Option::<Value>::deserialize(serializer).map_err(serde::de::Error::custom)? {
- Some(Value::Bool(false)) => None,
- Some(Value::Bool(true)) => Some(TagSupport { value_set: vec![] }),
- Some(other) => {
- Some(TagSupport::<T>::deserialize(other).map_err(serde::de::Error::custom)?)
- }
- None => None,
- },
- )
- }
-}
-
-/// Text document specific client capabilities.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentClientCapabilities {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub synchronization: Option<TextDocumentSyncClientCapabilities>,
- /// Capabilities specific to the `textDocument/completion`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub completion: Option<CompletionClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/hover`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub hover: Option<HoverClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/signatureHelp`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub signature_help: Option<SignatureHelpClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/references`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub references: Option<ReferenceClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/documentHighlight`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_highlight: Option<DocumentHighlightClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/documentSymbol`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_symbol: Option<DocumentSymbolClientCapabilities>,
- /// Capabilities specific to the `textDocument/formatting`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub formatting: Option<DocumentFormattingClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/rangeFormatting`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range_formatting: Option<DocumentRangeFormattingClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/onTypeFormatting`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/declaration`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub declaration: Option<GotoCapability>,
-
- /// Capabilities specific to the `textDocument/definition`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub definition: Option<GotoCapability>,
-
- /// Capabilities specific to the `textDocument/typeDefinition`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub type_definition: Option<GotoCapability>,
-
- /// Capabilities specific to the `textDocument/implementation`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub implementation: Option<GotoCapability>,
-
- /// Capabilities specific to the `textDocument/codeAction`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_action: Option<CodeActionClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/codeLens`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_lens: Option<CodeLensClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/documentLink`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_link: Option<DocumentLinkClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/documentColor` and the
- /// `textDocument/colorPresentation` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub color_provider: Option<DocumentColorClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/rename`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub rename: Option<RenameClientCapabilities>,
-
- /// Capabilities specific to `textDocument/publishDiagnostics`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>,
-
- /// Capabilities specific to `textDocument/foldingRange` requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub folding_range: Option<FoldingRangeClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/selectionRange` request.
- ///
- /// @since 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub selection_range: Option<SelectionRangeClientCapabilities>,
-
- /// Capabilities specific to `textDocument/linkedEditingRange` requests.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub linked_editing_range: Option<LinkedEditingRangeClientCapabilities>,
-
- /// Capabilities specific to the various call hierarchy requests.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub call_hierarchy: Option<CallHierarchyClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/semanticTokens/*` requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub semantic_tokens: Option<SemanticTokensClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/moniker` request.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub moniker: Option<MonikerClientCapabilities>,
-
- /// Capabilities specific to the `textDocument/inlayHint` request.
- ///
- /// @since 3.17.0 - proposed state
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub inlay_hint: Option<InlayHintClientCapabilities>,
-}
-
-/// Where ClientCapabilities are currently empty:
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ClientCapabilities {
- /// Workspace specific client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace: Option<WorkspaceClientCapabilities>,
-
- /// Text document specific client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text_document: Option<TextDocumentClientCapabilities>,
-
- /// Window specific client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub window: Option<WindowClientCapabilities>,
-
- /// General client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub general: Option<GeneralClientCapabilities>,
-
- /// Unofficial UT8-offsets extension.
- ///
- /// See https://clangd.llvm.org/extensions.html#utf-8-offsets.
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub offset_encoding: Option<Vec<String>>,
-
- /// Experimental client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub experimental: Option<Value>,
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GeneralClientCapabilities {
- /// Client capabilities specific to regular expressions.
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub regular_expressions: Option<RegularExpressionsClientCapabilities>,
-
- /// Client capabilities specific to the client's markdown parser.
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub markdown: Option<MarkdownClientCapabilities>,
-
- /// @since 3.17.0
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub stale_request_support: Option<StaleRequestSupportClientCapabilities>,
-
- /// The position encodings supported by the client. Client and server
- /// have to agree on the same position encoding to ensure that offsets
- /// (e.g. character position in a line) are interpreted the same on both
- /// side.
- ///
- /// To keep the protocol backwards compatible the following applies: if
- /// the value 'utf-16' is missing from the array of position encodings
- /// servers can assume that the client supports UTF-16. UTF-16 is
- /// therefore a mandatory encoding.
- ///
- /// If omitted it defaults to ['utf-16'].
- ///
- /// Implementation considerations: since the conversion from one encoding
- /// into another requires the content of the file / line the conversion
- /// is best done where the file is read which is usually on the server
- /// side.
- ///
- /// @since 3.17.0
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub position_encodings: Option<Vec<PositionEncodingKind>>,
-}
-
-/// Client capability that signals how the client
-/// handles stale requests (e.g. a request
-/// for which the client will not process the response
-/// anymore since the information is outdated).
-///
-/// @since 3.17.0
-#[cfg(feature = "proposed")]
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct StaleRequestSupportClientCapabilities {
- /// The client will actively cancel the request.
- pub cancel: bool,
-
- /// The list of requests for which the client
- /// will retry the request if it receives a
- /// response with error code `ContentModified``
- pub retry_on_content_modified: Vec<String>,
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RegularExpressionsClientCapabilities {
- /// The engine's name.
- pub engine: String,
-
- /// The engine's version
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MarkdownClientCapabilities {
- /// The name of the parser.
- pub parser: String,
-
- /// The version of the parser.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct InitializeResult {
- /// The capabilities the language server provides.
- pub capabilities: ServerCapabilities,
-
- /// Information about the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub server_info: Option<ServerInfo>,
-
- /// Unofficial UT8-offsets extension.
- ///
- /// See https://clangd.llvm.org/extensions.html#utf-8-offsets.
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub offset_encoding: Option<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct ServerInfo {
- /// The name of the server as defined by the server.
- pub name: String,
- /// The servers's version as defined by the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct InitializeError {
- /// Indicates whether the client should retry to send the
- /// initilize request after showing the message provided
- /// in the ResponseError.
- pub retry: bool,
-}
-
-// The server can signal the following capabilities:
-
-/// Defines how the host (editor) should sync document changes to the language server.
-#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct TextDocumentSyncKind(i32);
-lsp_enum! {
-impl TextDocumentSyncKind {
- /// Documents should not be synced at all.
- pub const NONE: TextDocumentSyncKind = TextDocumentSyncKind(0);
-
- /// Documents are synced by always sending the full content of the document.
- pub const FULL: TextDocumentSyncKind = TextDocumentSyncKind(1);
-
- /// Documents are synced by sending the full content on open. After that only
- /// incremental updates to the document are sent.
- pub const INCREMENTAL: TextDocumentSyncKind = TextDocumentSyncKind(2);
-}
-}
-
-pub type ExecuteCommandClientCapabilities = DynamicRegistrationClientCapabilities;
-
-/// Execute command options.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct ExecuteCommandOptions {
- /// The commands to be executed on the server
- pub commands: Vec<String>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-/// Save options.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SaveOptions {
- /// The client is supposed to include the content on save.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub include_text: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum TextDocumentSyncSaveOptions {
- Supported(bool),
- SaveOptions(SaveOptions),
-}
-
-impl From<SaveOptions> for TextDocumentSyncSaveOptions {
- fn from(from: SaveOptions) -> Self {
- Self::SaveOptions(from)
- }
-}
-
-impl From<bool> for TextDocumentSyncSaveOptions {
- fn from(from: bool) -> Self {
- Self::Supported(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentSyncOptions {
- /// Open and close notifications are sent to the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub open_close: Option<bool>,
-
- /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
- /// and TextDocumentSyncKindIncremental.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub change: Option<TextDocumentSyncKind>,
-
- /// Will save notifications are sent to the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_save: Option<bool>,
-
- /// Will save wait until requests are sent to the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub will_save_wait_until: Option<bool>,
-
- /// Save notifications are sent to the server.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub save: Option<TextDocumentSyncSaveOptions>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum OneOf<A, B> {
- Left(A),
- Right(B),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum TextDocumentSyncCapability {
- Kind(TextDocumentSyncKind),
- Options(TextDocumentSyncOptions),
-}
-
-impl From<TextDocumentSyncOptions> for TextDocumentSyncCapability {
- fn from(from: TextDocumentSyncOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<TextDocumentSyncKind> for TextDocumentSyncCapability {
- fn from(from: TextDocumentSyncKind) -> Self {
- Self::Kind(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum ImplementationProviderCapability {
- Simple(bool),
- Options(StaticTextDocumentRegistrationOptions),
-}
-
-impl From<StaticTextDocumentRegistrationOptions> for ImplementationProviderCapability {
- fn from(from: StaticTextDocumentRegistrationOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for ImplementationProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum TypeDefinitionProviderCapability {
- Simple(bool),
- Options(StaticTextDocumentRegistrationOptions),
-}
-
-impl From<StaticTextDocumentRegistrationOptions> for TypeDefinitionProviderCapability {
- fn from(from: StaticTextDocumentRegistrationOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for TypeDefinitionProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ServerCapabilities {
- /// The position encoding the server picked from the encodings offered
- /// by the client via the client capability `general.positionEncodings`.
- ///
- /// If the client didn't provide any position encodings the only valid
- /// value that a server can return is 'utf-16'.
- ///
- /// If omitted it defaults to 'utf-16'.
- ///
- /// @since 3.17.0
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub position_encoding: Option<PositionEncodingKind>,
-
- /// Defines how text documents are synced.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text_document_sync: Option<TextDocumentSyncCapability>,
-
- /// Capabilities specific to `textDocument/selectionRange` requests.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub selection_range_provider: Option<SelectionRangeProviderCapability>,
-
- /// The server provides hover support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub hover_provider: Option<HoverProviderCapability>,
-
- /// The server provides completion support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub completion_provider: Option<CompletionOptions>,
-
- /// The server provides signature help support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub signature_help_provider: Option<SignatureHelpOptions>,
-
- /// The server provides goto definition support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub definition_provider: Option<OneOf<bool, DefinitionOptions>>,
-
- /// The server provides goto type definition support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub type_definition_provider: Option<TypeDefinitionProviderCapability>,
-
- /// The server provides goto implementation support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub implementation_provider: Option<ImplementationProviderCapability>,
-
- /// The server provides find references support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub references_provider: Option<OneOf<bool, ReferencesOptions>>,
-
- /// The server provides document highlight support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_highlight_provider: Option<OneOf<bool, DocumentHighlightOptions>>,
-
- /// The server provides document symbol support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_symbol_provider: Option<OneOf<bool, DocumentSymbolOptions>>,
-
- /// The server provides workspace symbol support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace_symbol_provider: Option<OneOf<bool, WorkspaceSymbolOptions>>,
-
- /// The server provides code actions.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_action_provider: Option<CodeActionProviderCapability>,
-
- /// The server provides code lens.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub code_lens_provider: Option<CodeLensOptions>,
-
- /// The server provides document formatting.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_formatting_provider: Option<OneOf<bool, DocumentFormattingOptions>>,
-
- /// The server provides document range formatting.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_range_formatting_provider: Option<OneOf<bool, DocumentRangeFormattingOptions>>,
-
- /// The server provides document formatting on typing.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>,
-
- /// The server provides rename support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub rename_provider: Option<OneOf<bool, RenameOptions>>,
-
- /// The server provides document link support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub document_link_provider: Option<DocumentLinkOptions>,
-
- /// The server provides color provider support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub color_provider: Option<ColorProviderCapability>,
-
- /// The server provides folding provider support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub folding_range_provider: Option<FoldingRangeProviderCapability>,
-
- /// The server provides go to declaration support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub declaration_provider: Option<DeclarationCapability>,
-
- /// The server provides execute command support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub execute_command_provider: Option<ExecuteCommandOptions>,
-
- /// Workspace specific server capabilities
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace: Option<WorkspaceServerCapabilities>,
-
- /// Call hierarchy provider capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub call_hierarchy_provider: Option<CallHierarchyServerCapability>,
-
- /// Semantic tokens server capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub semantic_tokens_provider: Option<SemanticTokensServerCapabilities>,
-
- /// Whether server provides moniker support.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub moniker_provider: Option<OneOf<bool, MonikerServerCapabilities>>,
-
- /// The server provides inlay hints.
- ///
- /// @since 3.17.0 - proposed state
- #[serde(skip_serializing_if = "Option::is_none")]
- #[cfg(feature = "proposed")]
- pub inlay_hint_provider: Option<OneOf<bool, InlayHintServerCapabilities>>,
-
- /// The server provides linked editing range support.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub linked_editing_range_provider: Option<LinkedEditingRangeServerCapabilities>,
-
- /// Experimental server capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub experimental: Option<Value>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceServerCapabilities {
- /// The server supports workspace folder.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub workspace_folders: Option<WorkspaceFoldersServerCapabilities>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub file_operations: Option<WorkspaceFileOperationsServerCapabilities>,
-}
-
-/// General parameters to to register for a capability.
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Registration {
- /// The id used to register the request. The id can be used to deregister
- /// the request again.
- pub id: String,
-
- /// The method / capability to register for.
- pub method: String,
-
- /// Options necessary for the registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub register_options: Option<Value>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-pub struct RegistrationParams {
- pub registrations: Vec<Registration>,
-}
-
-/// Since most of the registration options require to specify a document selector there is a base
-/// interface that can be used.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentRegistrationOptions {
- /// A document selector to identify the scope of the registration. If set to null
- /// the document selector provided on the client side will be used.
- pub document_selector: Option<DocumentSelector>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum DeclarationCapability {
- Simple(bool),
- RegistrationOptions(DeclarationRegistrationOptions),
- Options(DeclarationOptions),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeclarationRegistrationOptions {
- #[serde(flatten)]
- pub declaration_options: DeclarationOptions,
-
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub static_registration_options: StaticRegistrationOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeclarationOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct StaticRegistrationOptions {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub id: Option<String>,
-}
-
-#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressOptions {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub work_done_progress: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentFormattingOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentRangeFormattingOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DefinitionOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentSymbolOptions {
- /// A human-readable string that is shown when multiple outlines trees are
- /// shown for the same document.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label: Option<String>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ReferencesOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DocumentHighlightOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceSymbolOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct StaticTextDocumentRegistrationOptions {
- /// A document selector to identify the scope of the registration. If set to null
- /// the document selector provided on the client side will be used.
- pub document_selector: Option<DocumentSelector>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub id: Option<String>,
-}
-
-/// General parameters to unregister a capability.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct Unregistration {
- /// The id used to unregister the request or notification. Usually an id
- /// provided during the register request.
- pub id: String,
-
- /// The method / capability to unregister for.
- pub method: String,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct UnregistrationParams {
- pub unregisterations: Vec<Unregistration>,
-}
-
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DidChangeConfigurationParams {
- /// The actual changed settings
- pub settings: Value,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidOpenTextDocumentParams {
- /// The document that was opened.
- pub text_document: TextDocumentItem,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidChangeTextDocumentParams {
- /// The document that did change. The version number points
- /// to the version after all provided content changes have
- /// been applied.
- pub text_document: VersionedTextDocumentIdentifier,
- /// The actual content changes.
- pub content_changes: Vec<TextDocumentContentChangeEvent>,
-}
-
-/// An event describing a change to a text document. If range and rangeLength are omitted
-/// the new text is considered to be the full content of the document.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentContentChangeEvent {
- /// The range of the document that changed.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range: Option<Range>,
-
- /// The length of the range that got replaced.
- ///
- /// Deprecated: Use range instead
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range_length: Option<u32>,
-
- /// The new text of the document.
- pub text: String,
-}
-
-/// Descibe options to be used when registered for text document change events.
-///
-/// Extends TextDocumentRegistrationOptions
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentChangeRegistrationOptions {
- /// A document selector to identify the scope of the registration. If set to null
- /// the document selector provided on the client side will be used.
- pub document_selector: Option<DocumentSelector>,
-
- /// How documents are synced to the server. See TextDocumentSyncKind.Full
- /// and TextDocumentSyncKindIncremental.
- pub sync_kind: i32,
-}
-
-/// The parameters send in a will save text document notification.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WillSaveTextDocumentParams {
- /// The document that will be saved.
- pub text_document: TextDocumentIdentifier,
-
- /// The 'TextDocumentSaveReason'.
- pub reason: TextDocumentSaveReason,
-}
-
-/// Represents reasons why a text document is saved.
-#[derive(Copy, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct TextDocumentSaveReason(i32);
-lsp_enum! {
-impl TextDocumentSaveReason {
- /// Manually triggered, e.g. by the user pressing save, by starting debugging,
- /// or by an API call.
- pub const MANUAL: TextDocumentSaveReason = TextDocumentSaveReason(1);
-
- /// Automatic after a delay.
- pub const AFTER_DELAY: TextDocumentSaveReason = TextDocumentSaveReason(2);
-
- /// When the editor lost focus.
- pub const FOCUS_OUT: TextDocumentSaveReason = TextDocumentSaveReason(3);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidCloseTextDocumentParams {
- /// The document that was closed.
- pub text_document: TextDocumentIdentifier,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidSaveTextDocumentParams {
- /// The document that was saved.
- pub text_document: TextDocumentIdentifier,
-
- /// Optional the content when saved. Depends on the includeText value
- /// when the save notification was requested.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub text: Option<String>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct TextDocumentSaveRegistrationOptions {
- /// The client is supposed to include the content on save.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub include_text: Option<bool>,
-
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-}
-
-pub type DidChangeWatchedFilesClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct DidChangeWatchedFilesParams {
- /// The actual file events.
- pub changes: Vec<FileEvent>,
-}
-
-/// The file event type.
-#[derive(Eq, PartialEq, Copy, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct FileChangeType(i32);
-lsp_enum! {
-impl FileChangeType {
- /// The file got created.
- pub const CREATED: FileChangeType = FileChangeType(1);
-
- /// The file got changed.
- pub const CHANGED: FileChangeType = FileChangeType(2);
-
- /// The file got deleted.
- pub const DELETED: FileChangeType = FileChangeType(3);
-}
-}
-
-/// An event describing a file change.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct FileEvent {
- /// The file's URI.
- pub uri: Url,
-
- /// The change type.
- #[serde(rename = "type")]
- pub typ: FileChangeType,
-}
-
-impl FileEvent {
- pub fn new(uri: Url, typ: FileChangeType) -> FileEvent {
- FileEvent { uri, typ }
- }
-}
-
-/// Describe options to be used when registered for text document change events.
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
-pub struct DidChangeWatchedFilesRegistrationOptions {
- /// The watchers to register.
- pub watchers: Vec<FileSystemWatcher>,
-}
-
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FileSystemWatcher {
- /// The glob pattern to watch
- pub glob_pattern: String,
-
- /// The kind of events of interest. If omitted it defaults to WatchKind.Create |
- /// WatchKind.Change | WatchKind.Delete which is 7.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<WatchKind>,
-}
-
-bitflags! {
-pub struct WatchKind: u8 {
- /// Interested in create events.
- const Create = 1;
- /// Interested in change events
- const Change = 2;
- /// Interested in delete events
- const Delete = 4;
-}
-}
-
-impl<'de> serde::Deserialize<'de> for WatchKind {
- fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
- where
- D: serde::Deserializer<'de>,
- {
- let i = u8::deserialize(deserializer)?;
- WatchKind::from_bits(i).ok_or_else(|| {
- D::Error::invalid_value(de::Unexpected::Unsigned(u64::from(i)), &"Unknown flag")
- })
- }
-}
-
-impl serde::Serialize for WatchKind {
- fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
- where
- S: serde::Serializer,
- {
- serializer.serialize_u8(self.bits())
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct PublishDiagnosticsParams {
- /// The URI for which diagnostic information is reported.
- pub uri: Url,
-
- /// An array of diagnostic information items.
- pub diagnostics: Vec<Diagnostic>,
-
- /// Optional the version number of the document the diagnostics are published for.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<i32>,
-}
-
-impl PublishDiagnosticsParams {
- pub fn new(
- uri: Url,
- diagnostics: Vec<Diagnostic>,
- version: Option<i32>,
- ) -> PublishDiagnosticsParams {
- PublishDiagnosticsParams {
- uri,
- diagnostics,
- version,
- }
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(untagged)]
-pub enum Documentation {
- String(String),
- MarkupContent(MarkupContent),
-}
-
-/// The marked string is rendered:
-/// - as markdown if it is represented as a string
-/// - as code block of the given langauge if it is represented as a pair of a language and a value
-///
-/// The pair of a language and a value is an equivalent to markdown:
-/// ```${language}
-/// ${value}
-/// ```
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum MarkedString {
- String(String),
- LanguageString(LanguageString),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct LanguageString {
- pub language: String,
- pub value: String,
-}
-
-impl MarkedString {
- pub fn from_markdown(markdown: String) -> MarkedString {
- MarkedString::String(markdown)
- }
-
- pub fn from_language_code(language: String, code_block: String) -> MarkedString {
- MarkedString::LanguageString(LanguageString {
- language,
- value: code_block,
- })
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GotoDefinitionParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// GotoDefinition response can be single location, or multiple Locations or a link.
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
-#[serde(untagged)]
-pub enum GotoDefinitionResponse {
- Scalar(Location),
- Array(Vec<Location>),
- Link(Vec<LocationLink>),
-}
-
-impl From<Location> for GotoDefinitionResponse {
- fn from(location: Location) -> Self {
- GotoDefinitionResponse::Scalar(location)
- }
-}
-
-impl From<Vec<Location>> for GotoDefinitionResponse {
- fn from(locations: Vec<Location>) -> Self {
- GotoDefinitionResponse::Array(locations)
- }
-}
-
-impl From<Vec<LocationLink>> for GotoDefinitionResponse {
- fn from(locations: Vec<LocationLink>) -> Self {
- GotoDefinitionResponse::Link(locations)
- }
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct ExecuteCommandParams {
- /// The identifier of the actual command handler.
- pub command: String,
- /// Arguments that the command should be invoked with.
- #[serde(default)]
- pub arguments: Vec<Value>,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-/// Execute command registration options.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct ExecuteCommandRegistrationOptions {
- /// The commands to be executed on the server
- pub commands: Vec<String>,
-
- #[serde(flatten)]
- pub execute_command_options: ExecuteCommandOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ApplyWorkspaceEditParams {
- /// An optional label of the workspace edit. This label is
- /// presented in the user interface for example on an undo
- /// stack to undo the workspace edit.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label: Option<String>,
-
- /// The edits to apply.
- pub edit: WorkspaceEdit,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ApplyWorkspaceEditResponse {
- /// Indicates whether the edit was applied or not.
- pub applied: bool,
-
- /// An optional textual description for why the edit was not applied.
- /// This may be used may be used by the server for diagnostic
- /// logging or to provide a suitable error for a request that
- /// triggered the edit
- #[serde(skip_serializing_if = "Option::is_none")]
- pub failure_reason: Option<String>,
-
- /// Depending on the client's failure handling strategy `failedChange` might
- /// contain the index of the change that failed. This property is only available
- /// if the client signals a `failureHandlingStrategy` in its client capabilities.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub failed_change: Option<u32>,
-}
-
-/// Describes the content type that a client supports in various
-/// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
-///
-/// Please note that `MarkupKinds` must not start with a `$`. This kinds
-/// are reserved for internal usage.
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum MarkupKind {
- /// Plain text is supported as a content format
- PlainText,
- /// Markdown is supported as a content format
- Markdown,
-}
-
-/// A `MarkupContent` literal represents a string value which content can be represented in different formats.
-/// Currently `plaintext` and `markdown` are supported formats. A `MarkupContent` is usually used in
-/// documentation properties of result literals like `CompletionItem` or `SignatureInformation`.
-/// If the format is `markdown` the content should follow the [GitHub Flavored Markdown Specification](https://github.github.com/gfm/).
-///
-/// Here is an example how such a string can be constructed using JavaScript / TypeScript:
-/// ```ignore
-/// let markdown: MarkupContent = {
-/// kind: MarkupKind::Markdown,
-/// value: [
-/// "# Header",
-/// "Some text",
-/// "```typescript",
-/// "someCode();",
-/// "```"
-/// ]
-/// .join("\n"),
-/// };
-/// ```
-///
-/// Please Note* that clients might sanitize the return markdown. A client could decide to
-/// remove HTML from the markdown to avoid script execution.
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
-pub struct MarkupContent {
- pub kind: MarkupKind,
- pub value: String,
-}
-
-/// A parameter literal used to pass a partial result token.
-#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct PartialResultParams {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub partial_result_token: Option<ProgressToken>,
-}
-
-/// Symbol tags are extra annotations that tweak the rendering of a symbol.
-/// Since 3.15
-#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct SymbolTag(i32);
-lsp_enum! {
-impl SymbolTag {
- /// Render a symbol as obsolete, usually using a strike-out.
- pub const DEPRECATED: SymbolTag = SymbolTag(1);
-}
-}
-
-#[cfg(test)]
-mod tests {
- use serde::{Deserialize, Serialize};
-
- use super::*;
-
- pub(crate) fn test_serialization<SER>(ms: &SER, expected: &str)
- where
- SER: Serialize + for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
- {
- let json_str = serde_json::to_string(ms).unwrap();
- assert_eq!(&json_str, expected);
- let deserialized: SER = serde_json::from_str(&json_str).unwrap();
- assert_eq!(&deserialized, ms);
- }
-
- pub(crate) fn test_deserialization<T>(json: &str, expected: &T)
- where
- T: for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
- {
- let value = serde_json::from_str::<T>(json).unwrap();
- assert_eq!(&value, expected);
- }
-
- #[test]
- fn one_of() {
- test_serialization(&OneOf::<bool, ()>::Left(true), r#"true"#);
- test_serialization(&OneOf::<String, ()>::Left("abcd".into()), r#""abcd""#);
- test_serialization(
- &OneOf::<String, WorkDoneProgressOptions>::Right(WorkDoneProgressOptions {
- work_done_progress: Some(false),
- }),
- r#"{"workDoneProgress":false}"#,
- );
- }
-
- #[test]
- fn number_or_string() {
- test_serialization(&NumberOrString::Number(123), r#"123"#);
-
- test_serialization(&NumberOrString::String("abcd".into()), r#""abcd""#);
- }
-
- #[test]
- fn marked_string() {
- test_serialization(&MarkedString::from_markdown("xxx".into()), r#""xxx""#);
-
- test_serialization(
- &MarkedString::from_language_code("lang".into(), "code".into()),
- r#"{"language":"lang","value":"code"}"#,
- );
- }
-
- #[test]
- fn language_string() {
- test_serialization(
- &LanguageString {
- language: "LL".into(),
- value: "VV".into(),
- },
- r#"{"language":"LL","value":"VV"}"#,
- );
- }
-
- #[test]
- fn workspace_edit() {
- test_serialization(
- &WorkspaceEdit {
- changes: Some(vec![].into_iter().collect()),
- document_changes: None,
- ..Default::default()
- },
- r#"{"changes":{}}"#,
- );
-
- test_serialization(
- &WorkspaceEdit {
- changes: None,
- document_changes: None,
- ..Default::default()
- },
- r#"{}"#,
- );
-
- test_serialization(
- &WorkspaceEdit {
- changes: Some(
- vec![(Url::parse("file://test").unwrap(), vec![])]
- .into_iter()
- .collect(),
- ),
- document_changes: None,
- ..Default::default()
- },
- r#"{"changes":{"file://test/":[]}}"#,
- );
- }
-
- #[test]
- fn root_uri_can_be_missing() {
- serde_json::from_str::<InitializeParams>(r#"{ "capabilities": {} }"#).unwrap();
- }
-
- #[test]
- fn test_watch_kind() {
- test_serialization(&WatchKind::Create, "1");
- test_serialization(&(WatchKind::Create | WatchKind::Change), "3");
- test_serialization(
- &(WatchKind::Create | WatchKind::Change | WatchKind::Delete),
- "7",
- );
- }
-
- #[test]
- fn test_resource_operation_kind() {
- test_serialization(
- &vec![
- ResourceOperationKind::Create,
- ResourceOperationKind::Rename,
- ResourceOperationKind::Delete,
- ],
- r#"["create","rename","delete"]"#,
- );
- }
-}
+/*!
+
+Language Server Protocol types for Rust.
+
+Based on: <https://microsoft.github.io/language-server-protocol/specification>
+
+This library uses the URL crate for parsing URIs. Note that there is
+some confusion on the meaning of URLs vs URIs:
+<http://stackoverflow.com/a/28865728/393898>. According to that
+information, on the classical sense of "URLs", "URLs" are a subset of
+URIs, But on the modern/new meaning of URLs, they are the same as
+URIs. The important take-away aspect is that the URL crate should be
+able to parse any URI, such as `urn:isbn:0451450523`.
+
+
+*/
+#![allow(non_upper_case_globals)]
+#[forbid(unsafe_code)]
+#[macro_use]
+extern crate bitflags;
+
+use std::{collections::HashMap, fmt::Debug};
+
+use serde::{de, de::Error as Error_, Deserialize, Serialize};
+use serde_json::Value;
+pub use url::Url;
+
+// Large enough to contain any enumeration name defined in this crate
+type PascalCaseBuf = [u8; 32];
+const fn fmt_pascal_case_const(name: &str) -> (PascalCaseBuf, usize) {
+ let mut buf = [0; 32];
+ let mut buf_i = 0;
+ let mut name_i = 0;
+ let name = name.as_bytes();
+ while name_i < name.len() {
+ let first = name[name_i];
+ name_i += 1;
+
+ buf[buf_i] = first;
+ buf_i += 1;
+
+ while name_i < name.len() {
+ let rest = name[name_i];
+ name_i += 1;
+ if rest == b'_' {
+ break;
+ }
+
+ buf[buf_i] = rest.to_ascii_lowercase();
+ buf_i += 1;
+ }
+ }
+ (buf, buf_i)
+}
+
+fn fmt_pascal_case(f: &mut std::fmt::Formatter<'_>, name: &str) -> std::fmt::Result {
+ for word in name.split('_') {
+ let mut chars = word.chars();
+ let first = chars.next().unwrap();
+ write!(f, "{}", first)?;
+ for rest in chars {
+ write!(f, "{}", rest.to_lowercase())?;
+ }
+ }
+ Ok(())
+}
+
+macro_rules! lsp_enum {
+ (impl $typ: ident { $( $(#[$attr:meta])* pub const $name: ident : $enum_type: ty = $value: expr; )* }) => {
+ impl $typ {
+ $(
+ $(#[$attr])*
+ pub const $name: $enum_type = $value;
+ )*
+ }
+
+ impl std::fmt::Debug for $typ {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match *self {
+ $(
+ Self::$name => crate::fmt_pascal_case(f, stringify!($name)),
+ )*
+ _ => write!(f, "{}({})", stringify!($typ), self.0),
+ }
+ }
+ }
+
+ impl std::convert::TryFrom<&str> for $typ {
+ type Error = &'static str;
+ fn try_from(value: &str) -> Result<Self, Self::Error> {
+ match () {
+ $(
+ _ if {
+ const X: (crate::PascalCaseBuf, usize) = crate::fmt_pascal_case_const(stringify!($name));
+ let (buf, len) = X;
+ &buf[..len] == value.as_bytes()
+ } => Ok(Self::$name),
+ )*
+ _ => Err("unknown enum variant"),
+ }
+ }
+ }
+
+ }
+}
+
+pub mod error_codes;
+pub mod notification;
+pub mod request;
+
+mod call_hierarchy;
+pub use call_hierarchy::*;
+
+mod code_action;
+pub use code_action::*;
+
+mod code_lens;
+pub use code_lens::*;
+
+mod color;
+pub use color::*;
+
+mod completion;
+pub use completion::*;
+
+mod document_highlight;
+pub use document_highlight::*;
+
+mod document_link;
+pub use document_link::*;
+
+mod document_symbols;
+pub use document_symbols::*;
+
+mod file_operations;
+pub use file_operations::*;
+
+mod folding_range;
+pub use folding_range::*;
+
+mod formatting;
+pub use formatting::*;
+
+mod hover;
+pub use hover::*;
+
+mod inlay_hint;
+pub use inlay_hint::*;
+
+mod inline_value;
+pub use inline_value::*;
+
+mod moniker;
+pub use moniker::*;
+
+mod progress;
+pub use progress::*;
+
+mod references;
+pub use references::*;
+
+mod rename;
+pub use rename::*;
+
+pub mod selection_range;
+pub use selection_range::*;
+
+mod semantic_tokens;
+pub use semantic_tokens::*;
+
+mod signature_help;
+pub use signature_help::*;
+
+mod type_hierarchy;
+pub use type_hierarchy::*;
+
+mod linked_editing;
+pub use linked_editing::*;
+
+mod window;
+pub use window::*;
+
+mod workspace_folders;
+pub use workspace_folders::*;
+
+mod workspace_symbols;
+pub use workspace_symbols::*;
+
+pub mod lsif;
+
+mod trace;
+pub use trace::*;
+
+/* ----------------- Auxiliary types ----------------- */
+
+#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum NumberOrString {
+ Number(i32),
+ String(String),
+}
+
+/* ----------------- Cancel support ----------------- */
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct CancelParams {
+ /// The request id to cancel.
+ pub id: NumberOrString,
+}
+
+/* ----------------- Basic JSON Structures ----------------- */
+
+/// The LSP any type
+///
+/// @since 3.17.0
+pub type LSPAny = serde_json::Value;
+
+/// LSP object definition.
+///
+/// @since 3.17.0
+pub type LSPObject = serde_json::Map<String, serde_json::Value>;
+
+/// LSP arrays.
+///
+/// @since 3.17.0
+pub type LSPArray = Vec<serde_json::Value>;
+
+/// Position in a text document expressed as zero-based line and character offset.
+/// A position is between two characters like an 'insert' cursor in a editor.
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize)]
+pub struct Position {
+ /// Line position in a document (zero-based).
+ pub line: u32,
+ /// Character offset on a line in a document (zero-based). The meaning of this
+ /// offset is determined by the negotiated `PositionEncodingKind`.
+ ///
+ /// If the character value is greater than the line length it defaults back
+ /// to the line length.
+ pub character: u32,
+}
+
+impl Position {
+ pub fn new(line: u32, character: u32) -> Position {
+ Position { line, character }
+ }
+}
+
+/// A range in a text document expressed as (zero-based) start and end positions.
+/// A range is comparable to a selection in an editor. Therefore the end position is exclusive.
+#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Deserialize, Serialize)]
+pub struct Range {
+ /// The range's start position.
+ pub start: Position,
+ /// The range's end position.
+ pub end: Position,
+}
+
+impl Range {
+ pub fn new(start: Position, end: Position) -> Range {
+ Range { start, end }
+ }
+}
+
+/// Represents a location inside a resource, such as a line inside a text file.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct Location {
+ pub uri: Url,
+ pub range: Range,
+}
+
+impl Location {
+ pub fn new(uri: Url, range: Range) -> Location {
+ Location { uri, range }
+ }
+}
+
+/// Represents a link between a source and a target location.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LocationLink {
+ /// Span of the origin of this link.
+ ///
+ /// Used as the underlined span for mouse interaction. Defaults to the word range at
+ /// the mouse position.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub origin_selection_range: Option<Range>,
+
+ /// The target resource identifier of this link.
+ pub target_uri: Url,
+
+ /// The full target range of this link.
+ pub target_range: Range,
+
+ /// The span of this link.
+ pub target_selection_range: Range,
+}
+
+/// A type indicating how positions are encoded,
+/// specifically what column offsets mean.
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
+pub struct PositionEncodingKind(std::borrow::Cow<'static, str>);
+
+impl PositionEncodingKind {
+ /// Character offsets count UTF-8 code units.
+ pub const UTF8: PositionEncodingKind = PositionEncodingKind::new("utf-8");
+
+ /// Character offsets count UTF-16 code units.
+ ///
+ /// This is the default and must always be supported
+ /// by servers
+ pub const UTF16: PositionEncodingKind = PositionEncodingKind::new("utf-16");
+
+ /// Character offsets count UTF-32 code units.
+ ///
+ /// Implementation note: these are the same as Unicode code points,
+ /// so this `PositionEncodingKind` may also be used for an
+ /// encoding-agnostic representation of character offsets.
+ pub const UTF32: PositionEncodingKind = PositionEncodingKind::new("utf-32");
+
+ pub const fn new(tag: &'static str) -> Self {
+ PositionEncodingKind(std::borrow::Cow::Borrowed(tag))
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl From<String> for PositionEncodingKind {
+ fn from(from: String) -> Self {
+ PositionEncodingKind(std::borrow::Cow::from(from))
+ }
+}
+
+impl From<&'static str> for PositionEncodingKind {
+ fn from(from: &'static str) -> Self {
+ PositionEncodingKind::new(from)
+ }
+}
+
+/// Represents a diagnostic, such as a compiler error or warning.
+/// Diagnostic objects are only valid in the scope of a resource.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Diagnostic {
+ /// The range at which the message applies.
+ pub range: Range,
+
+ /// The diagnostic's severity. Can be omitted. If omitted it is up to the
+ /// client to interpret diagnostics as error, warning, info or hint.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub severity: Option<DiagnosticSeverity>,
+
+ /// The diagnostic's code. Can be omitted.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code: Option<NumberOrString>,
+
+ /// An optional property to describe the error code.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_description: Option<CodeDescription>,
+
+ /// A human-readable string describing the source of this
+ /// diagnostic, e.g. 'typescript' or 'super lint'.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub source: Option<String>,
+
+ /// The diagnostic's message.
+ pub message: String,
+
+ /// An array of related diagnostic information, e.g. when symbol-names within
+ /// a scope collide all definitions can be marked via this property.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub related_information: Option<Vec<DiagnosticRelatedInformation>>,
+
+ /// Additional metadata about the diagnostic.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<DiagnosticTag>>,
+
+ /// A data entry field that is preserved between a `textDocument/publishDiagnostics`
+ /// notification and `textDocument/codeAction` request.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<serde_json::Value>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CodeDescription {
+ pub href: Url,
+}
+
+impl Diagnostic {
+ pub fn new(
+ range: Range,
+ severity: Option<DiagnosticSeverity>,
+ code: Option<NumberOrString>,
+ source: Option<String>,
+ message: String,
+ related_information: Option<Vec<DiagnosticRelatedInformation>>,
+ tags: Option<Vec<DiagnosticTag>>,
+ ) -> Diagnostic {
+ Diagnostic {
+ range,
+ severity,
+ code,
+ source,
+ message,
+ related_information,
+ tags,
+ ..Diagnostic::default()
+ }
+ }
+
+ pub fn new_simple(range: Range, message: String) -> Diagnostic {
+ Self::new(range, None, None, None, message, None, None)
+ }
+
+ pub fn new_with_code_number(
+ range: Range,
+ severity: DiagnosticSeverity,
+ code_number: i32,
+ source: Option<String>,
+ message: String,
+ ) -> Diagnostic {
+ let code = Some(NumberOrString::Number(code_number));
+ Self::new(range, Some(severity), code, source, message, None, None)
+ }
+}
+
+/// The protocol currently supports the following diagnostic severities:
+#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct DiagnosticSeverity(i32);
+lsp_enum! {
+impl DiagnosticSeverity {
+ /// Reports an error.
+ pub const ERROR: DiagnosticSeverity = DiagnosticSeverity(1);
+ /// Reports a warning.
+ pub const WARNING: DiagnosticSeverity = DiagnosticSeverity(2);
+ /// Reports an information.
+ pub const INFORMATION: DiagnosticSeverity = DiagnosticSeverity(3);
+ /// Reports a hint.
+ pub const HINT: DiagnosticSeverity = DiagnosticSeverity(4);
+}
+}
+
+/// Represents a related message and source code location for a diagnostic. This
+/// should be used to point to code locations that cause or related to a
+/// diagnostics, e.g when duplicating a symbol in a scope.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DiagnosticRelatedInformation {
+ /// The location of this related diagnostic information.
+ pub location: Location,
+
+ /// The message of this related diagnostic information.
+ pub message: String,
+}
+
+/// The diagnostic tags.
+#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct DiagnosticTag(i32);
+lsp_enum! {
+impl DiagnosticTag {
+ /// Unused or unnecessary code.
+ /// Clients are allowed to render diagnostics with this tag faded out instead of having
+ /// an error squiggle.
+ pub const UNNECESSARY: DiagnosticTag = DiagnosticTag(1);
+
+ /// Deprecated or obsolete code.
+ /// Clients are allowed to rendered diagnostics with this tag strike through.
+ pub const DEPRECATED: DiagnosticTag = DiagnosticTag(2);
+}
+}
+
+/// Represents a reference to a command. Provides a title which will be used to represent a command in the UI.
+/// Commands are identitifed using a string identifier and the protocol currently doesn't specify a set of
+/// well known commands. So executing a command requires some tool extension code.
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct Command {
+ /// Title of the command, like `save`.
+ pub title: String,
+ /// The identifier of the actual command handler.
+ pub command: String,
+ /// Arguments that the command handler should be
+ /// invoked with.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub arguments: Option<Vec<Value>>,
+}
+
+impl Command {
+ pub fn new(title: String, command: String, arguments: Option<Vec<Value>>) -> Command {
+ Command {
+ title,
+ command,
+ arguments,
+ }
+ }
+}
+
+/// A textual edit applicable to a text document.
+///
+/// If n `TextEdit`s are applied to a text document all text edits describe changes to the initial document version.
+/// Execution wise text edits should applied from the bottom to the top of the text document. Overlapping text edits
+/// are not supported.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextEdit {
+ /// The range of the text document to be manipulated. To insert
+ /// text into a document create a range where start === end.
+ pub range: Range,
+ /// The string to be inserted. For delete operations use an
+ /// empty string.
+ pub new_text: String,
+}
+
+impl TextEdit {
+ pub fn new(range: Range, new_text: String) -> TextEdit {
+ TextEdit { range, new_text }
+ }
+}
+
+/// An identifier referring to a change annotation managed by a workspace
+/// edit.
+///
+/// @since 3.16.0.
+pub type ChangeAnnotationIdentifier = String;
+
+/// A special text edit with an additional change annotation.
+///
+/// @since 3.16.0.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AnnotatedTextEdit {
+ #[serde(flatten)]
+ pub text_edit: TextEdit,
+
+ /// The actual annotation
+ pub annotation_id: ChangeAnnotationIdentifier,
+}
+
+/// Describes textual changes on a single text document. The text document is referred to as a
+/// `OptionalVersionedTextDocumentIdentifier` to allow clients to check the text document version before an
+/// edit is applied. A `TextDocumentEdit` describes all changes on a version Si and after they are
+/// applied move the document to version Si+1. So the creator of a `TextDocumentEdit` doesn't need to
+/// sort the array or do any kind of ordering. However the edits must be non overlapping.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentEdit {
+ /// The text document to change.
+ pub text_document: OptionalVersionedTextDocumentIdentifier,
+
+ /// The edits to be applied.
+ ///
+ /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the
+ /// client capability `workspace.workspaceEdit.changeAnnotationSupport`
+ pub edits: Vec<OneOf<TextEdit, AnnotatedTextEdit>>,
+}
+
+/// Additional information that describes document changes.
+///
+/// @since 3.16.0.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChangeAnnotation {
+ /// A human-readable string describing the actual change. The string
+ /// is rendered prominent in the user interface.
+ pub label: String,
+
+ /// A flag which indicates that user confirmation is needed
+ /// before applying the change.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub needs_confirmation: Option<bool>,
+
+ /// A human-readable string which is rendered less prominent in
+ /// the user interface.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChangeAnnotationWorkspaceEditClientCapabilities {
+ /// Whether the client groups edits with equal labels into tree nodes,
+ /// for instance all edits labelled with "Changes in Strings" would
+ /// be a tree node.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub groups_on_label: Option<bool>,
+}
+
+/// Options to create a file.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateFileOptions {
+ /// Overwrite existing file. Overwrite wins over `ignoreIfExists`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub overwrite: Option<bool>,
+ /// Ignore if exists.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ignore_if_exists: Option<bool>,
+}
+
+/// Create file operation
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateFile {
+ /// The resource to create.
+ pub uri: Url,
+ /// Additional options
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub options: Option<CreateFileOptions>,
+
+ /// An optional annotation identifer describing the operation.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub annotation_id: Option<ChangeAnnotationIdentifier>,
+}
+
+/// Rename file options
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameFileOptions {
+ /// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub overwrite: Option<bool>,
+ /// Ignores if target exists.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ignore_if_exists: Option<bool>,
+}
+
+/// Rename file operation
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameFile {
+ /// The old (existing) location.
+ pub old_uri: Url,
+ /// The new location.
+ pub new_uri: Url,
+ /// Rename options.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub options: Option<RenameFileOptions>,
+
+ /// An optional annotation identifer describing the operation.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub annotation_id: Option<ChangeAnnotationIdentifier>,
+}
+
+/// Delete file options
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeleteFileOptions {
+ /// Delete the content recursively if a folder is denoted.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub recursive: Option<bool>,
+ /// Ignore the operation if the file doesn't exist.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ignore_if_not_exists: Option<bool>,
+
+ /// An optional annotation identifer describing the operation.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub annotation_id: Option<ChangeAnnotationIdentifier>,
+}
+
+/// Delete file operation
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeleteFile {
+ /// The file to delete.
+ pub uri: Url,
+ /// Delete options.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub options: Option<DeleteFileOptions>,
+}
+
+/// A workspace edit represents changes to many resources managed in the workspace.
+/// The edit should either provide `changes` or `documentChanges`.
+/// If the client can handle versioned document edits and if `documentChanges` are present,
+/// the latter are preferred over `changes`.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceEdit {
+ /// Holds changes to existing resources.
+ #[serde(with = "url_map")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[serde(default)]
+ pub changes: Option<HashMap<Url, Vec<TextEdit>>>, // changes?: { [uri: string]: TextEdit[]; };
+
+ /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
+ /// are either an array of `TextDocumentEdit`s to express changes to n different text documents
+ /// where each text document edit addresses a specific version of a text document. Or it can contain
+ /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
+ ///
+ /// Whether a client supports versioned document edits is expressed via
+ /// `workspace.workspaceEdit.documentChanges` client capability.
+ ///
+ /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
+ /// only plain `TextEdit`s using the `changes` property are supported.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_changes: Option<DocumentChanges>,
+
+ /// A map of change annotations that can be referenced in
+ /// `AnnotatedTextEdit`s or create, rename and delete file / folder
+ /// operations.
+ ///
+ /// Whether clients honor this property depends on the client capability
+ /// `workspace.changeAnnotationSupport`.
+ ///
+ /// @since 3.16.0
+ ///
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub change_annotations: Option<HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum DocumentChanges {
+ Edits(Vec<TextDocumentEdit>),
+ Operations(Vec<DocumentChangeOperation>),
+}
+
+// TODO: Once https://github.com/serde-rs/serde/issues/912 is solved
+// we can remove ResourceOp and switch to the following implementation
+// of DocumentChangeOperation:
+//
+// #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+// #[serde(tag = "kind", rename_all="lowercase" )]
+// pub enum DocumentChangeOperation {
+// Create(CreateFile),
+// Rename(RenameFile),
+// Delete(DeleteFile),
+//
+// #[serde(other)]
+// Edit(TextDocumentEdit),
+// }
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged, rename_all = "lowercase")]
+pub enum DocumentChangeOperation {
+ Op(ResourceOp),
+ Edit(TextDocumentEdit),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(tag = "kind", rename_all = "lowercase")]
+pub enum ResourceOp {
+ Create(CreateFile),
+ Rename(RenameFile),
+ Delete(DeleteFile),
+}
+
+pub type DidChangeConfigurationClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ConfigurationParams {
+ pub items: Vec<ConfigurationItem>,
+}
+
+#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ConfigurationItem {
+ /// The scope to get the configuration section for.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub scope_uri: Option<Url>,
+
+ ///The configuration section asked for.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub section: Option<String>,
+}
+
+mod url_map {
+ use std::fmt;
+
+ use super::*;
+
+ pub fn deserialize<'de, D>(
+ deserializer: D,
+ ) -> Result<Option<HashMap<Url, Vec<TextEdit>>>, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct UrlMapVisitor;
+ impl<'de> de::Visitor<'de> for UrlMapVisitor {
+ type Value = HashMap<Url, Vec<TextEdit>>;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("map")
+ }
+
+ fn visit_map<M>(self, mut visitor: M) -> Result<Self::Value, M::Error>
+ where
+ M: de::MapAccess<'de>,
+ {
+ let mut values = HashMap::with_capacity(visitor.size_hint().unwrap_or(0));
+
+ // While there are entries remaining in the input, add them
+ // into our map.
+ while let Some((key, value)) = visitor.next_entry::<Url, _>()? {
+ values.insert(key, value);
+ }
+
+ Ok(values)
+ }
+ }
+
+ struct OptionUrlMapVisitor;
+ impl<'de> de::Visitor<'de> for OptionUrlMapVisitor {
+ type Value = Option<HashMap<Url, Vec<TextEdit>>>;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("option")
+ }
+
+ #[inline]
+ fn visit_unit<E>(self) -> Result<Self::Value, E>
+ where
+ E: serde::de::Error,
+ {
+ Ok(None)
+ }
+
+ #[inline]
+ fn visit_none<E>(self) -> Result<Self::Value, E>
+ where
+ E: serde::de::Error,
+ {
+ Ok(None)
+ }
+
+ #[inline]
+ fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ deserializer.deserialize_map(UrlMapVisitor).map(Some)
+ }
+ }
+
+ // Instantiate our Visitor and ask the Deserializer to drive
+ // it over the input data, resulting in an instance of MyMap.
+ deserializer.deserialize_option(OptionUrlMapVisitor)
+ }
+
+ pub fn serialize<S>(
+ changes: &Option<HashMap<Url, Vec<TextEdit>>>,
+ serializer: S,
+ ) -> Result<S::Ok, S::Error>
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeMap;
+
+ match *changes {
+ Some(ref changes) => {
+ let mut map = serializer.serialize_map(Some(changes.len()))?;
+ for (k, v) in changes {
+ map.serialize_entry(k.as_str(), v)?;
+ }
+ map.end()
+ }
+ None => serializer.serialize_none(),
+ }
+ }
+}
+
+impl WorkspaceEdit {
+ pub fn new(changes: HashMap<Url, Vec<TextEdit>>) -> WorkspaceEdit {
+ WorkspaceEdit {
+ changes: Some(changes),
+ document_changes: None,
+ ..Default::default()
+ }
+ }
+}
+
+/// Text documents are identified using a URI. On the protocol level, URIs are passed as strings.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct TextDocumentIdentifier {
+ // !!!!!! Note:
+ // In the spec VersionedTextDocumentIdentifier extends TextDocumentIdentifier
+ // This modelled by "mixing-in" TextDocumentIdentifier in VersionedTextDocumentIdentifier,
+ // so any changes to this type must be effected in the sub-type as well.
+ /// The text document's URI.
+ pub uri: Url,
+}
+
+impl TextDocumentIdentifier {
+ pub fn new(uri: Url) -> TextDocumentIdentifier {
+ TextDocumentIdentifier { uri }
+ }
+}
+
+/// An item to transfer a text document from the client to the server.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentItem {
+ /// The text document's URI.
+ pub uri: Url,
+
+ /// The text document's language identifier.
+ pub language_id: String,
+
+ /// The version number of this document (it will strictly increase after each
+ /// change, including undo/redo).
+ pub version: i32,
+
+ /// The content of the opened text document.
+ pub text: String,
+}
+
+impl TextDocumentItem {
+ pub fn new(uri: Url, language_id: String, version: i32, text: String) -> TextDocumentItem {
+ TextDocumentItem {
+ uri,
+ language_id,
+ version,
+ text,
+ }
+ }
+}
+
+/// An identifier to denote a specific version of a text document. This information usually flows from the client to the server.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct VersionedTextDocumentIdentifier {
+ // This field was "mixed-in" from TextDocumentIdentifier
+ /// The text document's URI.
+ pub uri: Url,
+
+ /// The version number of this document.
+ ///
+ /// The version number of a document will increase after each change,
+ /// including undo/redo. The number doesn't need to be consecutive.
+ pub version: i32,
+}
+
+impl VersionedTextDocumentIdentifier {
+ pub fn new(uri: Url, version: i32) -> VersionedTextDocumentIdentifier {
+ VersionedTextDocumentIdentifier { uri, version }
+ }
+}
+
+/// An identifier which optionally denotes a specific version of a text document. This information usually flows from the server to the client
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct OptionalVersionedTextDocumentIdentifier {
+ // This field was "mixed-in" from TextDocumentIdentifier
+ /// The text document's URI.
+ pub uri: Url,
+
+ /// The version number of this document. If an optional versioned text document
+ /// identifier is sent from the server to the client and the file is not
+ /// open in the editor (the server has not received an open notification
+ /// before) the server can send `null` to indicate that the version is
+ /// known and the content on disk is the master (as specified with document
+ /// content ownership).
+ ///
+ /// The version number of a document will increase after each change,
+ /// including undo/redo. The number doesn't need to be consecutive.
+ pub version: Option<i32>,
+}
+
+impl OptionalVersionedTextDocumentIdentifier {
+ pub fn new(uri: Url, version: i32) -> OptionalVersionedTextDocumentIdentifier {
+ OptionalVersionedTextDocumentIdentifier {
+ uri,
+ version: Some(version),
+ }
+ }
+}
+
+/// A parameter literal used in requests to pass a text document and a position inside that document.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentPositionParams {
+ // !!!!!! Note:
+ // In the spec ReferenceParams extends TextDocumentPositionParams
+ // This modelled by "mixing-in" TextDocumentPositionParams in ReferenceParams,
+ // so any changes to this type must be effected in sub-type as well.
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The position inside the text document.
+ pub position: Position,
+}
+
+impl TextDocumentPositionParams {
+ pub fn new(
+ text_document: TextDocumentIdentifier,
+ position: Position,
+ ) -> TextDocumentPositionParams {
+ TextDocumentPositionParams {
+ text_document,
+ position,
+ }
+ }
+}
+
+/// A document filter denotes a document through properties like language, schema or pattern.
+/// Examples are a filter that applies to TypeScript files on disk or a filter the applies to JSON
+/// files with name package.json:
+///
+/// { language: 'typescript', scheme: 'file' }
+/// { language: 'json', pattern: '**/package.json' }
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DocumentFilter {
+ /// A language id, like `typescript`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub language: Option<String>,
+
+ /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub scheme: Option<String>,
+
+ /// A glob pattern, like `*.{ts,js}`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub pattern: Option<String>,
+}
+
+/// A document selector is the combination of one or many document filters.
+pub type DocumentSelector = Vec<DocumentFilter>;
+
+// ========================= Actual Protocol =========================
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, Default)]
+#[serde(rename_all = "camelCase")]
+pub struct InitializeParams {
+ /// The process Id of the parent process that started
+ /// the server. Is null if the process has not been started by another process.
+ /// If the parent process is not alive then the server should exit (see exit notification) its process.
+ pub process_id: Option<u32>,
+
+ /// The rootPath of the workspace. Is null
+ /// if no folder is open.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[deprecated(note = "Use `root_uri` instead when possible")]
+ pub root_path: Option<String>,
+
+ /// The rootUri of the workspace. Is null if no
+ /// folder is open. If both `rootPath` and `rootUri` are set
+ /// `rootUri` wins.
+ ///
+ /// Deprecated in favour of `workspaceFolders`
+ #[serde(default)]
+ pub root_uri: Option<Url>,
+
+ /// User provided initialization options.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub initialization_options: Option<Value>,
+
+ /// The capabilities provided by the client (editor or tool)
+ pub capabilities: ClientCapabilities,
+
+ /// The initial trace setting. If omitted trace is disabled ('off').
+ #[serde(default)]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trace: Option<TraceValue>,
+
+ /// The workspace folders configured in the client when the server starts.
+ /// This property is only available if the client supports workspace folders.
+ /// It can be `null` if the client supports workspace folders but none are
+ /// configured.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace_folders: Option<Vec<WorkspaceFolder>>,
+
+ /// Information about the client.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub client_info: Option<ClientInfo>,
+
+ /// The locale the client is currently showing the user interface
+ /// in. This must not necessarily be the locale of the operating
+ /// system.
+ ///
+ /// Uses IETF language tags as the value's syntax
+ /// (See <https://en.wikipedia.org/wiki/IETF_language_tag>)
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub locale: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+pub struct ClientInfo {
+ /// The name of the client as defined by the client.
+ pub name: String,
+ /// The client's version as defined by the client.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Clone, Copy, Deserialize, Serialize)]
+pub struct InitializedParams {}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct GenericRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub options: GenericOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct GenericOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct GenericParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DynamicRegistrationClientCapabilities {
+ /// This capability supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GotoCapability {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client supports additional metadata in the form of definition links.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub link_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceEditClientCapabilities {
+ /// The client supports versioned document changes in `WorkspaceEdit`s
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_changes: Option<bool>,
+
+ /// The resource operations the client supports. Clients should at least
+ /// support 'create', 'rename' and 'delete' files and folders.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resource_operations: Option<Vec<ResourceOperationKind>>,
+
+ /// The failure handling strategy of a client if applying the workspace edit
+ /// failes.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub failure_handling: Option<FailureHandlingKind>,
+
+ /// Whether the client normalizes line endings to the client specific
+ /// setting.
+ /// If set to `true` the client will normalize line ending characters
+ /// in a workspace edit containg to the client specific new line
+ /// character.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub normalizes_line_endings: Option<bool>,
+
+ /// Whether the client in general supports change annotations on text edits,
+ /// create file, rename file and delete file changes.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub change_annotation_support: Option<ChangeAnnotationWorkspaceEditClientCapabilities>,
+}
+
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum ResourceOperationKind {
+ Create,
+ Rename,
+ Delete,
+}
+
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
+#[serde(rename_all = "camelCase")]
+pub enum FailureHandlingKind {
+ Abort,
+ Transactional,
+ TextOnlyTransactional,
+ Undo,
+}
+
+/// A symbol kind.
+#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct SymbolKind(i32);
+lsp_enum! {
+impl SymbolKind {
+ pub const FILE: SymbolKind = SymbolKind(1);
+ pub const MODULE: SymbolKind = SymbolKind(2);
+ pub const NAMESPACE: SymbolKind = SymbolKind(3);
+ pub const PACKAGE: SymbolKind = SymbolKind(4);
+ pub const CLASS: SymbolKind = SymbolKind(5);
+ pub const METHOD: SymbolKind = SymbolKind(6);
+ pub const PROPERTY: SymbolKind = SymbolKind(7);
+ pub const FIELD: SymbolKind = SymbolKind(8);
+ pub const CONSTRUCTOR: SymbolKind = SymbolKind(9);
+ pub const ENUM: SymbolKind = SymbolKind(10);
+ pub const INTERFACE: SymbolKind = SymbolKind(11);
+ pub const FUNCTION: SymbolKind = SymbolKind(12);
+ pub const VARIABLE: SymbolKind = SymbolKind(13);
+ pub const CONSTANT: SymbolKind = SymbolKind(14);
+ pub const STRING: SymbolKind = SymbolKind(15);
+ pub const NUMBER: SymbolKind = SymbolKind(16);
+ pub const BOOLEAN: SymbolKind = SymbolKind(17);
+ pub const ARRAY: SymbolKind = SymbolKind(18);
+ pub const OBJECT: SymbolKind = SymbolKind(19);
+ pub const KEY: SymbolKind = SymbolKind(20);
+ pub const NULL: SymbolKind = SymbolKind(21);
+ pub const ENUM_MEMBER: SymbolKind = SymbolKind(22);
+ pub const STRUCT: SymbolKind = SymbolKind(23);
+ pub const EVENT: SymbolKind = SymbolKind(24);
+ pub const OPERATOR: SymbolKind = SymbolKind(25);
+ pub const TYPE_PARAMETER: SymbolKind = SymbolKind(26);
+}
+}
+
+/// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SymbolKindCapability {
+ /// The symbol kind values the client supports. When this
+ /// property exists the client also guarantees that it will
+ /// handle values outside its set gracefully and falls back
+ /// to a default value when unknown.
+ ///
+ /// If this property is not present the client only supports
+ /// the symbol kinds from `File` to `Array` as defined in
+ /// the initial version of the protocol.
+ pub value_set: Option<Vec<SymbolKind>>,
+}
+
+/// Workspace specific client capabilities.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceClientCapabilities {
+ /// The client supports applying batch edits to the workspace by supporting
+ /// the request 'workspace/applyEdit'
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub apply_edit: Option<bool>,
+
+ /// Capabilities specific to `WorkspaceEdit`s
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace_edit: Option<WorkspaceEditClientCapabilities>,
+
+ /// Capabilities specific to the `workspace/didChangeConfiguration` notification.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_change_configuration: Option<DidChangeConfigurationClientCapabilities>,
+
+ /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>,
+
+ /// Capabilities specific to the `workspace/symbol` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub symbol: Option<WorkspaceSymbolClientCapabilities>,
+
+ /// Capabilities specific to the `workspace/executeCommand` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub execute_command: Option<ExecuteCommandClientCapabilities>,
+
+ /// The client has support for workspace folders.
+ /// since 3.6.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace_folders: Option<bool>,
+
+ /// The client supports `workspace/configuration` requests.
+ /// since 3.6.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub configuration: Option<bool>,
+
+ /// Capabilities specific to the semantic token requsts scoped to the workspace.
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>,
+
+ /// Capabilities specific to the code lens requests scoped to the workspace.
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_lens: Option<CodeLensWorkspaceClientCapabilities>,
+
+ /// The client has support for file requests/notifications.
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub file_operations: Option<WorkspaceFileOperationsClientCapabilities>,
+
+ /// Client workspace capabilities specific to inline values.
+ /// since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inline_value: Option<InlineValueWorkspaceClientCapabilities>,
+
+ /// Client workspace capabilities specific to inlay hints.
+ /// since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentSyncClientCapabilities {
+ /// Whether text document synchronization supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client supports sending will save notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_save: Option<bool>,
+
+ /// The client supports sending a will save request and
+ /// waits for a response providing text edits which will
+ /// be applied to the document before it is saved.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_save_wait_until: Option<bool>,
+
+ /// The client supports did save notifications.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub did_save: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PublishDiagnosticsClientCapabilities {
+ /// Whether the clients accepts diagnostics with related information.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub related_information: Option<bool>,
+
+ /// Client supports the tag property to provide meta data about a diagnostic.
+ /// Clients supporting tags have to handle unknown tags gracefully.
+ #[serde(
+ default,
+ skip_serializing_if = "Option::is_none",
+ deserialize_with = "TagSupport::deserialize_compat"
+ )]
+ pub tag_support: Option<TagSupport<DiagnosticTag>>,
+
+ /// Whether the client interprets the version property of the
+ /// `textDocument/publishDiagnostics` notification's parameter.
+ ///
+ /// 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version_support: Option<bool>,
+
+ /// Client supports a codeDescription property
+ ///
+ /// 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_description_support: Option<bool>,
+
+ /// Whether code action supports the `data` property which is
+ /// preserved between a `textDocument/publishDiagnostics` and
+ /// `textDocument/codeAction` request.
+ ///
+ /// 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TagSupport<T> {
+ /// The tags supported by the client.
+ pub value_set: Vec<T>,
+}
+
+impl<T> TagSupport<T> {
+ /// Support for deserializing a boolean tag Support, in case it's present.
+ ///
+ /// This is currently the case for vscode 1.41.1
+ fn deserialize_compat<'de, S>(serializer: S) -> Result<Option<TagSupport<T>>, S::Error>
+ where
+ S: serde::Deserializer<'de>,
+ T: serde::Deserialize<'de>,
+ {
+ Ok(
+ match Option::<Value>::deserialize(serializer).map_err(serde::de::Error::custom)? {
+ Some(Value::Bool(false)) => None,
+ Some(Value::Bool(true)) => Some(TagSupport { value_set: vec![] }),
+ Some(other) => {
+ Some(TagSupport::<T>::deserialize(other).map_err(serde::de::Error::custom)?)
+ }
+ None => None,
+ },
+ )
+ }
+}
+
+/// Text document specific client capabilities.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentClientCapabilities {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub synchronization: Option<TextDocumentSyncClientCapabilities>,
+ /// Capabilities specific to the `textDocument/completion`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion: Option<CompletionClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/hover`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub hover: Option<HoverClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/signatureHelp`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub signature_help: Option<SignatureHelpClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/references`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub references: Option<ReferenceClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/documentHighlight`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_highlight: Option<DocumentHighlightClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/documentSymbol`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_symbol: Option<DocumentSymbolClientCapabilities>,
+ /// Capabilities specific to the `textDocument/formatting`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub formatting: Option<DocumentFormattingClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/rangeFormatting`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range_formatting: Option<DocumentRangeFormattingClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/onTypeFormatting`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/declaration`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub declaration: Option<GotoCapability>,
+
+ /// Capabilities specific to the `textDocument/definition`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub definition: Option<GotoCapability>,
+
+ /// Capabilities specific to the `textDocument/typeDefinition`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub type_definition: Option<GotoCapability>,
+
+ /// Capabilities specific to the `textDocument/implementation`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub implementation: Option<GotoCapability>,
+
+ /// Capabilities specific to the `textDocument/codeAction`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_action: Option<CodeActionClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/codeLens`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_lens: Option<CodeLensClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/documentLink`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_link: Option<DocumentLinkClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/documentColor` and the
+ /// `textDocument/colorPresentation` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub color_provider: Option<DocumentColorClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/rename`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub rename: Option<RenameClientCapabilities>,
+
+ /// Capabilities specific to `textDocument/publishDiagnostics`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>,
+
+ /// Capabilities specific to `textDocument/foldingRange` requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub folding_range: Option<FoldingRangeClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/selectionRange` request.
+ ///
+ /// @since 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub selection_range: Option<SelectionRangeClientCapabilities>,
+
+ /// Capabilities specific to `textDocument/linkedEditingRange` requests.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub linked_editing_range: Option<LinkedEditingRangeClientCapabilities>,
+
+ /// Capabilities specific to the various call hierarchy requests.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub call_hierarchy: Option<CallHierarchyClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/semanticTokens/*` requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub semantic_tokens: Option<SemanticTokensClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/moniker` request.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub moniker: Option<MonikerClientCapabilities>,
+
+ /// Capabilities specific to the various type hierarchy requests.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub type_hierarchy: Option<TypeHierarchyClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/inlineValue` request.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inline_value: Option<InlineValueClientCapabilities>,
+
+ /// Capabilities specific to the `textDocument/inlayHint` request.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inlay_hint: Option<InlayHintClientCapabilities>,
+}
+
+/// Where ClientCapabilities are currently empty:
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ClientCapabilities {
+ /// Workspace specific client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace: Option<WorkspaceClientCapabilities>,
+
+ /// Text document specific client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text_document: Option<TextDocumentClientCapabilities>,
+
+ /// Window specific client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub window: Option<WindowClientCapabilities>,
+
+ /// General client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub general: Option<GeneralClientCapabilities>,
+
+ /// Unofficial UT8-offsets extension.
+ ///
+ /// See https://clangd.llvm.org/extensions.html#utf-8-offsets.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[cfg(feature = "proposed")]
+ pub offset_encoding: Option<Vec<String>>,
+
+ /// Experimental client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub experimental: Option<Value>,
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GeneralClientCapabilities {
+ /// Client capabilities specific to regular expressions.
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub regular_expressions: Option<RegularExpressionsClientCapabilities>,
+
+ /// Client capabilities specific to the client's markdown parser.
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub markdown: Option<MarkdownClientCapabilities>,
+
+ /// Client capability that signals how the client handles stale requests (e.g. a request for
+ /// which the client will not process the response anymore since the information is outdated).
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub stale_request_support: Option<StaleRequestSupportClientCapabilities>,
+
+ /// The position encodings supported by the client. Client and server
+ /// have to agree on the same position encoding to ensure that offsets
+ /// (e.g. character position in a line) are interpreted the same on both
+ /// side.
+ ///
+ /// To keep the protocol backwards compatible the following applies: if
+ /// the value 'utf-16' is missing from the array of position encodings
+ /// servers can assume that the client supports UTF-16. UTF-16 is
+ /// therefore a mandatory encoding.
+ ///
+ /// If omitted it defaults to ['utf-16'].
+ ///
+ /// Implementation considerations: since the conversion from one encoding
+ /// into another requires the content of the file / line the conversion
+ /// is best done where the file is read which is usually on the server
+ /// side.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub position_encodings: Option<Vec<PositionEncodingKind>>,
+}
+
+/// Client capability that signals how the client
+/// handles stale requests (e.g. a request
+/// for which the client will not process the response
+/// anymore since the information is outdated).
+///
+/// @since 3.17.0
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StaleRequestSupportClientCapabilities {
+ /// The client will actively cancel the request.
+ pub cancel: bool,
+
+ /// The list of requests for which the client
+ /// will retry the request if it receives a
+ /// response with error code `ContentModified``
+ pub retry_on_content_modified: Vec<String>,
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RegularExpressionsClientCapabilities {
+ /// The engine's name.
+ pub engine: String,
+
+ /// The engine's version
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MarkdownClientCapabilities {
+ /// The name of the parser.
+ pub parser: String,
+
+ /// The version of the parser.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+
+ /// A list of HTML tags that the client allows / supports in
+ /// Markdown.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub allowed_tags: Option<Vec<String>>,
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InitializeResult {
+ /// The capabilities the language server provides.
+ pub capabilities: ServerCapabilities,
+
+ /// Information about the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub server_info: Option<ServerInfo>,
+
+ /// Unofficial UT8-offsets extension.
+ ///
+ /// See https://clangd.llvm.org/extensions.html#utf-8-offsets.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[cfg(feature = "proposed")]
+ pub offset_encoding: Option<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct ServerInfo {
+ /// The name of the server as defined by the server.
+ pub name: String,
+ /// The servers's version as defined by the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct InitializeError {
+ /// Indicates whether the client should retry to send the
+ /// initilize request after showing the message provided
+ /// in the ResponseError.
+ pub retry: bool,
+}
+
+// The server can signal the following capabilities:
+
+/// Defines how the host (editor) should sync document changes to the language server.
+#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct TextDocumentSyncKind(i32);
+lsp_enum! {
+impl TextDocumentSyncKind {
+ /// Documents should not be synced at all.
+ pub const NONE: TextDocumentSyncKind = TextDocumentSyncKind(0);
+
+ /// Documents are synced by always sending the full content of the document.
+ pub const FULL: TextDocumentSyncKind = TextDocumentSyncKind(1);
+
+ /// Documents are synced by sending the full content on open. After that only
+ /// incremental updates to the document are sent.
+ pub const INCREMENTAL: TextDocumentSyncKind = TextDocumentSyncKind(2);
+}
+}
+
+pub type ExecuteCommandClientCapabilities = DynamicRegistrationClientCapabilities;
+
+/// Execute command options.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct ExecuteCommandOptions {
+ /// The commands to be executed on the server
+ pub commands: Vec<String>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+/// Save options.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SaveOptions {
+ /// The client is supposed to include the content on save.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub include_text: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum TextDocumentSyncSaveOptions {
+ Supported(bool),
+ SaveOptions(SaveOptions),
+}
+
+impl From<SaveOptions> for TextDocumentSyncSaveOptions {
+ fn from(from: SaveOptions) -> Self {
+ Self::SaveOptions(from)
+ }
+}
+
+impl From<bool> for TextDocumentSyncSaveOptions {
+ fn from(from: bool) -> Self {
+ Self::Supported(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentSyncOptions {
+ /// Open and close notifications are sent to the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub open_close: Option<bool>,
+
+ /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
+ /// and TextDocumentSyncKindIncremental.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub change: Option<TextDocumentSyncKind>,
+
+ /// Will save notifications are sent to the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_save: Option<bool>,
+
+ /// Will save wait until requests are sent to the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub will_save_wait_until: Option<bool>,
+
+ /// Save notifications are sent to the server.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub save: Option<TextDocumentSyncSaveOptions>,
+}
+
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum OneOf<A, B> {
+ Left(A),
+ Right(B),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum TextDocumentSyncCapability {
+ Kind(TextDocumentSyncKind),
+ Options(TextDocumentSyncOptions),
+}
+
+impl From<TextDocumentSyncOptions> for TextDocumentSyncCapability {
+ fn from(from: TextDocumentSyncOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<TextDocumentSyncKind> for TextDocumentSyncCapability {
+ fn from(from: TextDocumentSyncKind) -> Self {
+ Self::Kind(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum ImplementationProviderCapability {
+ Simple(bool),
+ Options(StaticTextDocumentRegistrationOptions),
+}
+
+impl From<StaticTextDocumentRegistrationOptions> for ImplementationProviderCapability {
+ fn from(from: StaticTextDocumentRegistrationOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for ImplementationProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum TypeDefinitionProviderCapability {
+ Simple(bool),
+ Options(StaticTextDocumentRegistrationOptions),
+}
+
+impl From<StaticTextDocumentRegistrationOptions> for TypeDefinitionProviderCapability {
+ fn from(from: StaticTextDocumentRegistrationOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for TypeDefinitionProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ServerCapabilities {
+ /// The position encoding the server picked from the encodings offered
+ /// by the client via the client capability `general.positionEncodings`.
+ ///
+ /// If the client didn't provide any position encodings the only valid
+ /// value that a server can return is 'utf-16'.
+ ///
+ /// If omitted it defaults to 'utf-16'.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub position_encoding: Option<PositionEncodingKind>,
+
+ /// Defines how text documents are synced.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text_document_sync: Option<TextDocumentSyncCapability>,
+
+ /// Capabilities specific to `textDocument/selectionRange` requests.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub selection_range_provider: Option<SelectionRangeProviderCapability>,
+
+ /// The server provides hover support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub hover_provider: Option<HoverProviderCapability>,
+
+ /// The server provides completion support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub completion_provider: Option<CompletionOptions>,
+
+ /// The server provides signature help support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub signature_help_provider: Option<SignatureHelpOptions>,
+
+ /// The server provides goto definition support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub definition_provider: Option<OneOf<bool, DefinitionOptions>>,
+
+ /// The server provides goto type definition support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub type_definition_provider: Option<TypeDefinitionProviderCapability>,
+
+ /// The server provides goto implementation support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub implementation_provider: Option<ImplementationProviderCapability>,
+
+ /// The server provides find references support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub references_provider: Option<OneOf<bool, ReferencesOptions>>,
+
+ /// The server provides document highlight support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_highlight_provider: Option<OneOf<bool, DocumentHighlightOptions>>,
+
+ /// The server provides document symbol support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_symbol_provider: Option<OneOf<bool, DocumentSymbolOptions>>,
+
+ /// The server provides workspace symbol support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace_symbol_provider: Option<OneOf<bool, WorkspaceSymbolOptions>>,
+
+ /// The server provides code actions.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_action_provider: Option<CodeActionProviderCapability>,
+
+ /// The server provides code lens.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub code_lens_provider: Option<CodeLensOptions>,
+
+ /// The server provides document formatting.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_formatting_provider: Option<OneOf<bool, DocumentFormattingOptions>>,
+
+ /// The server provides document range formatting.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_range_formatting_provider: Option<OneOf<bool, DocumentRangeFormattingOptions>>,
+
+ /// The server provides document formatting on typing.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>,
+
+ /// The server provides rename support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub rename_provider: Option<OneOf<bool, RenameOptions>>,
+
+ /// The server provides document link support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub document_link_provider: Option<DocumentLinkOptions>,
+
+ /// The server provides color provider support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub color_provider: Option<ColorProviderCapability>,
+
+ /// The server provides folding provider support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub folding_range_provider: Option<FoldingRangeProviderCapability>,
+
+ /// The server provides go to declaration support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub declaration_provider: Option<DeclarationCapability>,
+
+ /// The server provides execute command support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub execute_command_provider: Option<ExecuteCommandOptions>,
+
+ /// Workspace specific server capabilities
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace: Option<WorkspaceServerCapabilities>,
+
+ /// Call hierarchy provider capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub call_hierarchy_provider: Option<CallHierarchyServerCapability>,
+
+ /// Semantic tokens server capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub semantic_tokens_provider: Option<SemanticTokensServerCapabilities>,
+
+ /// Whether server provides moniker support.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub moniker_provider: Option<OneOf<bool, MonikerServerCapabilities>>,
+
+ /// The server provides inline values.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inline_value_provider: Option<OneOf<bool, InlineValueServerCapabilities>>,
+
+ /// The server provides inlay hints.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub inlay_hint_provider: Option<OneOf<bool, InlayHintServerCapabilities>>,
+
+ /// The server provides linked editing range support.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub linked_editing_range_provider: Option<LinkedEditingRangeServerCapabilities>,
+
+ /// Experimental server capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub experimental: Option<Value>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceServerCapabilities {
+ /// The server supports workspace folder.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub workspace_folders: Option<WorkspaceFoldersServerCapabilities>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub file_operations: Option<WorkspaceFileOperationsServerCapabilities>,
+}
+
+/// General parameters to to register for a capability.
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Registration {
+ /// The id used to register the request. The id can be used to deregister
+ /// the request again.
+ pub id: String,
+
+ /// The method / capability to register for.
+ pub method: String,
+
+ /// Options necessary for the registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub register_options: Option<Value>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+pub struct RegistrationParams {
+ pub registrations: Vec<Registration>,
+}
+
+/// Since most of the registration options require to specify a document selector there is a base
+/// interface that can be used.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentRegistrationOptions {
+ /// A document selector to identify the scope of the registration. If set to null
+ /// the document selector provided on the client side will be used.
+ pub document_selector: Option<DocumentSelector>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum DeclarationCapability {
+ Simple(bool),
+ RegistrationOptions(DeclarationRegistrationOptions),
+ Options(DeclarationOptions),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeclarationRegistrationOptions {
+ #[serde(flatten)]
+ pub declaration_options: DeclarationOptions,
+
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeclarationOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StaticRegistrationOptions {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub id: Option<String>,
+}
+
+#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressOptions {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub work_done_progress: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentFormattingOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentRangeFormattingOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DefinitionOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentSymbolOptions {
+ /// A human-readable string that is shown when multiple outlines trees are
+ /// shown for the same document.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label: Option<String>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ReferencesOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DocumentHighlightOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceSymbolOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+
+ /// The server provides support to resolve additional
+ /// information for a workspace symbol.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_provider: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StaticTextDocumentRegistrationOptions {
+ /// A document selector to identify the scope of the registration. If set to null
+ /// the document selector provided on the client side will be used.
+ pub document_selector: Option<DocumentSelector>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub id: Option<String>,
+}
+
+/// General parameters to unregister a capability.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct Unregistration {
+ /// The id used to unregister the request or notification. Usually an id
+ /// provided during the register request.
+ pub id: String,
+
+ /// The method / capability to unregister for.
+ pub method: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct UnregistrationParams {
+ pub unregisterations: Vec<Unregistration>,
+}
+
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DidChangeConfigurationParams {
+ /// The actual changed settings
+ pub settings: Value,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidOpenTextDocumentParams {
+ /// The document that was opened.
+ pub text_document: TextDocumentItem,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidChangeTextDocumentParams {
+ /// The document that did change. The version number points
+ /// to the version after all provided content changes have
+ /// been applied.
+ pub text_document: VersionedTextDocumentIdentifier,
+ /// The actual content changes.
+ pub content_changes: Vec<TextDocumentContentChangeEvent>,
+}
+
+/// An event describing a change to a text document. If range and rangeLength are omitted
+/// the new text is considered to be the full content of the document.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentContentChangeEvent {
+ /// The range of the document that changed.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range: Option<Range>,
+
+ /// The length of the range that got replaced.
+ ///
+ /// Deprecated: Use range instead
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range_length: Option<u32>,
+
+ /// The new text of the document.
+ pub text: String,
+}
+
+/// Descibe options to be used when registered for text document change events.
+///
+/// Extends TextDocumentRegistrationOptions
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentChangeRegistrationOptions {
+ /// A document selector to identify the scope of the registration. If set to null
+ /// the document selector provided on the client side will be used.
+ pub document_selector: Option<DocumentSelector>,
+
+ /// How documents are synced to the server. See TextDocumentSyncKind.Full
+ /// and TextDocumentSyncKindIncremental.
+ pub sync_kind: i32,
+}
+
+/// The parameters send in a will save text document notification.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WillSaveTextDocumentParams {
+ /// The document that will be saved.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The 'TextDocumentSaveReason'.
+ pub reason: TextDocumentSaveReason,
+}
+
+/// Represents reasons why a text document is saved.
+#[derive(Copy, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct TextDocumentSaveReason(i32);
+lsp_enum! {
+impl TextDocumentSaveReason {
+ /// Manually triggered, e.g. by the user pressing save, by starting debugging,
+ /// or by an API call.
+ pub const MANUAL: TextDocumentSaveReason = TextDocumentSaveReason(1);
+
+ /// Automatic after a delay.
+ pub const AFTER_DELAY: TextDocumentSaveReason = TextDocumentSaveReason(2);
+
+ /// When the editor lost focus.
+ pub const FOCUS_OUT: TextDocumentSaveReason = TextDocumentSaveReason(3);
+}
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidCloseTextDocumentParams {
+ /// The document that was closed.
+ pub text_document: TextDocumentIdentifier,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidSaveTextDocumentParams {
+ /// The document that was saved.
+ pub text_document: TextDocumentIdentifier,
+
+ /// Optional the content when saved. Depends on the includeText value
+ /// when the save notification was requested.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub text: Option<String>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TextDocumentSaveRegistrationOptions {
+ /// The client is supposed to include the content on save.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub include_text: Option<bool>,
+
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Copy, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidChangeWatchedFilesClientCapabilities {
+ /// Did change watched files notification supports dynamic registration.
+ /// Please note that the current protocol doesn't support static
+ /// configuration for file changes from the server side.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Whether the client has support for relative patterns
+ /// or not.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub relative_pattern_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct DidChangeWatchedFilesParams {
+ /// The actual file events.
+ pub changes: Vec<FileEvent>,
+}
+
+/// The file event type.
+#[derive(Eq, PartialEq, Hash, Copy, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct FileChangeType(i32);
+lsp_enum! {
+impl FileChangeType {
+ /// The file got created.
+ pub const CREATED: FileChangeType = FileChangeType(1);
+
+ /// The file got changed.
+ pub const CHANGED: FileChangeType = FileChangeType(2);
+
+ /// The file got deleted.
+ pub const DELETED: FileChangeType = FileChangeType(3);
+}
+}
+
+/// An event describing a file change.
+#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)]
+pub struct FileEvent {
+ /// The file's URI.
+ pub uri: Url,
+
+ /// The change type.
+ #[serde(rename = "type")]
+ pub typ: FileChangeType,
+}
+
+impl FileEvent {
+ pub fn new(uri: Url, typ: FileChangeType) -> FileEvent {
+ FileEvent { uri, typ }
+ }
+}
+
+/// Describe options to be used when registered for text document change events.
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
+pub struct DidChangeWatchedFilesRegistrationOptions {
+ /// The watchers to register.
+ pub watchers: Vec<FileSystemWatcher>,
+}
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct FileSystemWatcher {
+ /// The glob pattern to watch. See {@link GlobPattern glob pattern}
+ /// for more detail.
+ ///
+ /// @since 3.17.0 support for relative patterns.
+ pub glob_pattern: GlobPattern,
+
+ /// The kind of events of interest. If omitted it defaults to WatchKind.Create |
+ /// WatchKind.Change | WatchKind.Delete which is 7.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<WatchKind>,
+}
+
+/// The glob pattern. Either a string pattern or a relative pattern.
+///
+/// @since 3.17.0
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum GlobPattern {
+ String(Pattern),
+ Relative(RelativePattern),
+}
+
+impl From<Pattern> for GlobPattern {
+ #[inline]
+ fn from(from: Pattern) -> Self {
+ Self::String(from)
+ }
+}
+
+impl From<RelativePattern> for GlobPattern {
+ #[inline]
+ fn from(from: RelativePattern) -> Self {
+ Self::Relative(from)
+ }
+}
+
+/// A relative pattern is a helper to construct glob patterns that are matched
+/// relatively to a base URI. The common value for a `baseUri` is a workspace
+/// folder root, but it can be another absolute URI as well.
+///
+/// @since 3.17.0
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RelativePattern {
+ /// A workspace folder or a base URI to which this pattern will be matched
+ /// against relatively.
+ pub base_uri: OneOf<WorkspaceFolder, Url>,
+
+ /// The actual glob pattern.
+ pub pattern: Pattern,
+}
+
+/// The glob pattern to watch relative to the base path. Glob patterns can have
+/// the following syntax:
+/// - `*` to match one or more characters in a path segment
+/// - `?` to match on one character in a path segment
+/// - `**` to match any number of path segments, including none
+/// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript
+/// and JavaScript files)
+/// - `[]` to declare a range of characters to match in a path segment
+/// (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+/// - `[!...]` to negate a range of characters to match in a path segment
+/// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`,
+/// but not `example.0`)
+///
+/// @since 3.17.0
+pub type Pattern = String;
+
+bitflags! {
+pub struct WatchKind: u8 {
+ /// Interested in create events.
+ const Create = 1;
+ /// Interested in change events
+ const Change = 2;
+ /// Interested in delete events
+ const Delete = 4;
+}
+}
+
+impl<'de> serde::Deserialize<'de> for WatchKind {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let i = u8::deserialize(deserializer)?;
+ WatchKind::from_bits(i).ok_or_else(|| {
+ D::Error::invalid_value(de::Unexpected::Unsigned(u64::from(i)), &"Unknown flag")
+ })
+ }
+}
+
+impl serde::Serialize for WatchKind {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: serde::Serializer,
+ {
+ serializer.serialize_u8(self.bits())
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct PublishDiagnosticsParams {
+ /// The URI for which diagnostic information is reported.
+ pub uri: Url,
+
+ /// An array of diagnostic information items.
+ pub diagnostics: Vec<Diagnostic>,
+
+ /// Optional the version number of the document the diagnostics are published for.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<i32>,
+}
+
+impl PublishDiagnosticsParams {
+ pub fn new(
+ uri: Url,
+ diagnostics: Vec<Diagnostic>,
+ version: Option<i32>,
+ ) -> PublishDiagnosticsParams {
+ PublishDiagnosticsParams {
+ uri,
+ diagnostics,
+ version,
+ }
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(untagged)]
+pub enum Documentation {
+ String(String),
+ MarkupContent(MarkupContent),
+}
+
+/// The marked string is rendered:
+/// - as markdown if it is represented as a string
+/// - as code block of the given langauge if it is represented as a pair of a language and a value
+///
+/// The pair of a language and a value is an equivalent to markdown:
+/// ```${language}
+/// ${value}
+/// ```
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum MarkedString {
+ String(String),
+ LanguageString(LanguageString),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct LanguageString {
+ pub language: String,
+ pub value: String,
+}
+
+impl MarkedString {
+ pub fn from_markdown(markdown: String) -> MarkedString {
+ MarkedString::String(markdown)
+ }
+
+ pub fn from_language_code(language: String, code_block: String) -> MarkedString {
+ MarkedString::LanguageString(LanguageString {
+ language,
+ value: code_block,
+ })
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GotoDefinitionParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// GotoDefinition response can be single location, or multiple Locations or a link.
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[serde(untagged)]
+pub enum GotoDefinitionResponse {
+ Scalar(Location),
+ Array(Vec<Location>),
+ Link(Vec<LocationLink>),
+}
+
+impl From<Location> for GotoDefinitionResponse {
+ fn from(location: Location) -> Self {
+ GotoDefinitionResponse::Scalar(location)
+ }
+}
+
+impl From<Vec<Location>> for GotoDefinitionResponse {
+ fn from(locations: Vec<Location>) -> Self {
+ GotoDefinitionResponse::Array(locations)
+ }
+}
+
+impl From<Vec<LocationLink>> for GotoDefinitionResponse {
+ fn from(locations: Vec<LocationLink>) -> Self {
+ GotoDefinitionResponse::Link(locations)
+ }
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct ExecuteCommandParams {
+ /// The identifier of the actual command handler.
+ pub command: String,
+ /// Arguments that the command should be invoked with.
+ #[serde(default)]
+ pub arguments: Vec<Value>,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+/// Execute command registration options.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct ExecuteCommandRegistrationOptions {
+ /// The commands to be executed on the server
+ pub commands: Vec<String>,
+
+ #[serde(flatten)]
+ pub execute_command_options: ExecuteCommandOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplyWorkspaceEditParams {
+ /// An optional label of the workspace edit. This label is
+ /// presented in the user interface for example on an undo
+ /// stack to undo the workspace edit.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label: Option<String>,
+
+ /// The edits to apply.
+ pub edit: WorkspaceEdit,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplyWorkspaceEditResponse {
+ /// Indicates whether the edit was applied or not.
+ pub applied: bool,
+
+ /// An optional textual description for why the edit was not applied.
+ /// This may be used may be used by the server for diagnostic
+ /// logging or to provide a suitable error for a request that
+ /// triggered the edit
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub failure_reason: Option<String>,
+
+ /// Depending on the client's failure handling strategy `failedChange` might
+ /// contain the index of the change that failed. This property is only available
+ /// if the client signals a `failureHandlingStrategy` in its client capabilities.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub failed_change: Option<u32>,
+}
+
+/// Describes the content type that a client supports in various
+/// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
+///
+/// Please note that `MarkupKinds` must not start with a `$`. This kinds
+/// are reserved for internal usage.
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "lowercase")]
+pub enum MarkupKind {
+ /// Plain text is supported as a content format
+ PlainText,
+ /// Markdown is supported as a content format
+ Markdown,
+}
+
+/// A `MarkupContent` literal represents a string value which content can be represented in different formats.
+/// Currently `plaintext` and `markdown` are supported formats. A `MarkupContent` is usually used in
+/// documentation properties of result literals like `CompletionItem` or `SignatureInformation`.
+/// If the format is `markdown` the content should follow the [GitHub Flavored Markdown Specification](https://github.github.com/gfm/).
+///
+/// Here is an example how such a string can be constructed using JavaScript / TypeScript:
+/// ```ignore
+/// let markdown: MarkupContent = {
+/// kind: MarkupKind::Markdown,
+/// value: [
+/// "# Header",
+/// "Some text",
+/// "```typescript",
+/// "someCode();",
+/// "```"
+/// ]
+/// .join("\n"),
+/// };
+/// ```
+///
+/// Please Note* that clients might sanitize the return markdown. A client could decide to
+/// remove HTML from the markdown to avoid script execution.
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
+pub struct MarkupContent {
+ pub kind: MarkupKind,
+ pub value: String,
+}
+
+/// A parameter literal used to pass a partial result token.
+#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct PartialResultParams {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub partial_result_token: Option<ProgressToken>,
+}
+
+/// Symbol tags are extra annotations that tweak the rendering of a symbol.
+/// Since 3.15
+#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct SymbolTag(i32);
+lsp_enum! {
+impl SymbolTag {
+ /// Render a symbol as obsolete, usually using a strike-out.
+ pub const DEPRECATED: SymbolTag = SymbolTag(1);
+}
+}
+
+#[cfg(test)]
+mod tests {
+ use serde::{Deserialize, Serialize};
+
+ use super::*;
+
+ pub(crate) fn test_serialization<SER>(ms: &SER, expected: &str)
+ where
+ SER: Serialize + for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
+ {
+ let json_str = serde_json::to_string(ms).unwrap();
+ assert_eq!(&json_str, expected);
+ let deserialized: SER = serde_json::from_str(&json_str).unwrap();
+ assert_eq!(&deserialized, ms);
+ }
+
+ pub(crate) fn test_deserialization<T>(json: &str, expected: &T)
+ where
+ T: for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
+ {
+ let value = serde_json::from_str::<T>(json).unwrap();
+ assert_eq!(&value, expected);
+ }
+
+ #[test]
+ fn one_of() {
+ test_serialization(&OneOf::<bool, ()>::Left(true), r#"true"#);
+ test_serialization(&OneOf::<String, ()>::Left("abcd".into()), r#""abcd""#);
+ test_serialization(
+ &OneOf::<String, WorkDoneProgressOptions>::Right(WorkDoneProgressOptions {
+ work_done_progress: Some(false),
+ }),
+ r#"{"workDoneProgress":false}"#,
+ );
+ }
+
+ #[test]
+ fn number_or_string() {
+ test_serialization(&NumberOrString::Number(123), r#"123"#);
+
+ test_serialization(&NumberOrString::String("abcd".into()), r#""abcd""#);
+ }
+
+ #[test]
+ fn marked_string() {
+ test_serialization(&MarkedString::from_markdown("xxx".into()), r#""xxx""#);
+
+ test_serialization(
+ &MarkedString::from_language_code("lang".into(), "code".into()),
+ r#"{"language":"lang","value":"code"}"#,
+ );
+ }
+
+ #[test]
+ fn language_string() {
+ test_serialization(
+ &LanguageString {
+ language: "LL".into(),
+ value: "VV".into(),
+ },
+ r#"{"language":"LL","value":"VV"}"#,
+ );
+ }
+
+ #[test]
+ fn workspace_edit() {
+ test_serialization(
+ &WorkspaceEdit {
+ changes: Some(vec![].into_iter().collect()),
+ document_changes: None,
+ ..Default::default()
+ },
+ r#"{"changes":{}}"#,
+ );
+
+ test_serialization(
+ &WorkspaceEdit {
+ changes: None,
+ document_changes: None,
+ ..Default::default()
+ },
+ r#"{}"#,
+ );
+
+ test_serialization(
+ &WorkspaceEdit {
+ changes: Some(
+ vec![(Url::parse("file://test").unwrap(), vec![])]
+ .into_iter()
+ .collect(),
+ ),
+ document_changes: None,
+ ..Default::default()
+ },
+ r#"{"changes":{"file://test/":[]}}"#,
+ );
+ }
+
+ #[test]
+ fn root_uri_can_be_missing() {
+ serde_json::from_str::<InitializeParams>(r#"{ "capabilities": {} }"#).unwrap();
+ }
+
+ #[test]
+ fn test_watch_kind() {
+ test_serialization(&WatchKind::Create, "1");
+ test_serialization(&(WatchKind::Create | WatchKind::Change), "3");
+ test_serialization(
+ &(WatchKind::Create | WatchKind::Change | WatchKind::Delete),
+ "7",
+ );
+ }
+
+ #[test]
+ fn test_resource_operation_kind() {
+ test_serialization(
+ &vec![
+ ResourceOperationKind::Create,
+ ResourceOperationKind::Rename,
+ ResourceOperationKind::Delete,
+ ],
+ r#"["create","rename","delete"]"#,
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/linked_editing.rs b/vendor/lsp-types/src/linked_editing.rs
index b23fb141f..615ca5a24 100644
--- a/vendor/lsp-types/src/linked_editing.rs
+++ b/vendor/lsp-types/src/linked_editing.rs
@@ -1,61 +1,61 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- DynamicRegistrationClientCapabilities, Range, StaticRegistrationOptions,
- TextDocumentPositionParams, TextDocumentRegistrationOptions, WorkDoneProgressOptions,
- WorkDoneProgressParams,
-};
-
-pub type LinkedEditingRangeClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LinkedEditingRangeOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LinkedEditingRangeRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub linked_editing_range_options: LinkedEditingRangeOptions,
-
- #[serde(flatten)]
- pub static_registration_options: StaticRegistrationOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum LinkedEditingRangeServerCapabilities {
- Simple(bool),
- Options(LinkedEditingRangeOptions),
- RegistrationOptions(LinkedEditingRangeRegistrationOptions),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LinkedEditingRangeParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LinkedEditingRanges {
- /// A list of ranges that can be renamed together. The ranges must have
- /// identical length and contain identical text content. The ranges cannot overlap.
- pub ranges: Vec<Range>,
-
- /// An optional word pattern (regular expression) that describes valid contents for
- /// the given ranges. If no pattern is provided, the client configuration's word
- /// pattern will be used.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub word_pattern: Option<String>,
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ DynamicRegistrationClientCapabilities, Range, StaticRegistrationOptions,
+ TextDocumentPositionParams, TextDocumentRegistrationOptions, WorkDoneProgressOptions,
+ WorkDoneProgressParams,
+};
+
+pub type LinkedEditingRangeClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LinkedEditingRangeOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LinkedEditingRangeRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub linked_editing_range_options: LinkedEditingRangeOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum LinkedEditingRangeServerCapabilities {
+ Simple(bool),
+ Options(LinkedEditingRangeOptions),
+ RegistrationOptions(LinkedEditingRangeRegistrationOptions),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LinkedEditingRangeParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LinkedEditingRanges {
+ /// A list of ranges that can be renamed together. The ranges must have
+ /// identical length and contain identical text content. The ranges cannot overlap.
+ pub ranges: Vec<Range>,
+
+ /// An optional word pattern (regular expression) that describes valid contents for
+ /// the given ranges. If no pattern is provided, the client configuration's word
+ /// pattern will be used.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub word_pattern: Option<String>,
+}
diff --git a/vendor/lsp-types/src/lsif.rs b/vendor/lsp-types/src/lsif.rs
index 164d4eb4a..a28256308 100644
--- a/vendor/lsp-types/src/lsif.rs
+++ b/vendor/lsp-types/src/lsif.rs
@@ -1,338 +1,338 @@
-//! Types of Language Server Index Format (LSIF). LSIF is a standard format
-//! for language servers or other programming tools to dump their knowledge
-//! about a workspace.
-//!
-//! Based on <https://microsoft.github.io/language-server-protocol/specifications/lsif/0.6.0/specification/>
-
-use serde::{Deserialize, Serialize};
-use crate::{Url, Range};
-
-pub type Id = crate::NumberOrString;
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum LocationOrRangeId {
- Location(crate::Location),
- RangeId(Id),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Entry {
- pub id: Id,
- #[serde(flatten)]
- pub data: Element,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(tag = "type")]
-pub enum Element {
- Vertex(Vertex),
- Edge(Edge),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-pub struct ToolInfo {
- pub name: String,
- #[serde(default = "Default::default")]
- #[serde(skip_serializing_if = "Vec::is_empty")]
- pub args: Vec<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-pub enum Encoding {
- /// Currently only 'utf-16' is supported due to the limitations in LSP.
- #[serde(rename = "utf-16")]
- Utf16,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-pub struct RangeBasedDocumentSymbol {
- pub id: Id,
- #[serde(default = "Default::default")]
- #[serde(skip_serializing_if = "Vec::is_empty")]
- pub children: Vec<RangeBasedDocumentSymbol>,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum DocumentSymbolOrRangeBasedVec {
- DocumentSymbol(Vec<crate::DocumentSymbol>),
- RangeBased(Vec<RangeBasedDocumentSymbol>),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DefinitionTag {
- /// The text covered by the range
- text: String,
- /// The symbol kind.
- kind: crate::SymbolKind,
- /// Indicates if this symbol is deprecated.
- #[serde(default)]
- #[serde(skip_serializing_if = "std::ops::Not::not")]
- deprecated: bool,
- /// The full range of the definition not including leading/trailing whitespace but everything else, e.g comments and code.
- /// The range must be included in fullRange.
- full_range: Range,
- /// Optional detail information for the definition.
- #[serde(skip_serializing_if = "Option::is_none")]
- detail: Option<String>,
-}
-
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DeclarationTag {
- /// The text covered by the range
- text: String,
- /// The symbol kind.
- kind: crate::SymbolKind,
- /// Indicates if this symbol is deprecated.
- #[serde(default)]
- deprecated: bool,
- /// The full range of the definition not including leading/trailing whitespace but everything else, e.g comments and code.
- /// The range must be included in fullRange.
- full_range: Range,
- /// Optional detail information for the definition.
- #[serde(skip_serializing_if = "Option::is_none")]
- detail: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ReferenceTag {
- text: String,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct UnknownTag {
- text: String,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(tag = "type")]
-pub enum RangeTag {
- Definition(DefinitionTag),
- Declaration(DeclarationTag),
- Reference(ReferenceTag),
- Unknown(UnknownTag),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(tag = "label")]
-pub enum Vertex {
- MetaData(MetaData),
- /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#the-project-vertex>
- Project(Project),
- Document(Document),
- /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#ranges>
- Range {
- #[serde(flatten)]
- range: Range,
- #[serde(skip_serializing_if = "Option::is_none")]
- tag: Option<RangeTag>,
- },
- /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#result-set>
- ResultSet(ResultSet),
- Moniker(crate::Moniker),
- PackageInformation(PackageInformation),
-
- #[serde(rename = "$event")]
- Event(Event),
-
- DefinitionResult,
- DeclarationResult,
- TypeDefinitionResult,
- ReferenceResult,
- ImplementationResult,
- FoldingRangeResult {
- result: Vec<crate::FoldingRange>,
- },
- HoverResult {
- result: crate::Hover,
- },
- DocumentSymbolResult {
- result: DocumentSymbolOrRangeBasedVec,
- },
- DocumentLinkResult {
- result: Vec<crate::DocumentLink>,
- },
- DiagnosticResult {
- result: Vec<crate::Diagnostic>,
- },
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub enum EventKind {
- Begin,
- End,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub enum EventScope {
- Document,
- Project,
-}
-
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-pub struct Event {
- pub kind: EventKind,
- pub scope: EventScope,
- pub data: Id,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(tag = "label")]
-pub enum Edge {
- Contains(EdgeDataMultiIn),
- Moniker(EdgeData),
- NextMoniker(EdgeData),
- Next(EdgeData),
- PackageInformation(EdgeData),
- Item(Item),
-
- // Methods
- #[serde(rename = "textDocument/definition")]
- Definition(EdgeData),
- #[serde(rename = "textDocument/declaration")]
- Declaration(EdgeData),
- #[serde(rename = "textDocument/hover")]
- Hover(EdgeData),
- #[serde(rename = "textDocument/references")]
- References(EdgeData),
- #[serde(rename = "textDocument/implementation")]
- Implementation(EdgeData),
- #[serde(rename = "textDocument/typeDefinition")]
- TypeDefinition(EdgeData),
- #[serde(rename = "textDocument/foldingRange")]
- FoldingRange(EdgeData),
- #[serde(rename = "textDocument/documentLink")]
- DocumentLink(EdgeData),
- #[serde(rename = "textDocument/documentSymbol")]
- DocumentSymbol(EdgeData),
- #[serde(rename = "textDocument/diagnostic")]
- Diagnostic(EdgeData),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct EdgeData {
- pub in_v: Id,
- pub out_v: Id,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct EdgeDataMultiIn {
- pub in_vs: Vec<Id>,
- pub out_v: Id,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum DefinitionResultType {
- Scalar(LocationOrRangeId),
- Array(LocationOrRangeId),
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub enum ItemKind {
- Declarations,
- Definitions,
- References,
- ReferenceResults,
- ImplementationResults,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Item {
- pub document: Id,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub property: Option<ItemKind>,
- #[serde(flatten)]
- pub edge_data: EdgeDataMultiIn,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Document {
- pub uri: Url,
- pub language_id: String,
-}
-
-/// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#result-set>
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ResultSet {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub key: Option<String>,
-}
-
-/// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#the-project-vertex>
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Project {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub resource: Option<Url>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub content: Option<String>,
- pub kind: String,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MetaData {
- /// The version of the LSIF format using semver notation. See <https://semver.org/>. Please note
- /// the version numbers starting with 0 don't adhere to semver and adopters have to assume
- /// that each new version is breaking.
- pub version: String,
-
- /// The project root (in form of an URI) used to compute this dump.
- pub project_root: Url,
-
- /// The string encoding used to compute line and character values in
- /// positions and ranges.
- pub position_encoding: Encoding,
-
- /// Information about the tool that created the dump
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tool_info: Option<ToolInfo>,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Repository {
- pub r#type: String,
- pub url: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub commit_id: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct PackageInformation {
- pub name: String,
- pub manager: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub uri: Option<Url>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub content: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub repository: Option<Repository>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub version: Option<String>,
-}
+//! Types of Language Server Index Format (LSIF). LSIF is a standard format
+//! for language servers or other programming tools to dump their knowledge
+//! about a workspace.
+//!
+//! Based on <https://microsoft.github.io/language-server-protocol/specifications/lsif/0.6.0/specification/>
+
+use serde::{Deserialize, Serialize};
+use crate::{Url, Range};
+
+pub type Id = crate::NumberOrString;
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum LocationOrRangeId {
+ Location(crate::Location),
+ RangeId(Id),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Entry {
+ pub id: Id,
+ #[serde(flatten)]
+ pub data: Element,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(tag = "type")]
+pub enum Element {
+ Vertex(Vertex),
+ Edge(Edge),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct ToolInfo {
+ pub name: String,
+ #[serde(default = "Default::default")]
+ #[serde(skip_serializing_if = "Vec::is_empty")]
+ pub args: Vec<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub enum Encoding {
+ /// Currently only 'utf-16' is supported due to the limitations in LSP.
+ #[serde(rename = "utf-16")]
+ Utf16,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct RangeBasedDocumentSymbol {
+ pub id: Id,
+ #[serde(default = "Default::default")]
+ #[serde(skip_serializing_if = "Vec::is_empty")]
+ pub children: Vec<RangeBasedDocumentSymbol>,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum DocumentSymbolOrRangeBasedVec {
+ DocumentSymbol(Vec<crate::DocumentSymbol>),
+ RangeBased(Vec<RangeBasedDocumentSymbol>),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DefinitionTag {
+ /// The text covered by the range
+ text: String,
+ /// The symbol kind.
+ kind: crate::SymbolKind,
+ /// Indicates if this symbol is deprecated.
+ #[serde(default)]
+ #[serde(skip_serializing_if = "std::ops::Not::not")]
+ deprecated: bool,
+ /// The full range of the definition not including leading/trailing whitespace but everything else, e.g comments and code.
+ /// The range must be included in fullRange.
+ full_range: Range,
+ /// Optional detail information for the definition.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ detail: Option<String>,
+}
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DeclarationTag {
+ /// The text covered by the range
+ text: String,
+ /// The symbol kind.
+ kind: crate::SymbolKind,
+ /// Indicates if this symbol is deprecated.
+ #[serde(default)]
+ deprecated: bool,
+ /// The full range of the definition not including leading/trailing whitespace but everything else, e.g comments and code.
+ /// The range must be included in fullRange.
+ full_range: Range,
+ /// Optional detail information for the definition.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ detail: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ReferenceTag {
+ text: String,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UnknownTag {
+ text: String,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(tag = "type")]
+pub enum RangeTag {
+ Definition(DefinitionTag),
+ Declaration(DeclarationTag),
+ Reference(ReferenceTag),
+ Unknown(UnknownTag),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(tag = "label")]
+pub enum Vertex {
+ MetaData(MetaData),
+ /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#the-project-vertex>
+ Project(Project),
+ Document(Document),
+ /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#ranges>
+ Range {
+ #[serde(flatten)]
+ range: Range,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ tag: Option<RangeTag>,
+ },
+ /// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#result-set>
+ ResultSet(ResultSet),
+ Moniker(crate::Moniker),
+ PackageInformation(PackageInformation),
+
+ #[serde(rename = "$event")]
+ Event(Event),
+
+ DefinitionResult,
+ DeclarationResult,
+ TypeDefinitionResult,
+ ReferenceResult,
+ ImplementationResult,
+ FoldingRangeResult {
+ result: Vec<crate::FoldingRange>,
+ },
+ HoverResult {
+ result: crate::Hover,
+ },
+ DocumentSymbolResult {
+ result: DocumentSymbolOrRangeBasedVec,
+ },
+ DocumentLinkResult {
+ result: Vec<crate::DocumentLink>,
+ },
+ DiagnosticResult {
+ result: Vec<crate::Diagnostic>,
+ },
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum EventKind {
+ Begin,
+ End,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum EventScope {
+ Document,
+ Project,
+}
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct Event {
+ pub kind: EventKind,
+ pub scope: EventScope,
+ pub data: Id,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(tag = "label")]
+pub enum Edge {
+ Contains(EdgeDataMultiIn),
+ Moniker(EdgeData),
+ NextMoniker(EdgeData),
+ Next(EdgeData),
+ PackageInformation(EdgeData),
+ Item(Item),
+
+ // Methods
+ #[serde(rename = "textDocument/definition")]
+ Definition(EdgeData),
+ #[serde(rename = "textDocument/declaration")]
+ Declaration(EdgeData),
+ #[serde(rename = "textDocument/hover")]
+ Hover(EdgeData),
+ #[serde(rename = "textDocument/references")]
+ References(EdgeData),
+ #[serde(rename = "textDocument/implementation")]
+ Implementation(EdgeData),
+ #[serde(rename = "textDocument/typeDefinition")]
+ TypeDefinition(EdgeData),
+ #[serde(rename = "textDocument/foldingRange")]
+ FoldingRange(EdgeData),
+ #[serde(rename = "textDocument/documentLink")]
+ DocumentLink(EdgeData),
+ #[serde(rename = "textDocument/documentSymbol")]
+ DocumentSymbol(EdgeData),
+ #[serde(rename = "textDocument/diagnostic")]
+ Diagnostic(EdgeData),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EdgeData {
+ pub in_v: Id,
+ pub out_v: Id,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EdgeDataMultiIn {
+ pub in_vs: Vec<Id>,
+ pub out_v: Id,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum DefinitionResultType {
+ Scalar(LocationOrRangeId),
+ Array(LocationOrRangeId),
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum ItemKind {
+ Declarations,
+ Definitions,
+ References,
+ ReferenceResults,
+ ImplementationResults,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Item {
+ pub document: Id,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub property: Option<ItemKind>,
+ #[serde(flatten)]
+ pub edge_data: EdgeDataMultiIn,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Document {
+ pub uri: Url,
+ pub language_id: String,
+}
+
+/// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#result-set>
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ResultSet {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub key: Option<String>,
+}
+
+/// <https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#the-project-vertex>
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Project {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resource: Option<Url>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub content: Option<String>,
+ pub kind: String,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MetaData {
+ /// The version of the LSIF format using semver notation. See <https://semver.org/>. Please note
+ /// the version numbers starting with 0 don't adhere to semver and adopters have to assume
+ /// that each new version is breaking.
+ pub version: String,
+
+ /// The project root (in form of an URI) used to compute this dump.
+ pub project_root: Url,
+
+ /// The string encoding used to compute line and character values in
+ /// positions and ranges.
+ pub position_encoding: Encoding,
+
+ /// Information about the tool that created the dump
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tool_info: Option<ToolInfo>,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Repository {
+ pub r#type: String,
+ pub url: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub commit_id: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PackageInformation {
+ pub name: String,
+ pub manager: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub uri: Option<Url>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub content: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub repository: Option<Repository>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version: Option<String>,
+}
diff --git a/vendor/lsp-types/src/moniker.rs b/vendor/lsp-types/src/moniker.rs
index 74bf89553..5a888bc5d 100644
--- a/vendor/lsp-types/src/moniker.rs
+++ b/vendor/lsp-types/src/moniker.rs
@@ -1,92 +1,92 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- DynamicRegistrationClientCapabilities, PartialResultParams, TextDocumentPositionParams,
- TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-
-pub type MonikerClientCapabilities = DynamicRegistrationClientCapabilities;
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum MonikerServerCapabilities {
- Options(MonikerOptions),
- RegistrationOptions(MonikerRegistrationOptions),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct MonikerOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MonikerRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub moniker_options: MonikerOptions,
-}
-
-/// Moniker uniqueness level to define scope of the moniker.
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
-#[serde(rename_all = "camelCase")]
-pub enum UniquenessLevel {
- /// The moniker is only unique inside a document
- Document,
- /// The moniker is unique inside a project for which a dump got created
- Project,
- /// The moniker is unique inside the group to which a project belongs
- Group,
- /// The moniker is unique inside the moniker scheme.
- Scheme,
- /// The moniker is globally unique
- Global,
-}
-
-/// The moniker kind.
-#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
-#[serde(rename_all = "camelCase")]
-pub enum MonikerKind {
- /// The moniker represent a symbol that is imported into a project
- Import,
- /// The moniker represent a symbol that is exported into a project
- Export,
- /// The moniker represents a symbol that is local to a project (e.g. a local
- /// variable of a function, a class not visible outside the project, ...)
- Local,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MonikerParams {
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// Moniker definition to match LSIF 0.5 moniker definition.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Moniker {
- /// The scheme of the moniker. For example tsc or .Net
- pub scheme: String,
-
- /// The identifier of the moniker. The value is opaque in LSIF however
- /// schema owners are allowed to define the structure if they want.
- pub identifier: String,
-
- /// The scope in which the moniker is unique
- pub unique: UniquenessLevel,
-
- /// The moniker kind if known.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub kind: Option<MonikerKind>,
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ DynamicRegistrationClientCapabilities, PartialResultParams, TextDocumentPositionParams,
+ TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+
+pub type MonikerClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum MonikerServerCapabilities {
+ Options(MonikerOptions),
+ RegistrationOptions(MonikerRegistrationOptions),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct MonikerOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MonikerRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub moniker_options: MonikerOptions,
+}
+
+/// Moniker uniqueness level to define scope of the moniker.
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
+#[serde(rename_all = "camelCase")]
+pub enum UniquenessLevel {
+ /// The moniker is only unique inside a document
+ Document,
+ /// The moniker is unique inside a project for which a dump got created
+ Project,
+ /// The moniker is unique inside the group to which a project belongs
+ Group,
+ /// The moniker is unique inside the moniker scheme.
+ Scheme,
+ /// The moniker is globally unique
+ Global,
+}
+
+/// The moniker kind.
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Copy, Clone)]
+#[serde(rename_all = "camelCase")]
+pub enum MonikerKind {
+ /// The moniker represent a symbol that is imported into a project
+ Import,
+ /// The moniker represent a symbol that is exported into a project
+ Export,
+ /// The moniker represents a symbol that is local to a project (e.g. a local
+ /// variable of a function, a class not visible outside the project, ...)
+ Local,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MonikerParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// Moniker definition to match LSIF 0.5 moniker definition.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Moniker {
+ /// The scheme of the moniker. For example tsc or .Net
+ pub scheme: String,
+
+ /// The identifier of the moniker. The value is opaque in LSIF however
+ /// schema owners are allowed to define the structure if they want.
+ pub identifier: String,
+
+ /// The scope in which the moniker is unique
+ pub unique: UniquenessLevel,
+
+ /// The moniker kind if known.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<MonikerKind>,
+}
diff --git a/vendor/lsp-types/src/notification.rs b/vendor/lsp-types/src/notification.rs
index 6417707b8..53cfaea89 100644
--- a/vendor/lsp-types/src/notification.rs
+++ b/vendor/lsp-types/src/notification.rs
@@ -1,361 +1,361 @@
-use super::*;
-
-use serde::{de::DeserializeOwned, Serialize};
-
-pub trait Notification {
- type Params: DeserializeOwned + Serialize;
- const METHOD: &'static str;
-}
-
-#[macro_export]
-macro_rules! lsp_notification {
- ("$/cancelRequest") => {
- $crate::notification::Cancel
- };
- ("$/setTrace") => {
- $crate::notification::SetTrace
- };
- ("$/logTrace") => {
- $crate::notification::LogTrace
- };
- ("initialized") => {
- $crate::notification::Initialized
- };
- ("exit") => {
- $crate::notification::Exit
- };
-
- ("window/showMessage") => {
- $crate::notification::ShowMessage
- };
- ("window/logMessage") => {
- $crate::notification::LogMessage
- };
- ("window/workDoneProgress/cancel") => {
- $crate::notification::WorkDoneProgressCancel
- };
-
- ("telemetry/event") => {
- $crate::notification::TelemetryEvent
- };
-
- ("textDocument/didOpen") => {
- $crate::notification::DidOpenTextDocument
- };
- ("textDocument/didChange") => {
- $crate::notification::DidChangeTextDocument
- };
- ("textDocument/willSave") => {
- $crate::notification::WillSaveTextDocument
- };
- ("textDocument/didSave") => {
- $crate::notification::DidSaveTextDocument
- };
- ("textDocument/didClose") => {
- $crate::notification::DidCloseTextDocument
- };
- ("textDocument/publishDiagnostics") => {
- $crate::notification::PublishDiagnostics
- };
-
- ("workspace/didChangeConfiguration") => {
- $crate::notification::DidChangeConfiguration
- };
- ("workspace/didChangeWatchedFiles") => {
- $crate::notification::DidChangeWatchedFiles
- };
- ("workspace/didChangeWorkspaceFolders") => {
- $crate::notification::DidChangeWorkspaceFolders
- };
- ("$/progress") => {
- $crate::notification::Progress
- };
- ("workspace/didCreateFiles") => {
- $crate::notification::DidCreateFiles
- };
- ("workspace/didRenameFiles") => {
- $crate::notification::DidRenameFiles
- };
- ("workspace/didDeleteFiles") => {
- $crate::notification::DidDeleteFiles
- };
-}
-
-/// The base protocol now offers support for request cancellation. To cancel a request,
-/// a notification message with the following properties is sent:
-///
-/// A request that got canceled still needs to return from the server and send a response back.
-/// It can not be left open / hanging. This is in line with the JSON RPC protocol that requires
-/// that every request sends a response back. In addition it allows for returning partial results on cancel.
-#[derive(Debug)]
-pub enum Cancel {}
-
-impl Notification for Cancel {
- type Params = CancelParams;
- const METHOD: &'static str = "$/cancelRequest";
-}
-
-/// A notification that should be used by the client to modify the trace
-/// setting of the server.
-#[derive(Debug)]
-pub enum SetTrace {}
-
-impl Notification for SetTrace {
- type Params = SetTraceParams;
- const METHOD: &'static str = "$/setTrace";
-}
-
-/// A notification to log the trace of the server’s execution.
-/// The amount and content of these notifications depends on the current trace configuration.
-///
-/// `LogTrace` should be used for systematic trace reporting. For single debugging messages,
-/// the server should send `LogMessage` notifications.
-#[derive(Debug)]
-pub enum LogTrace {}
-
-impl Notification for LogTrace {
- type Params = LogTraceParams;
- const METHOD: &'static str = "$/logTrace";
-}
-
-/// The initialized notification is sent from the client to the server after the client received
-/// the result of the initialize request but before the client is sending any other request or
-/// notification to the server. The server can use the initialized notification for example to
-/// dynamically register capabilities.
-#[derive(Debug)]
-pub enum Initialized {}
-
-impl Notification for Initialized {
- type Params = InitializedParams;
- const METHOD: &'static str = "initialized";
-}
-
-/// A notification to ask the server to exit its process.
-/// The server should exit with success code 0 if the shutdown request has been received before;
-/// otherwise with error code 1.
-#[derive(Debug)]
-pub enum Exit {}
-
-impl Notification for Exit {
- type Params = ();
- const METHOD: &'static str = "exit";
-}
-
-/// The show message notification is sent from a server to a client to ask the client to display a particular message
-/// in the user interface.
-#[derive(Debug)]
-pub enum ShowMessage {}
-
-impl Notification for ShowMessage {
- type Params = ShowMessageParams;
- const METHOD: &'static str = "window/showMessage";
-}
-
-/// The log message notification is sent from the server to the client to ask the client to log a particular message.
-#[derive(Debug)]
-pub enum LogMessage {}
-
-impl Notification for LogMessage {
- type Params = LogMessageParams;
- const METHOD: &'static str = "window/logMessage";
-}
-
-/// The telemetry notification is sent from the server to the client to ask the client to log a telemetry event.
-/// The protocol doesn't specify the payload since no interpretation of the data happens in the protocol. Most clients even don't handle
-/// the event directly but forward them to the extensions owning the corresponding server issuing the event.
-#[derive(Debug)]
-pub enum TelemetryEvent {}
-
-impl Notification for TelemetryEvent {
- type Params = serde_json::Value;
- const METHOD: &'static str = "telemetry/event";
-}
-
-/// A notification sent from the client to the server to signal the change of configuration settings.
-#[derive(Debug)]
-pub enum DidChangeConfiguration {}
-
-impl Notification for DidChangeConfiguration {
- type Params = DidChangeConfigurationParams;
- const METHOD: &'static str = "workspace/didChangeConfiguration";
-}
-
-/// The document open notification is sent from the client to the server to signal newly opened text documents.
-/// The document's truth is now managed by the client and the server must not try to read the document's truth
-/// using the document's uri.
-#[derive(Debug)]
-pub enum DidOpenTextDocument {}
-
-impl Notification for DidOpenTextDocument {
- type Params = DidOpenTextDocumentParams;
- const METHOD: &'static str = "textDocument/didOpen";
-}
-
-/// The document change notification is sent from the client to the server to signal changes to a text document.
-/// In 2.0 the shape of the params has changed to include proper version numbers and language ids.
-#[derive(Debug)]
-pub enum DidChangeTextDocument {}
-
-impl Notification for DidChangeTextDocument {
- type Params = DidChangeTextDocumentParams;
- const METHOD: &'static str = "textDocument/didChange";
-}
-
-/// The document will save notification is sent from the client to the server before the document
-/// is actually saved.
-#[derive(Debug)]
-pub enum WillSaveTextDocument {}
-
-impl Notification for WillSaveTextDocument {
- type Params = WillSaveTextDocumentParams;
- const METHOD: &'static str = "textDocument/willSave";
-}
-
-/// The document close notification is sent from the client to the server when the document got closed in the client.
-/// The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri
-/// the truth now exists on disk).
-#[derive(Debug)]
-pub enum DidCloseTextDocument {}
-
-impl Notification for DidCloseTextDocument {
- type Params = DidCloseTextDocumentParams;
- const METHOD: &'static str = "textDocument/didClose";
-}
-
-/// The document save notification is sent from the client to the server when the document was saved in the client.
-#[derive(Debug)]
-pub enum DidSaveTextDocument {}
-
-impl Notification for DidSaveTextDocument {
- type Params = DidSaveTextDocumentParams;
- const METHOD: &'static str = "textDocument/didSave";
-}
-
-/// The watched files notification is sent from the client to the server when the client detects changes to files and folders
-/// watched by the language client (note although the name suggest that only file events are sent it is about file system events which include folders as well).
-/// It is recommended that servers register for these file system events using the registration mechanism.
-/// In former implementations clients pushed file events without the server actively asking for it.
-#[derive(Debug)]
-pub enum DidChangeWatchedFiles {}
-
-impl Notification for DidChangeWatchedFiles {
- type Params = DidChangeWatchedFilesParams;
- const METHOD: &'static str = "workspace/didChangeWatchedFiles";
-}
-
-/// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server to inform the server
-/// about workspace folder configuration changes
-#[derive(Debug)]
-pub enum DidChangeWorkspaceFolders {}
-
-impl Notification for DidChangeWorkspaceFolders {
- type Params = DidChangeWorkspaceFoldersParams;
- const METHOD: &'static str = "workspace/didChangeWorkspaceFolders";
-}
-
-/// Diagnostics notification are sent from the server to the client to signal results of validation runs.
-#[derive(Debug)]
-pub enum PublishDiagnostics {}
-
-impl Notification for PublishDiagnostics {
- type Params = PublishDiagnosticsParams;
- const METHOD: &'static str = "textDocument/publishDiagnostics";
-}
-
-/// The progress notification is sent from the server to the client to ask
-/// the client to indicate progress.
-#[derive(Debug)]
-pub enum Progress {}
-
-impl Notification for Progress {
- type Params = ProgressParams;
- const METHOD: &'static str = "$/progress";
-}
-
-/// The `window/workDoneProgress/cancel` notification is sent from the client
-/// to the server to cancel a progress initiated on the server side using the `window/workDoneProgress/create`.
-#[derive(Debug)]
-pub enum WorkDoneProgressCancel {}
-
-impl Notification for WorkDoneProgressCancel {
- type Params = WorkDoneProgressCancelParams;
- const METHOD: &'static str = "window/workDoneProgress/cancel";
-}
-
-/// The did create files notification is sent from the client to the server when files were created from within the client.
-#[derive(Debug)]
-pub enum DidCreateFiles {}
-
-impl Notification for DidCreateFiles {
- type Params = CreateFilesParams;
- const METHOD: &'static str = "workspace/didCreateFiles";
-}
-
-/// The did rename files notification is sent from the client to the server when files were renamed from within the client.
-#[derive(Debug)]
-pub enum DidRenameFiles {}
-
-impl Notification for DidRenameFiles {
- type Params = RenameFilesParams;
- const METHOD: &'static str = "workspace/didRenameFiles";
-}
-
-/// The did delete files notification is sent from the client to the server when files were deleted from within the client.
-#[derive(Debug)]
-pub enum DidDeleteFiles {}
-
-impl Notification for DidDeleteFiles {
- type Params = DeleteFilesParams;
- const METHOD: &'static str = "workspace/didDeleteFiles";
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
-
- fn fake_call<N>()
- where
- N: Notification,
- N::Params: serde::Serialize,
- {
- }
-
- macro_rules! check_macro {
- ($name:tt) => {
- // check whether the macro name matches the method
- assert_eq!(<lsp_notification!($name) as Notification>::METHOD, $name);
- // test whether type checking passes for each component
- fake_call::<lsp_notification!($name)>();
- };
- }
-
- #[test]
- fn check_macro_definitions() {
- check_macro!("$/cancelRequest");
- check_macro!("$/progress");
- check_macro!("$/logTrace");
- check_macro!("$/setTrace");
- check_macro!("initialized");
- check_macro!("exit");
- check_macro!("window/showMessage");
- check_macro!("window/logMessage");
- check_macro!("window/workDoneProgress/cancel");
- check_macro!("telemetry/event");
- check_macro!("textDocument/didOpen");
- check_macro!("textDocument/didChange");
- check_macro!("textDocument/willSave");
- check_macro!("textDocument/didSave");
- check_macro!("textDocument/didClose");
- check_macro!("textDocument/publishDiagnostics");
- check_macro!("workspace/didChangeConfiguration");
- check_macro!("workspace/didChangeWatchedFiles");
- check_macro!("workspace/didChangeWorkspaceFolders");
- check_macro!("workspace/didCreateFiles");
- check_macro!("workspace/didRenameFiles");
- check_macro!("workspace/didDeleteFiles");
- }
-
- #[test]
- #[cfg(feature = "proposed")]
- fn check_proposed_macro_definitions() {}
-}
+use super::*;
+
+use serde::{de::DeserializeOwned, Serialize};
+
+pub trait Notification {
+ type Params: DeserializeOwned + Serialize;
+ const METHOD: &'static str;
+}
+
+#[macro_export]
+macro_rules! lsp_notification {
+ ("$/cancelRequest") => {
+ $crate::notification::Cancel
+ };
+ ("$/setTrace") => {
+ $crate::notification::SetTrace
+ };
+ ("$/logTrace") => {
+ $crate::notification::LogTrace
+ };
+ ("initialized") => {
+ $crate::notification::Initialized
+ };
+ ("exit") => {
+ $crate::notification::Exit
+ };
+
+ ("window/showMessage") => {
+ $crate::notification::ShowMessage
+ };
+ ("window/logMessage") => {
+ $crate::notification::LogMessage
+ };
+ ("window/workDoneProgress/cancel") => {
+ $crate::notification::WorkDoneProgressCancel
+ };
+
+ ("telemetry/event") => {
+ $crate::notification::TelemetryEvent
+ };
+
+ ("textDocument/didOpen") => {
+ $crate::notification::DidOpenTextDocument
+ };
+ ("textDocument/didChange") => {
+ $crate::notification::DidChangeTextDocument
+ };
+ ("textDocument/willSave") => {
+ $crate::notification::WillSaveTextDocument
+ };
+ ("textDocument/didSave") => {
+ $crate::notification::DidSaveTextDocument
+ };
+ ("textDocument/didClose") => {
+ $crate::notification::DidCloseTextDocument
+ };
+ ("textDocument/publishDiagnostics") => {
+ $crate::notification::PublishDiagnostics
+ };
+
+ ("workspace/didChangeConfiguration") => {
+ $crate::notification::DidChangeConfiguration
+ };
+ ("workspace/didChangeWatchedFiles") => {
+ $crate::notification::DidChangeWatchedFiles
+ };
+ ("workspace/didChangeWorkspaceFolders") => {
+ $crate::notification::DidChangeWorkspaceFolders
+ };
+ ("$/progress") => {
+ $crate::notification::Progress
+ };
+ ("workspace/didCreateFiles") => {
+ $crate::notification::DidCreateFiles
+ };
+ ("workspace/didRenameFiles") => {
+ $crate::notification::DidRenameFiles
+ };
+ ("workspace/didDeleteFiles") => {
+ $crate::notification::DidDeleteFiles
+ };
+}
+
+/// The base protocol now offers support for request cancellation. To cancel a request,
+/// a notification message with the following properties is sent:
+///
+/// A request that got canceled still needs to return from the server and send a response back.
+/// It can not be left open / hanging. This is in line with the JSON RPC protocol that requires
+/// that every request sends a response back. In addition it allows for returning partial results on cancel.
+#[derive(Debug)]
+pub enum Cancel {}
+
+impl Notification for Cancel {
+ type Params = CancelParams;
+ const METHOD: &'static str = "$/cancelRequest";
+}
+
+/// A notification that should be used by the client to modify the trace
+/// setting of the server.
+#[derive(Debug)]
+pub enum SetTrace {}
+
+impl Notification for SetTrace {
+ type Params = SetTraceParams;
+ const METHOD: &'static str = "$/setTrace";
+}
+
+/// A notification to log the trace of the server’s execution.
+/// The amount and content of these notifications depends on the current trace configuration.
+///
+/// `LogTrace` should be used for systematic trace reporting. For single debugging messages,
+/// the server should send `LogMessage` notifications.
+#[derive(Debug)]
+pub enum LogTrace {}
+
+impl Notification for LogTrace {
+ type Params = LogTraceParams;
+ const METHOD: &'static str = "$/logTrace";
+}
+
+/// The initialized notification is sent from the client to the server after the client received
+/// the result of the initialize request but before the client is sending any other request or
+/// notification to the server. The server can use the initialized notification for example to
+/// dynamically register capabilities.
+#[derive(Debug)]
+pub enum Initialized {}
+
+impl Notification for Initialized {
+ type Params = InitializedParams;
+ const METHOD: &'static str = "initialized";
+}
+
+/// A notification to ask the server to exit its process.
+/// The server should exit with success code 0 if the shutdown request has been received before;
+/// otherwise with error code 1.
+#[derive(Debug)]
+pub enum Exit {}
+
+impl Notification for Exit {
+ type Params = ();
+ const METHOD: &'static str = "exit";
+}
+
+/// The show message notification is sent from a server to a client to ask the client to display a particular message
+/// in the user interface.
+#[derive(Debug)]
+pub enum ShowMessage {}
+
+impl Notification for ShowMessage {
+ type Params = ShowMessageParams;
+ const METHOD: &'static str = "window/showMessage";
+}
+
+/// The log message notification is sent from the server to the client to ask the client to log a particular message.
+#[derive(Debug)]
+pub enum LogMessage {}
+
+impl Notification for LogMessage {
+ type Params = LogMessageParams;
+ const METHOD: &'static str = "window/logMessage";
+}
+
+/// The telemetry notification is sent from the server to the client to ask the client to log a telemetry event.
+/// The protocol doesn't specify the payload since no interpretation of the data happens in the protocol. Most clients even don't handle
+/// the event directly but forward them to the extensions owning the corresponding server issuing the event.
+#[derive(Debug)]
+pub enum TelemetryEvent {}
+
+impl Notification for TelemetryEvent {
+ type Params = serde_json::Value;
+ const METHOD: &'static str = "telemetry/event";
+}
+
+/// A notification sent from the client to the server to signal the change of configuration settings.
+#[derive(Debug)]
+pub enum DidChangeConfiguration {}
+
+impl Notification for DidChangeConfiguration {
+ type Params = DidChangeConfigurationParams;
+ const METHOD: &'static str = "workspace/didChangeConfiguration";
+}
+
+/// The document open notification is sent from the client to the server to signal newly opened text documents.
+/// The document's truth is now managed by the client and the server must not try to read the document's truth
+/// using the document's uri.
+#[derive(Debug)]
+pub enum DidOpenTextDocument {}
+
+impl Notification for DidOpenTextDocument {
+ type Params = DidOpenTextDocumentParams;
+ const METHOD: &'static str = "textDocument/didOpen";
+}
+
+/// The document change notification is sent from the client to the server to signal changes to a text document.
+/// In 2.0 the shape of the params has changed to include proper version numbers and language ids.
+#[derive(Debug)]
+pub enum DidChangeTextDocument {}
+
+impl Notification for DidChangeTextDocument {
+ type Params = DidChangeTextDocumentParams;
+ const METHOD: &'static str = "textDocument/didChange";
+}
+
+/// The document will save notification is sent from the client to the server before the document
+/// is actually saved.
+#[derive(Debug)]
+pub enum WillSaveTextDocument {}
+
+impl Notification for WillSaveTextDocument {
+ type Params = WillSaveTextDocumentParams;
+ const METHOD: &'static str = "textDocument/willSave";
+}
+
+/// The document close notification is sent from the client to the server when the document got closed in the client.
+/// The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri
+/// the truth now exists on disk).
+#[derive(Debug)]
+pub enum DidCloseTextDocument {}
+
+impl Notification for DidCloseTextDocument {
+ type Params = DidCloseTextDocumentParams;
+ const METHOD: &'static str = "textDocument/didClose";
+}
+
+/// The document save notification is sent from the client to the server when the document was saved in the client.
+#[derive(Debug)]
+pub enum DidSaveTextDocument {}
+
+impl Notification for DidSaveTextDocument {
+ type Params = DidSaveTextDocumentParams;
+ const METHOD: &'static str = "textDocument/didSave";
+}
+
+/// The watched files notification is sent from the client to the server when the client detects changes to files and folders
+/// watched by the language client (note although the name suggest that only file events are sent it is about file system events which include folders as well).
+/// It is recommended that servers register for these file system events using the registration mechanism.
+/// In former implementations clients pushed file events without the server actively asking for it.
+#[derive(Debug)]
+pub enum DidChangeWatchedFiles {}
+
+impl Notification for DidChangeWatchedFiles {
+ type Params = DidChangeWatchedFilesParams;
+ const METHOD: &'static str = "workspace/didChangeWatchedFiles";
+}
+
+/// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server to inform the server
+/// about workspace folder configuration changes
+#[derive(Debug)]
+pub enum DidChangeWorkspaceFolders {}
+
+impl Notification for DidChangeWorkspaceFolders {
+ type Params = DidChangeWorkspaceFoldersParams;
+ const METHOD: &'static str = "workspace/didChangeWorkspaceFolders";
+}
+
+/// Diagnostics notification are sent from the server to the client to signal results of validation runs.
+#[derive(Debug)]
+pub enum PublishDiagnostics {}
+
+impl Notification for PublishDiagnostics {
+ type Params = PublishDiagnosticsParams;
+ const METHOD: &'static str = "textDocument/publishDiagnostics";
+}
+
+/// The progress notification is sent from the server to the client to ask
+/// the client to indicate progress.
+#[derive(Debug)]
+pub enum Progress {}
+
+impl Notification for Progress {
+ type Params = ProgressParams;
+ const METHOD: &'static str = "$/progress";
+}
+
+/// The `window/workDoneProgress/cancel` notification is sent from the client
+/// to the server to cancel a progress initiated on the server side using the `window/workDoneProgress/create`.
+#[derive(Debug)]
+pub enum WorkDoneProgressCancel {}
+
+impl Notification for WorkDoneProgressCancel {
+ type Params = WorkDoneProgressCancelParams;
+ const METHOD: &'static str = "window/workDoneProgress/cancel";
+}
+
+/// The did create files notification is sent from the client to the server when files were created from within the client.
+#[derive(Debug)]
+pub enum DidCreateFiles {}
+
+impl Notification for DidCreateFiles {
+ type Params = CreateFilesParams;
+ const METHOD: &'static str = "workspace/didCreateFiles";
+}
+
+/// The did rename files notification is sent from the client to the server when files were renamed from within the client.
+#[derive(Debug)]
+pub enum DidRenameFiles {}
+
+impl Notification for DidRenameFiles {
+ type Params = RenameFilesParams;
+ const METHOD: &'static str = "workspace/didRenameFiles";
+}
+
+/// The did delete files notification is sent from the client to the server when files were deleted from within the client.
+#[derive(Debug)]
+pub enum DidDeleteFiles {}
+
+impl Notification for DidDeleteFiles {
+ type Params = DeleteFilesParams;
+ const METHOD: &'static str = "workspace/didDeleteFiles";
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ fn fake_call<N>()
+ where
+ N: Notification,
+ N::Params: serde::Serialize,
+ {
+ }
+
+ macro_rules! check_macro {
+ ($name:tt) => {
+ // check whether the macro name matches the method
+ assert_eq!(<lsp_notification!($name) as Notification>::METHOD, $name);
+ // test whether type checking passes for each component
+ fake_call::<lsp_notification!($name)>();
+ };
+ }
+
+ #[test]
+ fn check_macro_definitions() {
+ check_macro!("$/cancelRequest");
+ check_macro!("$/progress");
+ check_macro!("$/logTrace");
+ check_macro!("$/setTrace");
+ check_macro!("initialized");
+ check_macro!("exit");
+ check_macro!("window/showMessage");
+ check_macro!("window/logMessage");
+ check_macro!("window/workDoneProgress/cancel");
+ check_macro!("telemetry/event");
+ check_macro!("textDocument/didOpen");
+ check_macro!("textDocument/didChange");
+ check_macro!("textDocument/willSave");
+ check_macro!("textDocument/didSave");
+ check_macro!("textDocument/didClose");
+ check_macro!("textDocument/publishDiagnostics");
+ check_macro!("workspace/didChangeConfiguration");
+ check_macro!("workspace/didChangeWatchedFiles");
+ check_macro!("workspace/didChangeWorkspaceFolders");
+ check_macro!("workspace/didCreateFiles");
+ check_macro!("workspace/didRenameFiles");
+ check_macro!("workspace/didDeleteFiles");
+ }
+
+ #[test]
+ #[cfg(feature = "proposed")]
+ fn check_proposed_macro_definitions() {}
+}
diff --git a/vendor/lsp-types/src/progress.rs b/vendor/lsp-types/src/progress.rs
index 97d30e1a0..b16e5a981 100644
--- a/vendor/lsp-types/src/progress.rs
+++ b/vendor/lsp-types/src/progress.rs
@@ -1,134 +1,134 @@
-use serde::{Deserialize, Serialize};
-
-use crate::NumberOrString;
-
-pub type ProgressToken = NumberOrString;
-
-/// The progress notification is sent from the server to the client to ask
-/// the client to indicate progress.
-#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct ProgressParams {
- /// The progress token provided by the client.
- pub token: ProgressToken,
-
- /// The progress data.
- pub value: ProgressParamsValue,
-}
-
-#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(untagged)]
-pub enum ProgressParamsValue {
- WorkDone(WorkDoneProgress),
-}
-
-/// The `window/workDoneProgress/create` request is sent from the server
-/// to the clientto ask the client to create a work done progress.
-#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressCreateParams {
- /// The token to be used to report progress.
- pub token: ProgressToken,
-}
-
-/// The `window/workDoneProgress/cancel` notification is sent from the client
-/// to the server to cancel a progress initiated on the server side using the `window/workDoneProgress/create`.
-#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressCancelParams {
- /// The token to be used to report progress.
- pub token: ProgressToken,
-}
-
-/// Options to signal work done progress support in server capabilities.
-#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressOptions {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub work_done_progress: Option<bool>,
-}
-
-/// An optional token that a server can use to report work done progress
-#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressParams {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub work_done_token: Option<ProgressToken>,
-}
-
-#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressBegin {
- /// Mandatory title of the progress operation. Used to briefly inform
- /// about the kind of operation being performed.
- /// Examples: "Indexing" or "Linking dependencies".
- pub title: String,
-
- /// Controls if a cancel button should show to allow the user to cancel the
- /// long running operation. Clients that don't support cancellation are allowed
- /// to ignore the setting.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub cancellable: Option<bool>,
-
- /// Optional, more detailed associated progress message. Contains
- /// complementary information to the `title`.
- ///
- /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
- /// If unset, the previous progress message (if any) is still valid.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub message: Option<String>,
-
- /// Optional progress percentage to display (value 100 is considered 100%).
- /// If not provided infinite progress is assumed and clients are allowed
- /// to ignore the `percentage` value in subsequent in report notifications.
- ///
- /// The value should be steadily rising. Clients are free to ignore values
- /// that are not following this rule. The value range is [0, 100]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub percentage: Option<u32>,
-}
-
-#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressReport {
- /// Controls if a cancel button should show to allow the user to cancel the
- /// long running operation. Clients that don't support cancellation are allowed
- /// to ignore the setting.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub cancellable: Option<bool>,
-
- /// Optional, more detailed associated progress message. Contains
- /// complementary information to the `title`.
- /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
- /// If unset, the previous progress message (if any) is still valid.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub message: Option<String>,
-
- /// Optional progress percentage to display (value 100 is considered 100%).
- /// If not provided infinite progress is assumed and clients are allowed
- /// to ignore the `percentage` value in subsequent in report notifications.
- ///
- /// The value should be steadily rising. Clients are free to ignore values
- /// that are not following this rule. The value range is [0, 100]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub percentage: Option<u32>,
-}
-
-#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkDoneProgressEnd {
- /// Optional, more detailed associated progress message. Contains
- /// complementary information to the `title`.
- /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
- /// If unset, the previous progress message (if any) is still valid.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub message: Option<String>,
-}
-
-#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
-#[serde(tag = "kind", rename_all = "lowercase")]
-pub enum WorkDoneProgress {
- Begin(WorkDoneProgressBegin),
- Report(WorkDoneProgressReport),
- End(WorkDoneProgressEnd),
-}
+use serde::{Deserialize, Serialize};
+
+use crate::NumberOrString;
+
+pub type ProgressToken = NumberOrString;
+
+/// The progress notification is sent from the server to the client to ask
+/// the client to indicate progress.
+#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct ProgressParams {
+ /// The progress token provided by the client.
+ pub token: ProgressToken,
+
+ /// The progress data.
+ pub value: ProgressParamsValue,
+}
+
+#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(untagged)]
+pub enum ProgressParamsValue {
+ WorkDone(WorkDoneProgress),
+}
+
+/// The `window/workDoneProgress/create` request is sent from the server
+/// to the clientto ask the client to create a work done progress.
+#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressCreateParams {
+ /// The token to be used to report progress.
+ pub token: ProgressToken,
+}
+
+/// The `window/workDoneProgress/cancel` notification is sent from the client
+/// to the server to cancel a progress initiated on the server side using the `window/workDoneProgress/create`.
+#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressCancelParams {
+ /// The token to be used to report progress.
+ pub token: ProgressToken,
+}
+
+/// Options to signal work done progress support in server capabilities.
+#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressOptions {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub work_done_progress: Option<bool>,
+}
+
+/// An optional token that a server can use to report work done progress
+#[derive(Debug, Eq, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressParams {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub work_done_token: Option<ProgressToken>,
+}
+
+#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressBegin {
+ /// Mandatory title of the progress operation. Used to briefly inform
+ /// about the kind of operation being performed.
+ /// Examples: "Indexing" or "Linking dependencies".
+ pub title: String,
+
+ /// Controls if a cancel button should show to allow the user to cancel the
+ /// long running operation. Clients that don't support cancellation are allowed
+ /// to ignore the setting.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub cancellable: Option<bool>,
+
+ /// Optional, more detailed associated progress message. Contains
+ /// complementary information to the `title`.
+ ///
+ /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
+ /// If unset, the previous progress message (if any) is still valid.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub message: Option<String>,
+
+ /// Optional progress percentage to display (value 100 is considered 100%).
+ /// If not provided infinite progress is assumed and clients are allowed
+ /// to ignore the `percentage` value in subsequent in report notifications.
+ ///
+ /// The value should be steadily rising. Clients are free to ignore values
+ /// that are not following this rule. The value range is [0, 100]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub percentage: Option<u32>,
+}
+
+#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressReport {
+ /// Controls if a cancel button should show to allow the user to cancel the
+ /// long running operation. Clients that don't support cancellation are allowed
+ /// to ignore the setting.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub cancellable: Option<bool>,
+
+ /// Optional, more detailed associated progress message. Contains
+ /// complementary information to the `title`.
+ /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
+ /// If unset, the previous progress message (if any) is still valid.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub message: Option<String>,
+
+ /// Optional progress percentage to display (value 100 is considered 100%).
+ /// If not provided infinite progress is assumed and clients are allowed
+ /// to ignore the `percentage` value in subsequent in report notifications.
+ ///
+ /// The value should be steadily rising. Clients are free to ignore values
+ /// that are not following this rule. The value range is [0, 100]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub percentage: Option<u32>,
+}
+
+#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkDoneProgressEnd {
+ /// Optional, more detailed associated progress message. Contains
+ /// complementary information to the `title`.
+ /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
+ /// If unset, the previous progress message (if any) is still valid.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub message: Option<String>,
+}
+
+#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
+#[serde(tag = "kind", rename_all = "lowercase")]
+pub enum WorkDoneProgress {
+ Begin(WorkDoneProgressBegin),
+ Report(WorkDoneProgressReport),
+ End(WorkDoneProgressEnd),
+}
diff --git a/vendor/lsp-types/src/references.rs b/vendor/lsp-types/src/references.rs
index cb590d58e..4926bb771 100644
--- a/vendor/lsp-types/src/references.rs
+++ b/vendor/lsp-types/src/references.rs
@@ -1,30 +1,30 @@
-use crate::{
- DynamicRegistrationClientCapabilities, PartialResultParams, TextDocumentPositionParams,
- WorkDoneProgressParams,
-};
-use serde::{Deserialize, Serialize};
-
-pub type ReferenceClientCapabilities = DynamicRegistrationClientCapabilities;
-#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ReferenceContext {
- /// Include the declaration of the current symbol.
- pub include_declaration: bool,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ReferenceParams {
- // Text Document and Position fields
- #[serde(flatten)]
- pub text_document_position: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- // ReferenceParams properties:
- pub context: ReferenceContext,
-}
+use crate::{
+ DynamicRegistrationClientCapabilities, PartialResultParams, TextDocumentPositionParams,
+ WorkDoneProgressParams,
+};
+use serde::{Deserialize, Serialize};
+
+pub type ReferenceClientCapabilities = DynamicRegistrationClientCapabilities;
+#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ReferenceContext {
+ /// Include the declaration of the current symbol.
+ pub include_declaration: bool,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ReferenceParams {
+ // Text Document and Position fields
+ #[serde(flatten)]
+ pub text_document_position: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ // ReferenceParams properties:
+ pub context: ReferenceContext,
+}
diff --git a/vendor/lsp-types/src/rename.rs b/vendor/lsp-types/src/rename.rs
index b84bdcf6d..4645035a4 100644
--- a/vendor/lsp-types/src/rename.rs
+++ b/vendor/lsp-types/src/rename.rs
@@ -1,88 +1,88 @@
-use crate::{Range, TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams};
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameParams {
- /// Text Document and Position fields
- #[serde(flatten)]
- pub text_document_position: TextDocumentPositionParams,
-
- /// The new name of the symbol. If the given name is not valid the
- /// request must return a [ResponseError](#ResponseError) with an
- /// appropriate message set.
- pub new_name: String,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameOptions {
- /// Renames should be checked and tested before being executed.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub prepare_provider: Option<bool>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenameClientCapabilities {
- /// Whether rename supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Client supports testing for validity of rename operations before execution.
- ///
- /// since 3.12.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub prepare_support: Option<bool>,
-
- /// Client supports the default behavior result.
- ///
- /// The value indicates the default behavior used by the
- /// client.
- ///
- /// since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
-
- /// Whether the client honors the change annotations in
- /// text edits and resource operations returned via the
- /// rename request's workspace edit by for example presenting
- /// the workspace edit in the user interface and asking
- /// for confirmation.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub honors_change_annotations: Option<bool>,
-}
-
-#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct PrepareSupportDefaultBehavior(i32);
-lsp_enum! {
-impl PrepareSupportDefaultBehavior {
- /// The client's default behavior is to select the identifier
- /// according the to language's syntax rule
- pub const IDENTIFIER: PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior(1);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-#[serde(rename_all = "camelCase")]
-pub enum PrepareRenameResponse {
- Range(Range),
- RangeWithPlaceholder {
- range: Range,
- placeholder: String,
- },
- #[serde(rename_all = "camelCase")]
- DefaultBehavior {
- default_behavior: bool,
- },
-}
+use crate::{Range, TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams};
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameParams {
+ /// Text Document and Position fields
+ #[serde(flatten)]
+ pub text_document_position: TextDocumentPositionParams,
+
+ /// The new name of the symbol. If the given name is not valid the
+ /// request must return a [ResponseError](#ResponseError) with an
+ /// appropriate message set.
+ pub new_name: String,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameOptions {
+ /// Renames should be checked and tested before being executed.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub prepare_provider: Option<bool>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RenameClientCapabilities {
+ /// Whether rename supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Client supports testing for validity of rename operations before execution.
+ ///
+ /// since 3.12.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub prepare_support: Option<bool>,
+
+ /// Client supports the default behavior result.
+ ///
+ /// The value indicates the default behavior used by the
+ /// client.
+ ///
+ /// since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
+
+ /// Whether the client honors the change annotations in
+ /// text edits and resource operations returned via the
+ /// rename request's workspace edit by for example presenting
+ /// the workspace edit in the user interface and asking
+ /// for confirmation.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub honors_change_annotations: Option<bool>,
+}
+
+#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct PrepareSupportDefaultBehavior(i32);
+lsp_enum! {
+impl PrepareSupportDefaultBehavior {
+ /// The client's default behavior is to select the identifier
+ /// according the to language's syntax rule
+ pub const IDENTIFIER: PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior(1);
+}
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+#[serde(rename_all = "camelCase")]
+pub enum PrepareRenameResponse {
+ Range(Range),
+ RangeWithPlaceholder {
+ range: Range,
+ placeholder: String,
+ },
+ #[serde(rename_all = "camelCase")]
+ DefaultBehavior {
+ default_behavior: bool,
+ },
+}
diff --git a/vendor/lsp-types/src/request.rs b/vendor/lsp-types/src/request.rs
index aa03be4a4..da2efd74b 100644
--- a/vendor/lsp-types/src/request.rs
+++ b/vendor/lsp-types/src/request.rs
@@ -1,889 +1,1001 @@
-use super::*;
-
-use serde::{de::DeserializeOwned, Serialize};
-
-pub trait Request {
- type Params: DeserializeOwned + Serialize;
- type Result: DeserializeOwned + Serialize;
- const METHOD: &'static str;
-}
-
-#[macro_export]
-macro_rules! lsp_request {
- ("initialize") => {
- $crate::request::Initialize
- };
- ("shutdown") => {
- $crate::request::Shutdown
- };
-
- ("window/showMessageRequest") => {
- $crate::request::ShowMessageRequest
- };
-
- ("client/registerCapability") => {
- $crate::request::RegisterCapability
- };
- ("client/unregisterCapability") => {
- $crate::request::UnregisterCapability
- };
-
- ("workspace/symbol") => {
- $crate::request::WorkspaceSymbol
- };
- ("workspace/executeCommand") => {
- $crate::request::ExecuteCommand
- };
-
- ("textDocument/willSaveWaitUntil") => {
- $crate::request::WillSaveWaitUntil
- };
-
- ("textDocument/completion") => {
- $crate::request::Completion
- };
- ("completionItem/resolve") => {
- $crate::request::ResolveCompletionItem
- };
- ("textDocument/hover") => {
- $crate::request::HoverRequest
- };
- ("textDocument/signatureHelp") => {
- $crate::request::SignatureHelpRequest
- };
- ("textDocument/declaration") => {
- $crate::request::GotoDeclaration
- };
- ("textDocument/definition") => {
- $crate::request::GotoDefinition
- };
- ("textDocument/references") => {
- $crate::request::References
- };
- ("textDocument/documentHighlight") => {
- $crate::request::DocumentHighlightRequest
- };
- ("textDocument/documentSymbol") => {
- $crate::request::DocumentSymbolRequest
- };
- ("textDocument/codeAction") => {
- $crate::request::CodeActionRequest
- };
- ("textDocument/codeLens") => {
- $crate::request::CodeLensRequest
- };
- ("codeLens/resolve") => {
- $crate::request::CodeLensResolve
- };
- ("textDocument/documentLink") => {
- $crate::request::DocumentLinkRequest
- };
- ("documentLink/resolve") => {
- $crate::request::DocumentLinkResolve
- };
- ("workspace/applyEdit") => {
- $crate::request::ApplyWorkspaceEdit
- };
- ("textDocument/rangeFormatting") => {
- $crate::request::RangeFormatting
- };
- ("textDocument/onTypeFormatting") => {
- $crate::request::OnTypeFormatting
- };
- ("textDocument/formatting") => {
- $crate::request::Formatting
- };
- ("textDocument/rename") => {
- $crate::request::Rename
- };
- ("textDocument/documentColor") => {
- $crate::request::DocumentColor
- };
- ("textDocument/colorPresentation") => {
- $crate::request::ColorPresentationRequest
- };
- ("textDocument/foldingRange") => {
- $crate::request::FoldingRangeRequest
- };
- ("textDocument/prepareRename") => {
- $crate::request::PrepareRenameRequest
- };
- ("textDocument/implementation") => {
- $crate::request::GotoImplementation
- };
- ("textDocument/typeDefinition") => {
- $crate::request::GotoTypeDefinition
- };
- ("textDocument/selectionRange") => {
- $crate::request::SelectionRangeRequest
- };
- ("workspace/workspaceFolders") => {
- $crate::request::WorkspaceFoldersRequest
- };
- ("workspace/configuration") => {
- $crate::request::WorkspaceConfiguration
- };
- ("window/workDoneProgress/create") => {
- $crate::request::WorkDoneProgressCreate
- };
- ("callHierarchy/incomingCalls") => {
- $crate::request::CallHierarchyIncomingCalls
- };
- ("callHierarchy/outgoingCalls") => {
- $crate::request::CallHierarchyOutgoingCalls
- };
- ("textDocument/moniker") => {
- $crate::request::MonikerRequest
- };
- ("textDocument/linkedEditingRange") => {
- $crate::request::LinkedEditingRange
- };
- ("textDocument/prepareCallHierarchy") => {
- $crate::request::CallHierarchyPrepare
- };
- ("textDocument/semanticTokens/full") => {
- $crate::request::SemanticTokensFullRequest
- };
- ("textDocument/semanticTokens/full/delta") => {
- $crate::request::SemanticTokensFullDeltaRequest
- };
- ("textDocument/semanticTokens/range") => {
- $crate::request::SemanticTokensRangeRequest
- };
- ("workspace/willCreateFiles") => {
- $crate::request::WillCreateFiles
- };
- ("workspace/willRenameFiles") => {
- $crate::request::WillRenameFiles
- };
- ("workspace/willDeleteFiles") => {
- $crate::request::WillDeleteFiles
- };
- ("workspace/semanticTokens/refresh") => {
- $crate::request::SemanticTokensRefresh
- };
- ("workspace/codeLens/refresh") => {
- $crate::request::CodeLensRefresh
- };
- ("codeAction/resolve") => {
- $crate::request::CodeActionResolveRequest
- };
- ("window/showDocument") => {
- $crate::request::ShowDocument
- };
-}
-
-/// The initialize request is sent as the first request from the client to the server.
-/// If the server receives request or notification before the `initialize` request it should act as follows:
-///
-/// * for a request the respond should be errored with `code: -32001`. The message can be picked by the server.
-/// * notifications should be dropped.
-#[derive(Debug)]
-pub enum Initialize {}
-
-impl Request for Initialize {
- type Params = InitializeParams;
- type Result = InitializeResult;
- const METHOD: &'static str = "initialize";
-}
-
-/// The shutdown request is sent from the client to the server. It asks the server to shut down,
-/// but to not exit (otherwise the response might not be delivered correctly to the client).
-/// There is a separate exit notification that asks the server to exit.
-#[derive(Debug)]
-pub enum Shutdown {}
-
-impl Request for Shutdown {
- type Params = ();
- type Result = ();
- const METHOD: &'static str = "shutdown";
-}
-
-/// The show message request is sent from a server to a client to ask the client to display a particular message
-/// in the user interface. In addition to the show message notification the request allows to pass actions and to
-/// wait for an answer from the client.
-#[derive(Debug)]
-pub enum ShowMessageRequest {}
-
-impl Request for ShowMessageRequest {
- type Params = ShowMessageRequestParams;
- type Result = Option<MessageActionItem>;
- const METHOD: &'static str = "window/showMessageRequest";
-}
-
-/// The client/registerCapability request is sent from the server to the client to register for a new capability
-/// on the client side. Not all clients need to support dynamic capability registration. A client opts in via the
-/// ClientCapabilities.GenericCapability property.
-#[derive(Debug)]
-pub enum RegisterCapability {}
-
-impl Request for RegisterCapability {
- type Params = RegistrationParams;
- type Result = ();
- const METHOD: &'static str = "client/registerCapability";
-}
-
-/// The client/unregisterCapability request is sent from the server to the client to unregister a
-/// previously register capability.
-#[derive(Debug)]
-pub enum UnregisterCapability {}
-
-impl Request for UnregisterCapability {
- type Params = UnregistrationParams;
- type Result = ();
- const METHOD: &'static str = "client/unregisterCapability";
-}
-
-/// The Completion request is sent from the client to the server to compute completion items at a given cursor position.
-/// Completion items are presented in the IntelliSense user interface. If computing full completion items is expensive,
-/// servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve').
-/// This request is sent when a completion item is selected in the user interface. A typical use case is for example:
-/// the 'textDocument/completion' request doesn’t fill in the documentation property for returned completion items
-/// since it is expensive to compute. When the item is selected in the user interface then a ‘completionItem/resolve’
-/// request is sent with the selected completion item as a param. The returned completion item should have the
-/// documentation property filled in. The request can delay the computation of the detail and documentation properties.
-/// However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText,
-/// and textEdit must be provided in the textDocument/completion request and must not be changed during resolve.
-#[derive(Debug)]
-pub enum Completion {}
-
-impl Request for Completion {
- type Params = CompletionParams;
- type Result = Option<CompletionResponse>;
- const METHOD: &'static str = "textDocument/completion";
-}
-
-/// The request is sent from the client to the server to resolve additional information for a given completion item.
-#[derive(Debug)]
-pub enum ResolveCompletionItem {}
-
-impl Request for ResolveCompletionItem {
- type Params = CompletionItem;
- type Result = CompletionItem;
- const METHOD: &'static str = "completionItem/resolve";
-}
-
-/// The hover request is sent from the client to the server to request hover information at a given text
-/// document position.
-#[derive(Debug)]
-pub enum HoverRequest {}
-
-impl Request for HoverRequest {
- type Params = HoverParams;
- type Result = Option<Hover>;
- const METHOD: &'static str = "textDocument/hover";
-}
-
-/// The signature help request is sent from the client to the server to request signature information at
-/// a given cursor position.
-#[derive(Debug)]
-pub enum SignatureHelpRequest {}
-
-impl Request for SignatureHelpRequest {
- type Params = SignatureHelpParams;
- type Result = Option<SignatureHelp>;
- const METHOD: &'static str = "textDocument/signatureHelp";
-}
-
-#[derive(Debug)]
-pub enum GotoDeclaration {}
-pub type GotoDeclarationParams = GotoDefinitionParams;
-pub type GotoDeclarationResponse = GotoDefinitionResponse;
-
-/// The goto declaration request is sent from the client to the server to resolve the declaration location of
-/// a symbol at a given text document position.
-impl Request for GotoDeclaration {
- type Params = GotoDeclarationParams;
- type Result = Option<GotoDeclarationResponse>;
- const METHOD: &'static str = "textDocument/declaration";
-}
-
-/// The goto definition request is sent from the client to the server to resolve the definition location of
-/// a symbol at a given text document position.
-#[derive(Debug)]
-pub enum GotoDefinition {}
-
-impl Request for GotoDefinition {
- type Params = GotoDefinitionParams;
- type Result = Option<GotoDefinitionResponse>;
- const METHOD: &'static str = "textDocument/definition";
-}
-
-/// The references request is sent from the client to the server to resolve project-wide references for the
-/// symbol denoted by the given text document position.
-#[derive(Debug)]
-pub enum References {}
-
-impl Request for References {
- type Params = ReferenceParams;
- type Result = Option<Vec<Location>>;
- const METHOD: &'static str = "textDocument/references";
-}
-
-/// The goto type definition request is sent from the client to the
-/// server to resolve the type definition location of a symbol at a
-/// given text document position.
-#[derive(Debug)]
-pub enum GotoTypeDefinition {}
-
-pub type GotoTypeDefinitionParams = GotoDefinitionParams;
-pub type GotoTypeDefinitionResponse = GotoDefinitionResponse;
-
-impl Request for GotoTypeDefinition {
- type Params = GotoTypeDefinitionParams;
- type Result = Option<GotoTypeDefinitionResponse>;
- const METHOD: &'static str = "textDocument/typeDefinition";
-}
-
-/// The goto implementation request is sent from the client to the
-/// server to resolve the implementation location of a symbol at a
-/// given text document position.
-#[derive(Debug)]
-pub enum GotoImplementation {}
-
-pub type GotoImplementationParams = GotoTypeDefinitionParams;
-pub type GotoImplementationResponse = GotoDefinitionResponse;
-
-impl Request for GotoImplementation {
- type Params = GotoImplementationParams;
- type Result = Option<GotoImplementationResponse>;
- const METHOD: &'static str = "textDocument/implementation";
-}
-
-/// The document highlight request is sent from the client to the server to resolve a document highlights
-/// for a given text document position.
-/// For programming languages this usually highlights all references to the symbol scoped to this file.
-/// However we kept 'textDocument/documentHighlight' and 'textDocument/references' separate requests since
-/// the first one is allowed to be more fuzzy.
-/// Symbol matches usually have a DocumentHighlightKind of Read or Write whereas fuzzy or textual matches
-/// use Text as the kind.
-#[derive(Debug)]
-pub enum DocumentHighlightRequest {}
-
-impl Request for DocumentHighlightRequest {
- type Params = DocumentHighlightParams;
- type Result = Option<Vec<DocumentHighlight>>;
- const METHOD: &'static str = "textDocument/documentHighlight";
-}
-
-/// The document symbol request is sent from the client to the server to list all symbols found in a given
-/// text document.
-#[derive(Debug)]
-pub enum DocumentSymbolRequest {}
-
-impl Request for DocumentSymbolRequest {
- type Params = DocumentSymbolParams;
- type Result = Option<DocumentSymbolResponse>;
- const METHOD: &'static str = "textDocument/documentSymbol";
-}
-
-/// The workspace symbol request is sent from the client to the server to list project-wide symbols
-/// matching the query string.
-#[derive(Debug)]
-pub enum WorkspaceSymbol {}
-
-impl Request for WorkspaceSymbol {
- type Params = WorkspaceSymbolParams;
- type Result = Option<Vec<SymbolInformation>>;
- const METHOD: &'static str = "workspace/symbol";
-}
-
-/// The workspace/executeCommand request is sent from the client to the server to trigger command execution on the server.
-/// In most cases the server creates a WorkspaceEdit structure and applies the changes to the workspace using the request
-/// workspace/applyEdit which is sent from the server to the client.
-#[derive(Debug)]
-pub enum ExecuteCommand {}
-
-impl Request for ExecuteCommand {
- type Params = ExecuteCommandParams;
- type Result = Option<Value>;
- const METHOD: &'static str = "workspace/executeCommand";
-}
-
-/// The document will save request is sent from the client to the server before the document is
-/// actually saved. The request can return an array of TextEdits which will be applied to the text
-/// document before it is saved. Please note that clients might drop results if computing the text
-/// edits took too long or if a server constantly fails on this request. This is done to keep the
-/// save fast and reliable.
-#[derive(Debug)]
-pub enum WillSaveWaitUntil {}
-
-impl Request for WillSaveWaitUntil {
- type Params = WillSaveTextDocumentParams;
- type Result = Option<Vec<TextEdit>>;
- const METHOD: &'static str = "textDocument/willSaveWaitUntil";
-}
-
-/// The workspace/applyEdit request is sent from the server to the client to modify resource on the
-/// client side.
-#[derive(Debug)]
-pub enum ApplyWorkspaceEdit {}
-
-impl Request for ApplyWorkspaceEdit {
- type Params = ApplyWorkspaceEditParams;
- type Result = ApplyWorkspaceEditResponse;
- const METHOD: &'static str = "workspace/applyEdit";
-}
-
-/// The workspace/configuration request is sent from the server to the client to fetch configuration settings
-/// from the client. The request can fetch several configuration settings in one roundtrip.
-/// The order of the returned configuration settings correspond to the order of the passed ConfigurationItems
-/// (e.g. the first item in the response is the result for the first configuration item in the params).
-///
-/// A ConfigurationItem consists of the configuration section to ask for and an additional scope URI.
-/// The configuration section ask for is defined by the server and doesn’t necessarily need to correspond to
-/// the configuration store used be the client. So a server might ask for a configuration cpp.formatterOptions
-/// but the client stores the configuration in a XML store layout differently.
-/// It is up to the client to do the necessary conversion. If a scope URI is provided the client should return
-/// the setting scoped to the provided resource. If the client for example uses EditorConfig to manage its
-/// settings the configuration should be returned for the passed resource URI. If the client can’t provide a
-/// configuration setting for a given scope then null need to be present in the returned array.
-#[derive(Debug)]
-pub enum WorkspaceConfiguration {}
-
-impl Request for WorkspaceConfiguration {
- type Params = ConfigurationParams;
- type Result = Vec<Value>;
- const METHOD: &'static str = "workspace/configuration";
-}
-
-/// The code action request is sent from the client to the server to compute commands for a given text document
-/// and range. The request is triggered when the user moves the cursor into a problem marker in the editor or
-/// presses the lightbulb associated with a marker.
-#[derive(Debug)]
-pub enum CodeActionRequest {}
-
-impl Request for CodeActionRequest {
- type Params = CodeActionParams;
- type Result = Option<CodeActionResponse>;
- const METHOD: &'static str = "textDocument/codeAction";
-}
-
-/// The request is sent from the client to the server to resolve additional information for a given code action.
-/// This is usually used to compute the `edit` property of a code action to avoid its unnecessary computation
-/// during the `textDocument/codeAction` request.
-///
-/// since 3.16.0
-#[derive(Debug)]
-pub enum CodeActionResolveRequest {}
-
-impl Request for CodeActionResolveRequest {
- type Params = CodeAction;
- type Result = CodeAction;
- const METHOD: &'static str = "codeAction/resolve";
-}
-
-/// The code lens request is sent from the client to the server to compute code lenses for a given text document.
-#[derive(Debug)]
-pub enum CodeLensRequest {}
-
-impl Request for CodeLensRequest {
- type Params = CodeLensParams;
- type Result = Option<Vec<CodeLens>>;
- const METHOD: &'static str = "textDocument/codeLens";
-}
-
-/// The code lens resolve request is sent from the client to the server to resolve the command for a
-/// given code lens item.
-#[derive(Debug)]
-pub enum CodeLensResolve {}
-
-impl Request for CodeLensResolve {
- type Params = CodeLens;
- type Result = CodeLens;
- const METHOD: &'static str = "codeLens/resolve";
-}
-
-/// The document links request is sent from the client to the server to request the location of links in a document.
-#[derive(Debug)]
-pub enum DocumentLinkRequest {}
-
-impl Request for DocumentLinkRequest {
- type Params = DocumentLinkParams;
- type Result = Option<Vec<DocumentLink>>;
- const METHOD: &'static str = "textDocument/documentLink";
-}
-
-/// The document link resolve request is sent from the client to the server to resolve the target of
-/// a given document link.
-#[derive(Debug)]
-pub enum DocumentLinkResolve {}
-
-impl Request for DocumentLinkResolve {
- type Params = DocumentLink;
- type Result = DocumentLink;
- const METHOD: &'static str = "documentLink/resolve";
-}
-
-/// The document formatting request is sent from the server to the client to format a whole document.
-#[derive(Debug)]
-pub enum Formatting {}
-
-impl Request for Formatting {
- type Params = DocumentFormattingParams;
- type Result = Option<Vec<TextEdit>>;
- const METHOD: &'static str = "textDocument/formatting";
-}
-
-/// The document range formatting request is sent from the client to the server to format a given range in a document.
-#[derive(Debug)]
-pub enum RangeFormatting {}
-
-impl Request for RangeFormatting {
- type Params = DocumentRangeFormattingParams;
- type Result = Option<Vec<TextEdit>>;
- const METHOD: &'static str = "textDocument/rangeFormatting";
-}
-
-/// The document on type formatting request is sent from the client to the server to format parts of
-/// the document during typing.
-#[derive(Debug)]
-pub enum OnTypeFormatting {}
-
-impl Request for OnTypeFormatting {
- type Params = DocumentOnTypeFormattingParams;
- type Result = Option<Vec<TextEdit>>;
- const METHOD: &'static str = "textDocument/onTypeFormatting";
-}
-
-/// The linked editing request is sent from the client to the server to return for a given position in a document
-/// the range of the symbol at the position and all ranges that have the same content.
-/// Optionally a word pattern can be returned to describe valid contents. A rename to one of the ranges can be applied
-/// to all other ranges if the new content is valid. If no result-specific word pattern is provided, the word pattern from
-/// the client’s language configuration is used.
-#[derive(Debug)]
-pub enum LinkedEditingRange {}
-
-impl Request for LinkedEditingRange {
- type Params = LinkedEditingRangeParams;
- type Result = Option<LinkedEditingRanges>;
- const METHOD: &'static str = "textDocument/linkedEditingRange";
-}
-
-/// The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol.
-#[derive(Debug)]
-pub enum Rename {}
-
-impl Request for Rename {
- type Params = RenameParams;
- type Result = Option<WorkspaceEdit>;
- const METHOD: &'static str = "textDocument/rename";
-}
-
-/// The document color request is sent from the client to the server to list all color references found in a given text document.
-/// Along with the range, a color value in RGB is returned.
-#[derive(Debug)]
-pub enum DocumentColor {}
-
-impl Request for DocumentColor {
- type Params = DocumentColorParams;
- type Result = Vec<ColorInformation>;
- const METHOD: &'static str = "textDocument/documentColor";
-}
-
-/// The color presentation request is sent from the client to the server to obtain a list of presentations for a color value
-/// at a given location.
-#[derive(Debug)]
-pub enum ColorPresentationRequest {}
-
-impl Request for ColorPresentationRequest {
- type Params = ColorPresentationParams;
- type Result = Vec<ColorPresentation>;
- const METHOD: &'static str = "textDocument/colorPresentation";
-}
-
-/// The folding range request is sent from the client to the server to return all folding ranges found in a given text document.
-#[derive(Debug)]
-pub enum FoldingRangeRequest {}
-
-impl Request for FoldingRangeRequest {
- type Params = FoldingRangeParams;
- type Result = Option<Vec<FoldingRange>>;
- const METHOD: &'static str = "textDocument/foldingRange";
-}
-
-/// The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation
-/// at a given location.
-#[derive(Debug)]
-pub enum PrepareRenameRequest {}
-
-impl Request for PrepareRenameRequest {
- type Params = TextDocumentPositionParams;
- type Result = Option<PrepareRenameResponse>;
- const METHOD: &'static str = "textDocument/prepareRename";
-}
-
-/// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open list of
-/// workspace folders. Returns null in the response if only a single file is open in the tool.
-/// Returns an empty array if a workspace is open but no folders are configured.
-#[derive(Debug)]
-pub enum WorkspaceFoldersRequest {}
-
-impl Request for WorkspaceFoldersRequest {
- type Params = ();
- type Result = Option<Vec<WorkspaceFolder>>;
- const METHOD: &'static str = "workspace/workspaceFolders";
-}
-
-/// The `window/workDoneProgress/create` request is sent from the server
-/// to the clientto ask the client to create a work done progress.
-#[derive(Debug)]
-pub enum WorkDoneProgressCreate {}
-
-impl Request for WorkDoneProgressCreate {
- type Params = WorkDoneProgressCreateParams;
- type Result = ();
- const METHOD: &'static str = "window/workDoneProgress/create";
-}
-
-/// The selection range request is sent from the client to the server to return
-/// suggested selection ranges at given positions. A selection range is a range
-/// around the cursor position which the user might be interested in selecting.
-///
-/// A selection range in the return array is for the position in the provided parameters at the same index.
-/// Therefore `positions[i]` must be contained in `result[i].range`.
-///
-/// Typically, but not necessary, selection ranges correspond to the nodes of the
-/// syntax tree.
-pub enum SelectionRangeRequest {}
-
-impl Request for SelectionRangeRequest {
- type Params = SelectionRangeParams;
- type Result = Option<Vec<SelectionRange>>;
- const METHOD: &'static str = "textDocument/selectionRange";
-}
-
-pub enum CallHierarchyPrepare {}
-
-impl Request for CallHierarchyPrepare {
- type Params = CallHierarchyPrepareParams;
- type Result = Option<Vec<CallHierarchyItem>>;
- const METHOD: &'static str = "textDocument/prepareCallHierarchy";
-}
-
-pub enum CallHierarchyIncomingCalls {}
-
-impl Request for CallHierarchyIncomingCalls {
- type Params = CallHierarchyIncomingCallsParams;
- type Result = Option<Vec<CallHierarchyIncomingCall>>;
- const METHOD: &'static str = "callHierarchy/incomingCalls";
-}
-
-pub enum CallHierarchyOutgoingCalls {}
-
-impl Request for CallHierarchyOutgoingCalls {
- type Params = CallHierarchyOutgoingCallsParams;
- type Result = Option<Vec<CallHierarchyOutgoingCall>>;
- const METHOD: &'static str = "callHierarchy/outgoingCalls";
-}
-
-pub enum SemanticTokensFullRequest {}
-
-impl Request for SemanticTokensFullRequest {
- type Params = SemanticTokensParams;
- type Result = Option<SemanticTokensResult>;
- const METHOD: &'static str = "textDocument/semanticTokens/full";
-}
-
-pub enum SemanticTokensFullDeltaRequest {}
-
-impl Request for SemanticTokensFullDeltaRequest {
- type Params = SemanticTokensDeltaParams;
- type Result = Option<SemanticTokensFullDeltaResult>;
- const METHOD: &'static str = "textDocument/semanticTokens/full/delta";
-}
-
-pub enum SemanticTokensRangeRequest {}
-
-impl Request for SemanticTokensRangeRequest {
- type Params = SemanticTokensRangeParams;
- type Result = Option<SemanticTokensRangeResult>;
- const METHOD: &'static str = "textDocument/semanticTokens/range";
-}
-
-/// The `workspace/semanticTokens/refresh` request is sent from the server to the client.
-/// Servers can use it to ask clients to refresh the editors for which this server provides semantic tokens.
-/// As a result the client should ask the server to recompute the semantic tokens for these editors.
-/// This is useful if a server detects a project wide configuration change which requires a re-calculation of all semantic tokens.
-/// Note that the client still has the freedom to delay the re-calculation of the semantic tokens if for example an editor is currently not visible.
-pub enum SemanticTokensRefresh {}
-
-impl Request for SemanticTokensRefresh {
- type Params = ();
- type Result = ();
- const METHOD: &'static str = "workspace/semanticTokens/refresh";
-}
-
-/// The workspace/codeLens/refresh request is sent from the server to the client.
-/// Servers can use it to ask clients to refresh the code lenses currently shown in editors.
-/// As a result the client should ask the server to recompute the code lenses for these editors.
-/// This is useful if a server detects a configuration change which requires a re-calculation of all code lenses.
-/// Note that the client still has the freedom to delay the re-calculation of the code lenses if for example an editor is currently not visible.
-pub enum CodeLensRefresh {}
-
-impl Request for CodeLensRefresh {
- type Params = ();
- type Result = ();
- const METHOD: &'static str = "workspace/codeLens/refresh";
-}
-
-/// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep creates fast and reliable.
-pub enum WillCreateFiles {}
-
-impl Request for WillCreateFiles {
- type Params = CreateFilesParams;
- type Result = Option<WorkspaceEdit>;
- const METHOD: &'static str = "workspace/willCreateFiles";
-}
-
-/// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are renamed. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep renames fast and reliable.
-pub enum WillRenameFiles {}
-
-impl Request for WillRenameFiles {
- type Params = RenameFilesParams;
- type Result = Option<WorkspaceEdit>;
- const METHOD: &'static str = "workspace/willRenameFiles";
-}
-
-/// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are deleted. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep deletes fast and reliable.
-pub enum WillDeleteFiles {}
-
-impl Request for WillDeleteFiles {
- type Params = DeleteFilesParams;
- type Result = Option<WorkspaceEdit>;
- const METHOD: &'static str = "workspace/willDeleteFiles";
-}
-
-/// The show document request is sent from a server to a client to ask the client to display a particular document in the user interface.
-pub enum ShowDocument {}
-
-impl Request for ShowDocument {
- type Params = ShowDocumentParams;
- type Result = ShowDocumentResult;
- const METHOD: &'static str = "window/showDocument";
-}
-
-pub enum MonikerRequest {}
-
-impl Request for MonikerRequest {
- type Params = MonikerParams;
- type Result = Option<Vec<Moniker>>;
- const METHOD: &'static str = "textDocument/moniker";
-}
-
-#[cfg(feature = "proposed")]
-pub enum InlayHintRequest {}
-
-#[cfg(feature = "proposed")]
-impl Request for InlayHintRequest {
- type Params = InlayHintParams;
- type Result = Option<Vec<InlayHint>>;
- const METHOD: &'static str = "textDocument/inlayHint";
-}
-
-#[cfg(feature = "proposed")]
-pub enum InlayHintResolveRequest {}
-
-#[cfg(feature = "proposed")]
-impl Request for InlayHintResolveRequest {
- type Params = InlayHint;
- type Result = InlayHint;
- const METHOD: &'static str = "inlayHint/resolve";
-}
-
-#[cfg(feature = "proposed")]
-pub enum InlayHintRefreshRequest {}
-
-#[cfg(feature = "proposed")]
-impl Request for InlayHintRefreshRequest {
- type Params = ();
- type Result = ();
- const METHOD: &'static str = "workspace/inlayHint/refresh";
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
-
- fn fake_call<R>()
- where
- R: Request,
- R::Params: serde::Serialize,
- R::Result: serde::de::DeserializeOwned,
- {
- }
-
- macro_rules! check_macro {
- ($name:tt) => {
- // check whethe the macro name matches the method
- assert_eq!(<lsp_request!($name) as Request>::METHOD, $name);
- // test whether type checking passes for each component
- fake_call::<lsp_request!($name)>();
- };
- }
-
- #[test]
- fn check_macro_definitions() {
- check_macro!("initialize");
- check_macro!("shutdown");
-
- check_macro!("window/showDocument");
- check_macro!("window/showMessageRequest");
- check_macro!("window/workDoneProgress/create");
-
- check_macro!("client/registerCapability");
- check_macro!("client/unregisterCapability");
-
- check_macro!("textDocument/willSaveWaitUntil");
- check_macro!("textDocument/completion");
- check_macro!("textDocument/hover");
- check_macro!("textDocument/signatureHelp");
- check_macro!("textDocument/declaration");
- check_macro!("textDocument/definition");
- check_macro!("textDocument/references");
- check_macro!("textDocument/documentHighlight");
- check_macro!("textDocument/documentSymbol");
- check_macro!("textDocument/codeAction");
- check_macro!("textDocument/codeLens");
- check_macro!("textDocument/documentLink");
- check_macro!("textDocument/rangeFormatting");
- check_macro!("textDocument/onTypeFormatting");
- check_macro!("textDocument/formatting");
- check_macro!("textDocument/rename");
- check_macro!("textDocument/documentColor");
- check_macro!("textDocument/colorPresentation");
- check_macro!("textDocument/foldingRange");
- check_macro!("textDocument/prepareRename");
- check_macro!("textDocument/implementation");
- check_macro!("textDocument/selectionRange");
- check_macro!("textDocument/typeDefinition");
- check_macro!("textDocument/moniker");
- check_macro!("textDocument/linkedEditingRange");
- check_macro!("textDocument/prepareCallHierarchy");
- check_macro!("textDocument/semanticTokens/full");
- check_macro!("textDocument/semanticTokens/full/delta");
- check_macro!("textDocument/semanticTokens/range");
-
- check_macro!("workspace/applyEdit");
- check_macro!("workspace/symbol");
- check_macro!("workspace/executeCommand");
- check_macro!("workspace/configuration");
- check_macro!("workspace/willCreateFiles");
- check_macro!("workspace/willRenameFiles");
- check_macro!("workspace/willDeleteFiles");
- check_macro!("workspace/workspaceFolders");
- check_macro!("workspace/semanticTokens/refresh");
- check_macro!("workspace/codeLens/refresh");
-
- check_macro!("codeAction/resolve");
- check_macro!("codeLens/resolve");
- check_macro!("completionItem/resolve");
- check_macro!("documentLink/resolve");
- check_macro!("callHierarchy/incomingCalls");
- check_macro!("callHierarchy/outgoingCalls");
- }
-
- #[test]
- #[cfg(feature = "proposed")]
- fn check_proposed_macro_definitions() {}
-}
+use super::*;
+
+use serde::{de::DeserializeOwned, Serialize};
+
+pub trait Request {
+ type Params: DeserializeOwned + Serialize;
+ type Result: DeserializeOwned + Serialize;
+ const METHOD: &'static str;
+}
+
+#[macro_export]
+macro_rules! lsp_request {
+ ("initialize") => {
+ $crate::request::Initialize
+ };
+ ("shutdown") => {
+ $crate::request::Shutdown
+ };
+
+ ("window/showMessageRequest") => {
+ $crate::request::ShowMessageRequest
+ };
+
+ ("client/registerCapability") => {
+ $crate::request::RegisterCapability
+ };
+ ("client/unregisterCapability") => {
+ $crate::request::UnregisterCapability
+ };
+
+ ("workspace/symbol") => {
+ $crate::request::WorkspaceSymbolRequest
+ };
+ ("workspace/executeCommand") => {
+ $crate::request::ExecuteCommand
+ };
+
+ ("textDocument/willSaveWaitUntil") => {
+ $crate::request::WillSaveWaitUntil
+ };
+
+ ("textDocument/completion") => {
+ $crate::request::Completion
+ };
+ ("completionItem/resolve") => {
+ $crate::request::ResolveCompletionItem
+ };
+ ("textDocument/hover") => {
+ $crate::request::HoverRequest
+ };
+ ("textDocument/signatureHelp") => {
+ $crate::request::SignatureHelpRequest
+ };
+ ("textDocument/declaration") => {
+ $crate::request::GotoDeclaration
+ };
+ ("textDocument/definition") => {
+ $crate::request::GotoDefinition
+ };
+ ("textDocument/references") => {
+ $crate::request::References
+ };
+ ("textDocument/documentHighlight") => {
+ $crate::request::DocumentHighlightRequest
+ };
+ ("textDocument/documentSymbol") => {
+ $crate::request::DocumentSymbolRequest
+ };
+ ("textDocument/codeAction") => {
+ $crate::request::CodeActionRequest
+ };
+ ("textDocument/codeLens") => {
+ $crate::request::CodeLensRequest
+ };
+ ("codeLens/resolve") => {
+ $crate::request::CodeLensResolve
+ };
+ ("textDocument/documentLink") => {
+ $crate::request::DocumentLinkRequest
+ };
+ ("documentLink/resolve") => {
+ $crate::request::DocumentLinkResolve
+ };
+ ("workspace/applyEdit") => {
+ $crate::request::ApplyWorkspaceEdit
+ };
+ ("textDocument/rangeFormatting") => {
+ $crate::request::RangeFormatting
+ };
+ ("textDocument/onTypeFormatting") => {
+ $crate::request::OnTypeFormatting
+ };
+ ("textDocument/formatting") => {
+ $crate::request::Formatting
+ };
+ ("textDocument/rename") => {
+ $crate::request::Rename
+ };
+ ("textDocument/documentColor") => {
+ $crate::request::DocumentColor
+ };
+ ("textDocument/colorPresentation") => {
+ $crate::request::ColorPresentationRequest
+ };
+ ("textDocument/foldingRange") => {
+ $crate::request::FoldingRangeRequest
+ };
+ ("textDocument/prepareRename") => {
+ $crate::request::PrepareRenameRequest
+ };
+ ("textDocument/implementation") => {
+ $crate::request::GotoImplementation
+ };
+ ("textDocument/typeDefinition") => {
+ $crate::request::GotoTypeDefinition
+ };
+ ("textDocument/selectionRange") => {
+ $crate::request::SelectionRangeRequest
+ };
+ ("workspace/workspaceFolders") => {
+ $crate::request::WorkspaceFoldersRequest
+ };
+ ("workspace/configuration") => {
+ $crate::request::WorkspaceConfiguration
+ };
+ ("window/workDoneProgress/create") => {
+ $crate::request::WorkDoneProgressCreate
+ };
+ ("callHierarchy/incomingCalls") => {
+ $crate::request::CallHierarchyIncomingCalls
+ };
+ ("callHierarchy/outgoingCalls") => {
+ $crate::request::CallHierarchyOutgoingCalls
+ };
+ ("textDocument/moniker") => {
+ $crate::request::MonikerRequest
+ };
+ ("textDocument/linkedEditingRange") => {
+ $crate::request::LinkedEditingRange
+ };
+ ("textDocument/prepareCallHierarchy") => {
+ $crate::request::CallHierarchyPrepare
+ };
+ ("textDocument/prepareTypeHierarchy") => {
+ $crate::request::TypeHierarchyPrepare
+ };
+ ("textDocument/semanticTokens/full") => {
+ $crate::request::SemanticTokensFullRequest
+ };
+ ("textDocument/semanticTokens/full/delta") => {
+ $crate::request::SemanticTokensFullDeltaRequest
+ };
+ ("textDocument/semanticTokens/range") => {
+ $crate::request::SemanticTokensRangeRequest
+ };
+ ("textDocument/inlayHint") => {
+ $crate::request::InlayHintRequest
+ };
+ ("textDocument/inlineValue") => {
+ $crate::request::InlineValueRequest
+ };
+ ("typeHierarchy/supertypes") => {
+ $crate::request::TypeHierarchySupertypes
+ };
+ ("typeHierarchy/subtypes") => {
+ $crate::request::TypeHierarchySubtypes
+ };
+ ("workspace/willCreateFiles") => {
+ $crate::request::WillCreateFiles
+ };
+ ("workspace/willRenameFiles") => {
+ $crate::request::WillRenameFiles
+ };
+ ("workspace/willDeleteFiles") => {
+ $crate::request::WillDeleteFiles
+ };
+ ("workspace/semanticTokens/refresh") => {
+ $crate::request::SemanticTokensRefresh
+ };
+ ("workspace/codeLens/refresh") => {
+ $crate::request::CodeLensRefresh
+ };
+ ("workspace/inlayHint/refresh") => {
+ $crate::request::InlayHintRefreshRequest
+ };
+ ("workspace/inlineValue/refresh") => {
+ $crate::request::InlineValueRefreshRequest
+ };
+ ("codeAction/resolve") => {
+ $crate::request::CodeActionResolveRequest
+ };
+ ("inlayHint/resolve") => {
+ $crate::request::InlayHintResolveRequest
+ };
+ ("window/showDocument") => {
+ $crate::request::ShowDocument
+ };
+}
+
+/// The initialize request is sent as the first request from the client to the server.
+/// If the server receives request or notification before the `initialize` request it should act as follows:
+///
+/// * for a request the respond should be errored with `code: -32001`. The message can be picked by the server.
+/// * notifications should be dropped.
+#[derive(Debug)]
+pub enum Initialize {}
+
+impl Request for Initialize {
+ type Params = InitializeParams;
+ type Result = InitializeResult;
+ const METHOD: &'static str = "initialize";
+}
+
+/// The shutdown request is sent from the client to the server. It asks the server to shut down,
+/// but to not exit (otherwise the response might not be delivered correctly to the client).
+/// There is a separate exit notification that asks the server to exit.
+#[derive(Debug)]
+pub enum Shutdown {}
+
+impl Request for Shutdown {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "shutdown";
+}
+
+/// The show message request is sent from a server to a client to ask the client to display a particular message
+/// in the user interface. In addition to the show message notification the request allows to pass actions and to
+/// wait for an answer from the client.
+#[derive(Debug)]
+pub enum ShowMessageRequest {}
+
+impl Request for ShowMessageRequest {
+ type Params = ShowMessageRequestParams;
+ type Result = Option<MessageActionItem>;
+ const METHOD: &'static str = "window/showMessageRequest";
+}
+
+/// The client/registerCapability request is sent from the server to the client to register for a new capability
+/// on the client side. Not all clients need to support dynamic capability registration. A client opts in via the
+/// ClientCapabilities.GenericCapability property.
+#[derive(Debug)]
+pub enum RegisterCapability {}
+
+impl Request for RegisterCapability {
+ type Params = RegistrationParams;
+ type Result = ();
+ const METHOD: &'static str = "client/registerCapability";
+}
+
+/// The client/unregisterCapability request is sent from the server to the client to unregister a
+/// previously register capability.
+#[derive(Debug)]
+pub enum UnregisterCapability {}
+
+impl Request for UnregisterCapability {
+ type Params = UnregistrationParams;
+ type Result = ();
+ const METHOD: &'static str = "client/unregisterCapability";
+}
+
+/// The Completion request is sent from the client to the server to compute completion items at a given cursor position.
+/// Completion items are presented in the IntelliSense user interface. If computing full completion items is expensive,
+/// servers can additionally provide a handler for the completion item resolve request ('completionItem/resolve').
+/// This request is sent when a completion item is selected in the user interface. A typical use case is for example:
+/// the 'textDocument/completion' request doesn’t fill in the documentation property for returned completion items
+/// since it is expensive to compute. When the item is selected in the user interface then a ‘completionItem/resolve’
+/// request is sent with the selected completion item as a param. The returned completion item should have the
+/// documentation property filled in. The request can delay the computation of the detail and documentation properties.
+/// However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText,
+/// and textEdit must be provided in the textDocument/completion request and must not be changed during resolve.
+#[derive(Debug)]
+pub enum Completion {}
+
+impl Request for Completion {
+ type Params = CompletionParams;
+ type Result = Option<CompletionResponse>;
+ const METHOD: &'static str = "textDocument/completion";
+}
+
+/// The request is sent from the client to the server to resolve additional information for a given completion item.
+#[derive(Debug)]
+pub enum ResolveCompletionItem {}
+
+impl Request for ResolveCompletionItem {
+ type Params = CompletionItem;
+ type Result = CompletionItem;
+ const METHOD: &'static str = "completionItem/resolve";
+}
+
+/// The hover request is sent from the client to the server to request hover information at a given text
+/// document position.
+#[derive(Debug)]
+pub enum HoverRequest {}
+
+impl Request for HoverRequest {
+ type Params = HoverParams;
+ type Result = Option<Hover>;
+ const METHOD: &'static str = "textDocument/hover";
+}
+
+/// The signature help request is sent from the client to the server to request signature information at
+/// a given cursor position.
+#[derive(Debug)]
+pub enum SignatureHelpRequest {}
+
+impl Request for SignatureHelpRequest {
+ type Params = SignatureHelpParams;
+ type Result = Option<SignatureHelp>;
+ const METHOD: &'static str = "textDocument/signatureHelp";
+}
+
+#[derive(Debug)]
+pub enum GotoDeclaration {}
+pub type GotoDeclarationParams = GotoDefinitionParams;
+pub type GotoDeclarationResponse = GotoDefinitionResponse;
+
+/// The goto declaration request is sent from the client to the server to resolve the declaration location of
+/// a symbol at a given text document position.
+impl Request for GotoDeclaration {
+ type Params = GotoDeclarationParams;
+ type Result = Option<GotoDeclarationResponse>;
+ const METHOD: &'static str = "textDocument/declaration";
+}
+
+/// The goto definition request is sent from the client to the server to resolve the definition location of
+/// a symbol at a given text document position.
+#[derive(Debug)]
+pub enum GotoDefinition {}
+
+impl Request for GotoDefinition {
+ type Params = GotoDefinitionParams;
+ type Result = Option<GotoDefinitionResponse>;
+ const METHOD: &'static str = "textDocument/definition";
+}
+
+/// The references request is sent from the client to the server to resolve project-wide references for the
+/// symbol denoted by the given text document position.
+#[derive(Debug)]
+pub enum References {}
+
+impl Request for References {
+ type Params = ReferenceParams;
+ type Result = Option<Vec<Location>>;
+ const METHOD: &'static str = "textDocument/references";
+}
+
+/// The goto type definition request is sent from the client to the
+/// server to resolve the type definition location of a symbol at a
+/// given text document position.
+#[derive(Debug)]
+pub enum GotoTypeDefinition {}
+
+pub type GotoTypeDefinitionParams = GotoDefinitionParams;
+pub type GotoTypeDefinitionResponse = GotoDefinitionResponse;
+
+impl Request for GotoTypeDefinition {
+ type Params = GotoTypeDefinitionParams;
+ type Result = Option<GotoTypeDefinitionResponse>;
+ const METHOD: &'static str = "textDocument/typeDefinition";
+}
+
+/// The goto implementation request is sent from the client to the
+/// server to resolve the implementation location of a symbol at a
+/// given text document position.
+#[derive(Debug)]
+pub enum GotoImplementation {}
+
+pub type GotoImplementationParams = GotoTypeDefinitionParams;
+pub type GotoImplementationResponse = GotoDefinitionResponse;
+
+impl Request for GotoImplementation {
+ type Params = GotoImplementationParams;
+ type Result = Option<GotoImplementationResponse>;
+ const METHOD: &'static str = "textDocument/implementation";
+}
+
+/// The document highlight request is sent from the client to the server to resolve a document highlights
+/// for a given text document position.
+/// For programming languages this usually highlights all references to the symbol scoped to this file.
+/// However we kept 'textDocument/documentHighlight' and 'textDocument/references' separate requests since
+/// the first one is allowed to be more fuzzy.
+/// Symbol matches usually have a DocumentHighlightKind of Read or Write whereas fuzzy or textual matches
+/// use Text as the kind.
+#[derive(Debug)]
+pub enum DocumentHighlightRequest {}
+
+impl Request for DocumentHighlightRequest {
+ type Params = DocumentHighlightParams;
+ type Result = Option<Vec<DocumentHighlight>>;
+ const METHOD: &'static str = "textDocument/documentHighlight";
+}
+
+/// The document symbol request is sent from the client to the server to list all symbols found in a given
+/// text document.
+#[derive(Debug)]
+pub enum DocumentSymbolRequest {}
+
+impl Request for DocumentSymbolRequest {
+ type Params = DocumentSymbolParams;
+ type Result = Option<DocumentSymbolResponse>;
+ const METHOD: &'static str = "textDocument/documentSymbol";
+}
+
+/// The workspace symbol request is sent from the client to the server to list project-wide symbols
+/// matching the query string.
+#[derive(Debug)]
+pub enum WorkspaceSymbolRequest {}
+
+impl Request for WorkspaceSymbolRequest {
+ type Params = WorkspaceSymbolParams;
+ type Result = Option<WorkspaceSymbolResponse>;
+ const METHOD: &'static str = "workspace/symbol";
+}
+
+/// The `workspaceSymbol/resolve` request is sent from the client to the server to resolve
+/// additional information for a given workspace symbol.
+#[derive(Debug)]
+pub enum WorkspaceSymbolResolve {}
+
+impl Request for WorkspaceSymbolResolve {
+ type Params = WorkspaceSymbol;
+ type Result = WorkspaceSymbol;
+ const METHOD: &'static str = "workspaceSymbol/resolve";
+}
+
+/// The workspace/executeCommand request is sent from the client to the server to trigger command execution on the server.
+/// In most cases the server creates a WorkspaceEdit structure and applies the changes to the workspace using the request
+/// workspace/applyEdit which is sent from the server to the client.
+#[derive(Debug)]
+pub enum ExecuteCommand {}
+
+impl Request for ExecuteCommand {
+ type Params = ExecuteCommandParams;
+ type Result = Option<Value>;
+ const METHOD: &'static str = "workspace/executeCommand";
+}
+
+/// The document will save request is sent from the client to the server before the document is
+/// actually saved. The request can return an array of TextEdits which will be applied to the text
+/// document before it is saved. Please note that clients might drop results if computing the text
+/// edits took too long or if a server constantly fails on this request. This is done to keep the
+/// save fast and reliable.
+#[derive(Debug)]
+pub enum WillSaveWaitUntil {}
+
+impl Request for WillSaveWaitUntil {
+ type Params = WillSaveTextDocumentParams;
+ type Result = Option<Vec<TextEdit>>;
+ const METHOD: &'static str = "textDocument/willSaveWaitUntil";
+}
+
+/// The workspace/applyEdit request is sent from the server to the client to modify resource on the
+/// client side.
+#[derive(Debug)]
+pub enum ApplyWorkspaceEdit {}
+
+impl Request for ApplyWorkspaceEdit {
+ type Params = ApplyWorkspaceEditParams;
+ type Result = ApplyWorkspaceEditResponse;
+ const METHOD: &'static str = "workspace/applyEdit";
+}
+
+/// The workspace/configuration request is sent from the server to the client to fetch configuration settings
+/// from the client. The request can fetch several configuration settings in one roundtrip.
+/// The order of the returned configuration settings correspond to the order of the passed ConfigurationItems
+/// (e.g. the first item in the response is the result for the first configuration item in the params).
+///
+/// A ConfigurationItem consists of the configuration section to ask for and an additional scope URI.
+/// The configuration section ask for is defined by the server and doesn’t necessarily need to correspond to
+/// the configuration store used be the client. So a server might ask for a configuration cpp.formatterOptions
+/// but the client stores the configuration in a XML store layout differently.
+/// It is up to the client to do the necessary conversion. If a scope URI is provided the client should return
+/// the setting scoped to the provided resource. If the client for example uses EditorConfig to manage its
+/// settings the configuration should be returned for the passed resource URI. If the client can’t provide a
+/// configuration setting for a given scope then null need to be present in the returned array.
+#[derive(Debug)]
+pub enum WorkspaceConfiguration {}
+
+impl Request for WorkspaceConfiguration {
+ type Params = ConfigurationParams;
+ type Result = Vec<Value>;
+ const METHOD: &'static str = "workspace/configuration";
+}
+
+/// The code action request is sent from the client to the server to compute commands for a given text document
+/// and range. The request is triggered when the user moves the cursor into a problem marker in the editor or
+/// presses the lightbulb associated with a marker.
+#[derive(Debug)]
+pub enum CodeActionRequest {}
+
+impl Request for CodeActionRequest {
+ type Params = CodeActionParams;
+ type Result = Option<CodeActionResponse>;
+ const METHOD: &'static str = "textDocument/codeAction";
+}
+
+/// The request is sent from the client to the server to resolve additional information for a given code action.
+/// This is usually used to compute the `edit` property of a code action to avoid its unnecessary computation
+/// during the `textDocument/codeAction` request.
+///
+/// since 3.16.0
+#[derive(Debug)]
+pub enum CodeActionResolveRequest {}
+
+impl Request for CodeActionResolveRequest {
+ type Params = CodeAction;
+ type Result = CodeAction;
+ const METHOD: &'static str = "codeAction/resolve";
+}
+
+/// The code lens request is sent from the client to the server to compute code lenses for a given text document.
+#[derive(Debug)]
+pub enum CodeLensRequest {}
+
+impl Request for CodeLensRequest {
+ type Params = CodeLensParams;
+ type Result = Option<Vec<CodeLens>>;
+ const METHOD: &'static str = "textDocument/codeLens";
+}
+
+/// The code lens resolve request is sent from the client to the server to resolve the command for a
+/// given code lens item.
+#[derive(Debug)]
+pub enum CodeLensResolve {}
+
+impl Request for CodeLensResolve {
+ type Params = CodeLens;
+ type Result = CodeLens;
+ const METHOD: &'static str = "codeLens/resolve";
+}
+
+/// The document links request is sent from the client to the server to request the location of links in a document.
+#[derive(Debug)]
+pub enum DocumentLinkRequest {}
+
+impl Request for DocumentLinkRequest {
+ type Params = DocumentLinkParams;
+ type Result = Option<Vec<DocumentLink>>;
+ const METHOD: &'static str = "textDocument/documentLink";
+}
+
+/// The document link resolve request is sent from the client to the server to resolve the target of
+/// a given document link.
+#[derive(Debug)]
+pub enum DocumentLinkResolve {}
+
+impl Request for DocumentLinkResolve {
+ type Params = DocumentLink;
+ type Result = DocumentLink;
+ const METHOD: &'static str = "documentLink/resolve";
+}
+
+/// The document formatting request is sent from the server to the client to format a whole document.
+#[derive(Debug)]
+pub enum Formatting {}
+
+impl Request for Formatting {
+ type Params = DocumentFormattingParams;
+ type Result = Option<Vec<TextEdit>>;
+ const METHOD: &'static str = "textDocument/formatting";
+}
+
+/// The document range formatting request is sent from the client to the server to format a given range in a document.
+#[derive(Debug)]
+pub enum RangeFormatting {}
+
+impl Request for RangeFormatting {
+ type Params = DocumentRangeFormattingParams;
+ type Result = Option<Vec<TextEdit>>;
+ const METHOD: &'static str = "textDocument/rangeFormatting";
+}
+
+/// The document on type formatting request is sent from the client to the server to format parts of
+/// the document during typing.
+#[derive(Debug)]
+pub enum OnTypeFormatting {}
+
+impl Request for OnTypeFormatting {
+ type Params = DocumentOnTypeFormattingParams;
+ type Result = Option<Vec<TextEdit>>;
+ const METHOD: &'static str = "textDocument/onTypeFormatting";
+}
+
+/// The linked editing request is sent from the client to the server to return for a given position in a document
+/// the range of the symbol at the position and all ranges that have the same content.
+/// Optionally a word pattern can be returned to describe valid contents. A rename to one of the ranges can be applied
+/// to all other ranges if the new content is valid. If no result-specific word pattern is provided, the word pattern from
+/// the client’s language configuration is used.
+#[derive(Debug)]
+pub enum LinkedEditingRange {}
+
+impl Request for LinkedEditingRange {
+ type Params = LinkedEditingRangeParams;
+ type Result = Option<LinkedEditingRanges>;
+ const METHOD: &'static str = "textDocument/linkedEditingRange";
+}
+
+/// The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol.
+#[derive(Debug)]
+pub enum Rename {}
+
+impl Request for Rename {
+ type Params = RenameParams;
+ type Result = Option<WorkspaceEdit>;
+ const METHOD: &'static str = "textDocument/rename";
+}
+
+/// The document color request is sent from the client to the server to list all color references found in a given text document.
+/// Along with the range, a color value in RGB is returned.
+#[derive(Debug)]
+pub enum DocumentColor {}
+
+impl Request for DocumentColor {
+ type Params = DocumentColorParams;
+ type Result = Vec<ColorInformation>;
+ const METHOD: &'static str = "textDocument/documentColor";
+}
+
+/// The color presentation request is sent from the client to the server to obtain a list of presentations for a color value
+/// at a given location.
+#[derive(Debug)]
+pub enum ColorPresentationRequest {}
+
+impl Request for ColorPresentationRequest {
+ type Params = ColorPresentationParams;
+ type Result = Vec<ColorPresentation>;
+ const METHOD: &'static str = "textDocument/colorPresentation";
+}
+
+/// The folding range request is sent from the client to the server to return all folding ranges found in a given text document.
+#[derive(Debug)]
+pub enum FoldingRangeRequest {}
+
+impl Request for FoldingRangeRequest {
+ type Params = FoldingRangeParams;
+ type Result = Option<Vec<FoldingRange>>;
+ const METHOD: &'static str = "textDocument/foldingRange";
+}
+
+/// The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation
+/// at a given location.
+#[derive(Debug)]
+pub enum PrepareRenameRequest {}
+
+impl Request for PrepareRenameRequest {
+ type Params = TextDocumentPositionParams;
+ type Result = Option<PrepareRenameResponse>;
+ const METHOD: &'static str = "textDocument/prepareRename";
+}
+
+/// The workspace/workspaceFolders request is sent from the server to the client to fetch the current open list of
+/// workspace folders. Returns null in the response if only a single file is open in the tool.
+/// Returns an empty array if a workspace is open but no folders are configured.
+#[derive(Debug)]
+pub enum WorkspaceFoldersRequest {}
+
+impl Request for WorkspaceFoldersRequest {
+ type Params = ();
+ type Result = Option<Vec<WorkspaceFolder>>;
+ const METHOD: &'static str = "workspace/workspaceFolders";
+}
+
+/// The `window/workDoneProgress/create` request is sent from the server
+/// to the clientto ask the client to create a work done progress.
+#[derive(Debug)]
+pub enum WorkDoneProgressCreate {}
+
+impl Request for WorkDoneProgressCreate {
+ type Params = WorkDoneProgressCreateParams;
+ type Result = ();
+ const METHOD: &'static str = "window/workDoneProgress/create";
+}
+
+/// The selection range request is sent from the client to the server to return
+/// suggested selection ranges at given positions. A selection range is a range
+/// around the cursor position which the user might be interested in selecting.
+///
+/// A selection range in the return array is for the position in the provided parameters at the same index.
+/// Therefore `positions[i]` must be contained in `result[i].range`.
+///
+/// Typically, but not necessary, selection ranges correspond to the nodes of the
+/// syntax tree.
+pub enum SelectionRangeRequest {}
+
+impl Request for SelectionRangeRequest {
+ type Params = SelectionRangeParams;
+ type Result = Option<Vec<SelectionRange>>;
+ const METHOD: &'static str = "textDocument/selectionRange";
+}
+
+pub enum CallHierarchyPrepare {}
+
+impl Request for CallHierarchyPrepare {
+ type Params = CallHierarchyPrepareParams;
+ type Result = Option<Vec<CallHierarchyItem>>;
+ const METHOD: &'static str = "textDocument/prepareCallHierarchy";
+}
+
+pub enum CallHierarchyIncomingCalls {}
+
+impl Request for CallHierarchyIncomingCalls {
+ type Params = CallHierarchyIncomingCallsParams;
+ type Result = Option<Vec<CallHierarchyIncomingCall>>;
+ const METHOD: &'static str = "callHierarchy/incomingCalls";
+}
+
+pub enum CallHierarchyOutgoingCalls {}
+
+impl Request for CallHierarchyOutgoingCalls {
+ type Params = CallHierarchyOutgoingCallsParams;
+ type Result = Option<Vec<CallHierarchyOutgoingCall>>;
+ const METHOD: &'static str = "callHierarchy/outgoingCalls";
+}
+
+pub enum SemanticTokensFullRequest {}
+
+impl Request for SemanticTokensFullRequest {
+ type Params = SemanticTokensParams;
+ type Result = Option<SemanticTokensResult>;
+ const METHOD: &'static str = "textDocument/semanticTokens/full";
+}
+
+pub enum SemanticTokensFullDeltaRequest {}
+
+impl Request for SemanticTokensFullDeltaRequest {
+ type Params = SemanticTokensDeltaParams;
+ type Result = Option<SemanticTokensFullDeltaResult>;
+ const METHOD: &'static str = "textDocument/semanticTokens/full/delta";
+}
+
+pub enum SemanticTokensRangeRequest {}
+
+impl Request for SemanticTokensRangeRequest {
+ type Params = SemanticTokensRangeParams;
+ type Result = Option<SemanticTokensRangeResult>;
+ const METHOD: &'static str = "textDocument/semanticTokens/range";
+}
+
+/// The `workspace/semanticTokens/refresh` request is sent from the server to the client.
+/// Servers can use it to ask clients to refresh the editors for which this server provides semantic tokens.
+/// As a result the client should ask the server to recompute the semantic tokens for these editors.
+/// This is useful if a server detects a project wide configuration change which requires a re-calculation of all semantic tokens.
+/// Note that the client still has the freedom to delay the re-calculation of the semantic tokens if for example an editor is currently not visible.
+pub enum SemanticTokensRefresh {}
+
+impl Request for SemanticTokensRefresh {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "workspace/semanticTokens/refresh";
+}
+
+/// The workspace/codeLens/refresh request is sent from the server to the client.
+/// Servers can use it to ask clients to refresh the code lenses currently shown in editors.
+/// As a result the client should ask the server to recompute the code lenses for these editors.
+/// This is useful if a server detects a configuration change which requires a re-calculation of all code lenses.
+/// Note that the client still has the freedom to delay the re-calculation of the code lenses if for example an editor is currently not visible.
+pub enum CodeLensRefresh {}
+
+impl Request for CodeLensRefresh {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "workspace/codeLens/refresh";
+}
+
+/// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep creates fast and reliable.
+pub enum WillCreateFiles {}
+
+impl Request for WillCreateFiles {
+ type Params = CreateFilesParams;
+ type Result = Option<WorkspaceEdit>;
+ const METHOD: &'static str = "workspace/willCreateFiles";
+}
+
+/// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are renamed. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep renames fast and reliable.
+pub enum WillRenameFiles {}
+
+impl Request for WillRenameFiles {
+ type Params = RenameFilesParams;
+ type Result = Option<WorkspaceEdit>;
+ const METHOD: &'static str = "workspace/willRenameFiles";
+}
+
+/// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are deleted. Please note that clients might drop results if computing the edit took too long or if a server constantly fails on this request. This is done to keep deletes fast and reliable.
+pub enum WillDeleteFiles {}
+
+impl Request for WillDeleteFiles {
+ type Params = DeleteFilesParams;
+ type Result = Option<WorkspaceEdit>;
+ const METHOD: &'static str = "workspace/willDeleteFiles";
+}
+
+/// The show document request is sent from a server to a client to ask the client to display a particular document in the user interface.
+pub enum ShowDocument {}
+
+impl Request for ShowDocument {
+ type Params = ShowDocumentParams;
+ type Result = ShowDocumentResult;
+ const METHOD: &'static str = "window/showDocument";
+}
+
+pub enum MonikerRequest {}
+
+impl Request for MonikerRequest {
+ type Params = MonikerParams;
+ type Result = Option<Vec<Moniker>>;
+ const METHOD: &'static str = "textDocument/moniker";
+}
+
+/// The inlay hints request is sent from the client to the server to compute inlay hints for a given
+/// [text document, range] tuple that may be rendered in the editor in place with other text.
+pub enum InlayHintRequest {}
+
+impl Request for InlayHintRequest {
+ type Params = InlayHintParams;
+ type Result = Option<Vec<InlayHint>>;
+ const METHOD: &'static str = "textDocument/inlayHint";
+}
+
+/// The `inlayHint/resolve` request is sent from the client to the server to resolve additional
+/// information for a given inlay hint. This is usually used to compute the tooltip, location or
+/// command properties of a inlay hint’s label part to avoid its unnecessary computation during the
+/// `textDocument/inlayHint` request.
+pub enum InlayHintResolveRequest {}
+
+impl Request for InlayHintResolveRequest {
+ type Params = InlayHint;
+ type Result = InlayHint;
+ const METHOD: &'static str = "inlayHint/resolve";
+}
+
+/// The `workspace/inlayHint/refresh` request is sent from the server to the client. Servers can use
+/// it to ask clients to refresh the inlay hints currently shown in editors. As a result the client
+/// should ask the server to recompute the inlay hints for these editors. This is useful if a server
+/// detects a configuration change which requires a re-calculation of all inlay hints. Note that the
+/// client still has the freedom to delay the re-calculation of the inlay hints if for example an
+/// editor is currently not visible.
+pub enum InlayHintRefreshRequest {}
+
+impl Request for InlayHintRefreshRequest {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "workspace/inlayHint/refresh";
+}
+
+/// The inline value request is sent from the client to the server to compute inline values for a
+/// given text document that may be rendered in the editor at the end of lines.
+pub enum InlineValueRequest {}
+
+impl Request for InlineValueRequest {
+ type Params = InlineValueParams;
+ type Result = Option<InlineValue>;
+ const METHOD: &'static str = "textDocument/inlineValue";
+}
+
+/// The `workspace/inlineValue/refresh` request is sent from the server to the client. Servers can
+/// use it to ask clients to refresh the inline values currently shown in editors. As a result the
+/// client should ask the server to recompute the inline values for these editors. This is useful if
+/// a server detects a configuration change which requires a re-calculation of all inline values.
+/// Note that the client still has the freedom to delay the re-calculation of the inline values if
+/// for example an editor is currently not visible.
+pub enum InlineValueRefreshRequest {}
+
+impl Request for InlineValueRefreshRequest {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "workspace/inlineValue/refresh";
+}
+
+/// The type hierarchy request is sent from the client to the server to return a type hierarchy for
+/// the language element of given text document positions. Will return null if the server couldn’t
+/// infer a valid type from the position. The type hierarchy requests are executed in two steps:
+///
+/// 1. first a type hierarchy item is prepared for the given text document position.
+/// 2. for a type hierarchy item the supertype or subtype type hierarchy items are resolved.
+pub enum TypeHierarchyPrepare {}
+
+impl Request for TypeHierarchyPrepare {
+ type Params = TypeHierarchyPrepareParams;
+ type Result = Option<Vec<TypeHierarchyItem>>;
+ const METHOD: &'static str = "textDocument/prepareTypeHierarchy";
+}
+
+/// The `typeHierarchy/supertypes` request is sent from the client to the server to resolve the
+/// supertypes for a given type hierarchy item. Will return null if the server couldn’t infer a
+/// valid type from item in the params. The request doesn’t define its own client and server
+/// capabilities. It is only issued if a server registers for the
+/// `textDocument/prepareTypeHierarchy` request.
+pub enum TypeHierarchySupertypes {}
+
+impl Request for TypeHierarchySupertypes {
+ type Params = TypeHierarchySupertypesParams;
+ type Result = Option<Vec<TypeHierarchyItem>>;
+ const METHOD: &'static str = "typeHierarchy/supertypes";
+}
+
+/// The `typeHierarchy/subtypes` request is sent from the client to the server to resolve the
+/// subtypes for a given type hierarchy item. Will return null if the server couldn’t infer a valid
+/// type from item in the params. The request doesn’t define its own client and server capabilities.
+/// It is only issued if a server registers for the textDocument/prepareTypeHierarchy request.
+pub enum TypeHierarchySubtypes {}
+
+impl Request for TypeHierarchySubtypes {
+ type Params = TypeHierarchySubtypesParams;
+ type Result = Option<Vec<TypeHierarchyItem>>;
+ const METHOD: &'static str = "typeHierarchy/subtypes";
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ fn fake_call<R>()
+ where
+ R: Request,
+ R::Params: serde::Serialize,
+ R::Result: serde::de::DeserializeOwned,
+ {
+ }
+
+ macro_rules! check_macro {
+ ($name:tt) => {
+ // check whethe the macro name matches the method
+ assert_eq!(<lsp_request!($name) as Request>::METHOD, $name);
+ // test whether type checking passes for each component
+ fake_call::<lsp_request!($name)>();
+ };
+ }
+
+ #[test]
+ fn check_macro_definitions() {
+ check_macro!("initialize");
+ check_macro!("shutdown");
+
+ check_macro!("window/showDocument");
+ check_macro!("window/showMessageRequest");
+ check_macro!("window/workDoneProgress/create");
+
+ check_macro!("client/registerCapability");
+ check_macro!("client/unregisterCapability");
+
+ check_macro!("textDocument/willSaveWaitUntil");
+ check_macro!("textDocument/completion");
+ check_macro!("textDocument/hover");
+ check_macro!("textDocument/signatureHelp");
+ check_macro!("textDocument/declaration");
+ check_macro!("textDocument/definition");
+ check_macro!("textDocument/references");
+ check_macro!("textDocument/documentHighlight");
+ check_macro!("textDocument/documentSymbol");
+ check_macro!("textDocument/codeAction");
+ check_macro!("textDocument/codeLens");
+ check_macro!("textDocument/documentLink");
+ check_macro!("textDocument/rangeFormatting");
+ check_macro!("textDocument/onTypeFormatting");
+ check_macro!("textDocument/formatting");
+ check_macro!("textDocument/rename");
+ check_macro!("textDocument/documentColor");
+ check_macro!("textDocument/colorPresentation");
+ check_macro!("textDocument/foldingRange");
+ check_macro!("textDocument/prepareRename");
+ check_macro!("textDocument/implementation");
+ check_macro!("textDocument/selectionRange");
+ check_macro!("textDocument/typeDefinition");
+ check_macro!("textDocument/moniker");
+ check_macro!("textDocument/linkedEditingRange");
+ check_macro!("textDocument/prepareCallHierarchy");
+ check_macro!("textDocument/prepareTypeHierarchy");
+ check_macro!("textDocument/semanticTokens/full");
+ check_macro!("textDocument/semanticTokens/full/delta");
+ check_macro!("textDocument/semanticTokens/range");
+ check_macro!("textDocument/inlayHint");
+ check_macro!("textDocument/inlineValue");
+
+ check_macro!("workspace/applyEdit");
+ check_macro!("workspace/symbol");
+ check_macro!("workspace/executeCommand");
+ check_macro!("workspace/configuration");
+ check_macro!("workspace/willCreateFiles");
+ check_macro!("workspace/willRenameFiles");
+ check_macro!("workspace/willDeleteFiles");
+ check_macro!("workspace/workspaceFolders");
+ check_macro!("workspace/semanticTokens/refresh");
+ check_macro!("workspace/codeLens/refresh");
+ check_macro!("workspace/inlayHint/refresh");
+ check_macro!("workspace/inlineValue/refresh");
+
+ check_macro!("callHierarchy/incomingCalls");
+ check_macro!("callHierarchy/outgoingCalls");
+ check_macro!("codeAction/resolve");
+ check_macro!("codeLens/resolve");
+ check_macro!("completionItem/resolve");
+ check_macro!("documentLink/resolve");
+ check_macro!("inlayHint/resolve");
+ check_macro!("typeHierarchy/subtypes");
+ check_macro!("typeHierarchy/supertypes");
+ }
+
+ #[test]
+ #[cfg(feature = "proposed")]
+ fn check_proposed_macro_definitions() {}
+}
diff --git a/vendor/lsp-types/src/selection_range.rs b/vendor/lsp-types/src/selection_range.rs
index 048df6f99..9ad110678 100644
--- a/vendor/lsp-types/src/selection_range.rs
+++ b/vendor/lsp-types/src/selection_range.rs
@@ -1,86 +1,86 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- PartialResultParams, Position, Range, StaticTextDocumentRegistrationOptions,
- TextDocumentIdentifier, WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SelectionRangeClientCapabilities {
- /// Whether implementation supports dynamic registration for selection range
- /// providers. If this is set to `true` the client supports the new
- /// `SelectionRangeRegistrationOptions` return value for the corresponding
- /// server capability as well.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct SelectionRangeOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct SelectionRangeRegistrationOptions {
- #[serde(flatten)]
- pub selection_range_options: SelectionRangeOptions,
-
- #[serde(flatten)]
- pub registration_options: StaticTextDocumentRegistrationOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum SelectionRangeProviderCapability {
- Simple(bool),
- Options(SelectionRangeOptions),
- RegistrationOptions(SelectionRangeRegistrationOptions),
-}
-
-impl From<SelectionRangeRegistrationOptions> for SelectionRangeProviderCapability {
- fn from(from: SelectionRangeRegistrationOptions) -> Self {
- Self::RegistrationOptions(from)
- }
-}
-
-impl From<SelectionRangeOptions> for SelectionRangeProviderCapability {
- fn from(from: SelectionRangeOptions) -> Self {
- Self::Options(from)
- }
-}
-
-impl From<bool> for SelectionRangeProviderCapability {
- fn from(from: bool) -> Self {
- Self::Simple(from)
- }
-}
-
-/// A parameter literal used in selection range requests.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SelectionRangeParams {
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The positions inside the text document.
- pub positions: Vec<Position>,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-}
-
-/// Represents a selection range.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SelectionRange {
- /// Range of the selection.
- pub range: Range,
-
- /// The parent selection range containing this range.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub parent: Option<Box<SelectionRange>>,
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ PartialResultParams, Position, Range, StaticTextDocumentRegistrationOptions,
+ TextDocumentIdentifier, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SelectionRangeClientCapabilities {
+ /// Whether implementation supports dynamic registration for selection range
+ /// providers. If this is set to `true` the client supports the new
+ /// `SelectionRangeRegistrationOptions` return value for the corresponding
+ /// server capability as well.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct SelectionRangeOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct SelectionRangeRegistrationOptions {
+ #[serde(flatten)]
+ pub selection_range_options: SelectionRangeOptions,
+
+ #[serde(flatten)]
+ pub registration_options: StaticTextDocumentRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum SelectionRangeProviderCapability {
+ Simple(bool),
+ Options(SelectionRangeOptions),
+ RegistrationOptions(SelectionRangeRegistrationOptions),
+}
+
+impl From<SelectionRangeRegistrationOptions> for SelectionRangeProviderCapability {
+ fn from(from: SelectionRangeRegistrationOptions) -> Self {
+ Self::RegistrationOptions(from)
+ }
+}
+
+impl From<SelectionRangeOptions> for SelectionRangeProviderCapability {
+ fn from(from: SelectionRangeOptions) -> Self {
+ Self::Options(from)
+ }
+}
+
+impl From<bool> for SelectionRangeProviderCapability {
+ fn from(from: bool) -> Self {
+ Self::Simple(from)
+ }
+}
+
+/// A parameter literal used in selection range requests.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SelectionRangeParams {
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The positions inside the text document.
+ pub positions: Vec<Position>,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+/// Represents a selection range.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SelectionRange {
+ /// Range of the selection.
+ pub range: Range,
+
+ /// The parent selection range containing this range.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parent: Option<Box<SelectionRange>>,
+}
diff --git a/vendor/lsp-types/src/semantic_tokens.rs b/vendor/lsp-types/src/semantic_tokens.rs
index f1b6d53d2..0b881850c 100644
--- a/vendor/lsp-types/src/semantic_tokens.rs
+++ b/vendor/lsp-types/src/semantic_tokens.rs
@@ -1,739 +1,733 @@
-use std::borrow::Cow;
-
-use serde::ser::SerializeSeq;
-use serde::{Deserialize, Serialize};
-
-use crate::{
- PartialResultParams, Range, StaticRegistrationOptions, TextDocumentIdentifier,
- TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-/// A set of predefined token types. This set is not fixed
-/// and clients can specify additional token types via the
-/// corresponding client capabilities.
-/// since @3.16.0
-#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
-pub struct SemanticTokenType(Cow<'static, str>);
-
-impl SemanticTokenType {
- pub const NAMESPACE: SemanticTokenType = SemanticTokenType::new("namespace");
- pub const TYPE: SemanticTokenType = SemanticTokenType::new("type");
- pub const CLASS: SemanticTokenType = SemanticTokenType::new("class");
- pub const ENUM: SemanticTokenType = SemanticTokenType::new("enum");
- pub const INTERFACE: SemanticTokenType = SemanticTokenType::new("interface");
- pub const STRUCT: SemanticTokenType = SemanticTokenType::new("struct");
- pub const TYPE_PARAMETER: SemanticTokenType = SemanticTokenType::new("typeParameter");
- pub const PARAMETER: SemanticTokenType = SemanticTokenType::new("parameter");
- pub const VARIABLE: SemanticTokenType = SemanticTokenType::new("variable");
- pub const PROPERTY: SemanticTokenType = SemanticTokenType::new("property");
- pub const ENUM_MEMBER: SemanticTokenType = SemanticTokenType::new("enumMember");
- pub const EVENT: SemanticTokenType = SemanticTokenType::new("event");
- pub const FUNCTION: SemanticTokenType = SemanticTokenType::new("function");
- pub const METHOD: SemanticTokenType = SemanticTokenType::new("method");
- pub const MACRO: SemanticTokenType = SemanticTokenType::new("macro");
- pub const KEYWORD: SemanticTokenType = SemanticTokenType::new("keyword");
- pub const MODIFIER: SemanticTokenType = SemanticTokenType::new("modifier");
- pub const COMMENT: SemanticTokenType = SemanticTokenType::new("comment");
- pub const STRING: SemanticTokenType = SemanticTokenType::new("string");
- pub const NUMBER: SemanticTokenType = SemanticTokenType::new("number");
- pub const REGEXP: SemanticTokenType = SemanticTokenType::new("regexp");
- pub const OPERATOR: SemanticTokenType = SemanticTokenType::new("operator");
-
- /// since @3.17.0
- #[cfg(feature = "proposed")]
- pub const DECORATOR: SemanticTokenType = SemanticTokenType::new("decorator");
-
- pub const fn new(tag: &'static str) -> Self {
- SemanticTokenType(Cow::Borrowed(tag))
- }
-
- pub fn as_str(&self) -> &str {
- &self.0
- }
-}
-
-impl From<String> for SemanticTokenType {
- fn from(from: String) -> Self {
- SemanticTokenType(Cow::from(from))
- }
-}
-
-impl From<&'static str> for SemanticTokenType {
- fn from(from: &'static str) -> Self {
- SemanticTokenType::new(from)
- }
-}
-
-/// A set of predefined token modifiers. This set is not fixed
-/// and clients can specify additional token types via the
-/// corresponding client capabilities.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
-pub struct SemanticTokenModifier(Cow<'static, str>);
-
-impl SemanticTokenModifier {
- pub const DECLARATION: SemanticTokenModifier = SemanticTokenModifier::new("declaration");
- pub const DEFINITION: SemanticTokenModifier = SemanticTokenModifier::new("definition");
- pub const READONLY: SemanticTokenModifier = SemanticTokenModifier::new("readonly");
- pub const STATIC: SemanticTokenModifier = SemanticTokenModifier::new("static");
- pub const DEPRECATED: SemanticTokenModifier = SemanticTokenModifier::new("deprecated");
- pub const ABSTRACT: SemanticTokenModifier = SemanticTokenModifier::new("abstract");
- pub const ASYNC: SemanticTokenModifier = SemanticTokenModifier::new("async");
- pub const MODIFICATION: SemanticTokenModifier = SemanticTokenModifier::new("modification");
- pub const DOCUMENTATION: SemanticTokenModifier = SemanticTokenModifier::new("documentation");
- pub const DEFAULT_LIBRARY: SemanticTokenModifier = SemanticTokenModifier::new("defaultLibrary");
-
- pub const fn new(tag: &'static str) -> Self {
- SemanticTokenModifier(Cow::Borrowed(tag))
- }
-
- pub fn as_str(&self) -> &str {
- &self.0
- }
-}
-
-impl From<String> for SemanticTokenModifier {
- fn from(from: String) -> Self {
- SemanticTokenModifier(Cow::from(from))
- }
-}
-
-impl From<&'static str> for SemanticTokenModifier {
- fn from(from: &'static str) -> Self {
- SemanticTokenModifier::new(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
-pub struct TokenFormat(Cow<'static, str>);
-
-impl TokenFormat {
- pub const RELATIVE: TokenFormat = TokenFormat::new("relative");
-
- pub const fn new(tag: &'static str) -> Self {
- TokenFormat(Cow::Borrowed(tag))
- }
-
- pub fn as_str(&self) -> &str {
- &self.0
- }
-}
-
-impl From<String> for TokenFormat {
- fn from(from: String) -> Self {
- TokenFormat(Cow::from(from))
- }
-}
-
-impl From<&'static str> for TokenFormat {
- fn from(from: &'static str) -> Self {
- TokenFormat::new(from)
- }
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensLegend {
- /// The token types a server uses.
- pub token_types: Vec<SemanticTokenType>,
-
- /// The token modifiers a server uses.
- pub token_modifiers: Vec<SemanticTokenModifier>,
-}
-
-/// The actual tokens. For a detailed description about how the data is
-/// structured please see
-/// <https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71>
-#[derive(Debug, Eq, PartialEq, Copy, Clone, Default)]
-pub struct SemanticToken {
- pub delta_line: u32,
- pub delta_start: u32,
- pub length: u32,
- pub token_type: u32,
- pub token_modifiers_bitset: u32,
-}
-
-impl SemanticToken {
- fn deserialize_tokens<'de, D>(deserializer: D) -> Result<Vec<SemanticToken>, D::Error>
- where
- D: serde::Deserializer<'de>,
- {
- let data = Vec::<u32>::deserialize(deserializer)?;
- let chunks = data.chunks_exact(5);
-
- if !chunks.remainder().is_empty() {
- return Result::Err(serde::de::Error::custom("Length is not divisible by 5"));
- }
-
- Result::Ok(
- chunks
- .map(|chunk| SemanticToken {
- delta_line: chunk[0],
- delta_start: chunk[1],
- length: chunk[2],
- token_type: chunk[3],
- token_modifiers_bitset: chunk[4],
- })
- .collect(),
- )
- }
-
- fn serialize_tokens<S>(tokens: &[SemanticToken], serializer: S) -> Result<S::Ok, S::Error>
- where
- S: serde::Serializer,
- {
- let mut seq = serializer.serialize_seq(Some(tokens.len() * 5))?;
- for token in tokens.iter() {
- seq.serialize_element(&token.delta_line)?;
- seq.serialize_element(&token.delta_start)?;
- seq.serialize_element(&token.length)?;
- seq.serialize_element(&token.token_type)?;
- seq.serialize_element(&token.token_modifiers_bitset)?;
- }
- seq.end()
- }
-
- fn deserialize_tokens_opt<'de, D>(
- deserializer: D,
- ) -> Result<Option<Vec<SemanticToken>>, D::Error>
- where
- D: serde::Deserializer<'de>,
- {
- #[derive(Deserialize)]
- #[serde(transparent)]
- struct Wrapper {
- #[serde(deserialize_with = "SemanticToken::deserialize_tokens")]
- tokens: Vec<SemanticToken>,
- }
-
- Ok(Option::<Wrapper>::deserialize(deserializer)?.map(|wrapper| wrapper.tokens))
- }
-
- fn serialize_tokens_opt<S>(
- data: &Option<Vec<SemanticToken>>,
- serializer: S,
- ) -> Result<S::Ok, S::Error>
- where
- S: serde::Serializer,
- {
- #[derive(Serialize)]
- #[serde(transparent)]
- struct Wrapper {
- #[serde(serialize_with = "SemanticToken::serialize_tokens")]
- tokens: Vec<SemanticToken>,
- }
-
- let opt = data.as_ref().map(|t| Wrapper { tokens: t.to_vec() });
-
- opt.serialize(serializer)
- }
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokens {
- /// An optional result id. If provided and clients support delta updating
- /// the client will include the result id in the next semantic token request.
- /// A server can then instead of computing all semantic tokens again simply
- /// send a delta.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub result_id: Option<String>,
-
- /// The actual tokens. For a detailed description about how the data is
- /// structured please see
- /// <https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71>
- #[serde(
- deserialize_with = "SemanticToken::deserialize_tokens",
- serialize_with = "SemanticToken::serialize_tokens"
- )]
- pub data: Vec<SemanticToken>,
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensPartialResult {
- #[serde(
- deserialize_with = "SemanticToken::deserialize_tokens",
- serialize_with = "SemanticToken::serialize_tokens"
- )]
- pub data: Vec<SemanticToken>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum SemanticTokensResult {
- Tokens(SemanticTokens),
- Partial(SemanticTokensPartialResult),
-}
-
-impl From<SemanticTokens> for SemanticTokensResult {
- fn from(from: SemanticTokens) -> Self {
- SemanticTokensResult::Tokens(from)
- }
-}
-
-impl From<SemanticTokensPartialResult> for SemanticTokensResult {
- fn from(from: SemanticTokensPartialResult) -> Self {
- SemanticTokensResult::Partial(from)
- }
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensEdit {
- pub start: u32,
- pub delete_count: u32,
-
- #[serde(
- default,
- skip_serializing_if = "Option::is_none",
- deserialize_with = "SemanticToken::deserialize_tokens_opt",
- serialize_with = "SemanticToken::serialize_tokens_opt"
- )]
- pub data: Option<Vec<SemanticToken>>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum SemanticTokensFullDeltaResult {
- Tokens(SemanticTokens),
- TokensDelta(SemanticTokensDelta),
- PartialTokensDelta { edits: Vec<SemanticTokensEdit> },
-}
-
-impl From<SemanticTokens> for SemanticTokensFullDeltaResult {
- fn from(from: SemanticTokens) -> Self {
- SemanticTokensFullDeltaResult::Tokens(from)
- }
-}
-
-impl From<SemanticTokensDelta> for SemanticTokensFullDeltaResult {
- fn from(from: SemanticTokensDelta) -> Self {
- SemanticTokensFullDeltaResult::TokensDelta(from)
- }
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensDelta {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub result_id: Option<String>,
- /// For a detailed description how these edits are structured please see
- /// <https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L131>
- pub edits: Vec<SemanticTokensEdit>,
-}
-
-/// Capabilities specific to the `textDocument/semanticTokens/*` requests.
-///
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensClientCapabilities {
- /// Whether implementation supports dynamic registration. If this is set to `true`
- /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- /// return value for the corresponding server capability as well.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Which requests the client supports and might send to the server
- /// depending on the server's capability. Please note that clients might not
- /// show semantic tokens or degrade some of the user experience if a range
- /// or full request is advertised by the client but not provided by the
- /// server. If for example the client capability `requests.full` and
- /// `request.range` are both set to true but the server only provides a
- /// range provider the client might not render a minimap correctly or might
- /// even decide to not show any semantic tokens at all.
- pub requests: SemanticTokensClientCapabilitiesRequests,
-
- /// The token types that the client supports.
- pub token_types: Vec<SemanticTokenType>,
-
- /// The token modifiers that the client supports.
- pub token_modifiers: Vec<SemanticTokenModifier>,
-
- /// The token formats the clients supports.
- pub formats: Vec<TokenFormat>,
-
- /// Whether the client supports tokens that can overlap each other.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub overlapping_token_support: Option<bool>,
-
- /// Whether the client supports tokens that can span multiple lines.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub multiline_token_support: Option<bool>,
-
- /// Whether the client allows the server to actively cancel a
- /// semantic token request, e.g. supports returning
- /// ErrorCodes.ServerCancelled. If a server does the client
- /// needs to retrigger the request.
- ///
- /// since @3.17.0
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub server_cancel_support: Option<bool>,
-
-
- /// Whether the client uses semantic tokens to augment existing
- /// syntax tokens. If set to `true` client side created syntax
- /// tokens and semantic tokens are both used for colorization. If
- /// set to `false` the client only uses the returned semantic tokens
- /// for colorization.
- ///
- /// If the value is `undefined` then the client behavior is not
- /// specified.
- ///
- /// @since 3.17.0
- #[cfg(feature = "proposed")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub augments_syntax_tokens: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensClientCapabilitiesRequests {
- /// The client will send the `textDocument/semanticTokens/range` request if the server provides a corresponding handler.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range: Option<bool>,
-
- /// The client will send the `textDocument/semanticTokens/full` request if the server provides a corresponding handler.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub full: Option<SemanticTokensFullOptions>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum SemanticTokensFullOptions {
- Bool(bool),
- Delta {
- /// The client will send the `textDocument/semanticTokens/full/delta` request if the server provides a corresponding handler.
- /// The server supports deltas for full documents.
- #[serde(skip_serializing_if = "Option::is_none")]
- delta: Option<bool>,
- },
-}
-
-/// @since 3.16.0
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensOptions {
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-
- /// The legend used by the server
- pub legend: SemanticTokensLegend,
-
- /// Server supports providing semantic tokens for a sepcific range
- /// of a document.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub range: Option<bool>,
-
- /// Server supports providing semantic tokens for a full document.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub full: Option<SemanticTokensFullOptions>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-
- #[serde(flatten)]
- pub semantic_tokens_options: SemanticTokensOptions,
-
- #[serde(flatten)]
- pub static_registration_options: StaticRegistrationOptions,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum SemanticTokensServerCapabilities {
- SemanticTokensOptions(SemanticTokensOptions),
- SemanticTokensRegistrationOptions(SemanticTokensRegistrationOptions),
-}
-
-impl From<SemanticTokensOptions> for SemanticTokensServerCapabilities {
- fn from(from: SemanticTokensOptions) -> Self {
- SemanticTokensServerCapabilities::SemanticTokensOptions(from)
- }
-}
-
-impl From<SemanticTokensRegistrationOptions> for SemanticTokensServerCapabilities {
- fn from(from: SemanticTokensRegistrationOptions) -> Self {
- SemanticTokensServerCapabilities::SemanticTokensRegistrationOptions(from)
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensWorkspaceClientCapabilities {
- /// Whether the client implementation supports a refresh request sent from
- /// the server to the client.
- ///
- /// Note that this event is global and will force the client to refresh all
- /// semantic tokens currently shown. It should be used with absolute care
- /// and is useful for situation where a server for example detect a project
- /// wide change that requires such a calculation.
- pub refresh_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensParams {
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensDeltaParams {
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The result id of a previous response. The result Id can either point to a full response
- /// or a delta response depending on what was recevied last.
- pub previous_result_id: String,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SemanticTokensRangeParams {
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- /// The text document.
- pub text_document: TextDocumentIdentifier,
-
- /// The range the semantic tokens are requested for.
- pub range: Range,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(untagged)]
-pub enum SemanticTokensRangeResult {
- Tokens(SemanticTokens),
- Partial(SemanticTokensPartialResult),
-}
-
-impl From<SemanticTokens> for SemanticTokensRangeResult {
- fn from(tokens: SemanticTokens) -> Self {
- SemanticTokensRangeResult::Tokens(tokens)
- }
-}
-
-impl From<SemanticTokensPartialResult> for SemanticTokensRangeResult {
- fn from(partial: SemanticTokensPartialResult) -> Self {
- SemanticTokensRangeResult::Partial(partial)
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::tests::{test_deserialization, test_serialization};
-
- #[test]
- fn test_semantic_tokens_support_serialization() {
- test_serialization(
- &SemanticTokens {
- result_id: None,
- data: vec![],
- },
- r#"{"data":[]}"#,
- );
-
- test_serialization(
- &SemanticTokens {
- result_id: None,
- data: vec![SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- }],
- },
- r#"{"data":[2,5,3,0,3]}"#,
- );
-
- test_serialization(
- &SemanticTokens {
- result_id: None,
- data: vec![
- SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- },
- SemanticToken {
- delta_line: 0,
- delta_start: 5,
- length: 4,
- token_type: 1,
- token_modifiers_bitset: 0,
- },
- ],
- },
- r#"{"data":[2,5,3,0,3,0,5,4,1,0]}"#,
- );
- }
-
- #[test]
- fn test_semantic_tokens_support_deserialization() {
- test_deserialization(
- r#"{"data":[]}"#,
- &SemanticTokens {
- result_id: None,
- data: vec![],
- },
- );
-
- test_deserialization(
- r#"{"data":[2,5,3,0,3]}"#,
- &SemanticTokens {
- result_id: None,
- data: vec![SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- }],
- },
- );
-
- test_deserialization(
- r#"{"data":[2,5,3,0,3,0,5,4,1,0]}"#,
- &SemanticTokens {
- result_id: None,
- data: vec![
- SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- },
- SemanticToken {
- delta_line: 0,
- delta_start: 5,
- length: 4,
- token_type: 1,
- token_modifiers_bitset: 0,
- },
- ],
- },
- );
- }
-
- #[test]
- #[should_panic]
- fn test_semantic_tokens_support_deserialization_err() {
- test_deserialization(
- r#"{"data":[1]}"#,
- &SemanticTokens {
- result_id: None,
- data: vec![],
- },
- );
- }
-
- #[test]
- fn test_semantic_tokens_edit_support_deserialization() {
- test_deserialization(
- r#"{"start":0,"deleteCount":1,"data":[2,5,3,0,3,0,5,4,1,0]}"#,
- &SemanticTokensEdit {
- start: 0,
- delete_count: 1,
- data: Some(vec![
- SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- },
- SemanticToken {
- delta_line: 0,
- delta_start: 5,
- length: 4,
- token_type: 1,
- token_modifiers_bitset: 0,
- },
- ]),
- },
- );
-
- test_deserialization(
- r#"{"start":0,"deleteCount":1}"#,
- &SemanticTokensEdit {
- start: 0,
- delete_count: 1,
- data: None,
- },
- );
- }
-
- #[test]
- fn test_semantic_tokens_edit_support_serialization() {
- test_serialization(
- &SemanticTokensEdit {
- start: 0,
- delete_count: 1,
- data: Some(vec![
- SemanticToken {
- delta_line: 2,
- delta_start: 5,
- length: 3,
- token_type: 0,
- token_modifiers_bitset: 3,
- },
- SemanticToken {
- delta_line: 0,
- delta_start: 5,
- length: 4,
- token_type: 1,
- token_modifiers_bitset: 0,
- },
- ]),
- },
- r#"{"start":0,"deleteCount":1,"data":[2,5,3,0,3,0,5,4,1,0]}"#,
- );
-
- test_serialization(
- &SemanticTokensEdit {
- start: 0,
- delete_count: 1,
- data: None,
- },
- r#"{"start":0,"deleteCount":1}"#,
- );
- }
-}
+use std::borrow::Cow;
+
+use serde::ser::SerializeSeq;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ PartialResultParams, Range, StaticRegistrationOptions, TextDocumentIdentifier,
+ TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+/// A set of predefined token types. This set is not fixed
+/// and clients can specify additional token types via the
+/// corresponding client capabilities.
+/// since @3.16.0
+#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
+pub struct SemanticTokenType(Cow<'static, str>);
+
+impl SemanticTokenType {
+ pub const NAMESPACE: SemanticTokenType = SemanticTokenType::new("namespace");
+ pub const TYPE: SemanticTokenType = SemanticTokenType::new("type");
+ pub const CLASS: SemanticTokenType = SemanticTokenType::new("class");
+ pub const ENUM: SemanticTokenType = SemanticTokenType::new("enum");
+ pub const INTERFACE: SemanticTokenType = SemanticTokenType::new("interface");
+ pub const STRUCT: SemanticTokenType = SemanticTokenType::new("struct");
+ pub const TYPE_PARAMETER: SemanticTokenType = SemanticTokenType::new("typeParameter");
+ pub const PARAMETER: SemanticTokenType = SemanticTokenType::new("parameter");
+ pub const VARIABLE: SemanticTokenType = SemanticTokenType::new("variable");
+ pub const PROPERTY: SemanticTokenType = SemanticTokenType::new("property");
+ pub const ENUM_MEMBER: SemanticTokenType = SemanticTokenType::new("enumMember");
+ pub const EVENT: SemanticTokenType = SemanticTokenType::new("event");
+ pub const FUNCTION: SemanticTokenType = SemanticTokenType::new("function");
+ pub const METHOD: SemanticTokenType = SemanticTokenType::new("method");
+ pub const MACRO: SemanticTokenType = SemanticTokenType::new("macro");
+ pub const KEYWORD: SemanticTokenType = SemanticTokenType::new("keyword");
+ pub const MODIFIER: SemanticTokenType = SemanticTokenType::new("modifier");
+ pub const COMMENT: SemanticTokenType = SemanticTokenType::new("comment");
+ pub const STRING: SemanticTokenType = SemanticTokenType::new("string");
+ pub const NUMBER: SemanticTokenType = SemanticTokenType::new("number");
+ pub const REGEXP: SemanticTokenType = SemanticTokenType::new("regexp");
+ pub const OPERATOR: SemanticTokenType = SemanticTokenType::new("operator");
+
+ /// since @3.17.0
+ pub const DECORATOR: SemanticTokenType = SemanticTokenType::new("decorator");
+
+ pub const fn new(tag: &'static str) -> Self {
+ SemanticTokenType(Cow::Borrowed(tag))
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl From<String> for SemanticTokenType {
+ fn from(from: String) -> Self {
+ SemanticTokenType(Cow::from(from))
+ }
+}
+
+impl From<&'static str> for SemanticTokenType {
+ fn from(from: &'static str) -> Self {
+ SemanticTokenType::new(from)
+ }
+}
+
+/// A set of predefined token modifiers. This set is not fixed
+/// and clients can specify additional token types via the
+/// corresponding client capabilities.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
+pub struct SemanticTokenModifier(Cow<'static, str>);
+
+impl SemanticTokenModifier {
+ pub const DECLARATION: SemanticTokenModifier = SemanticTokenModifier::new("declaration");
+ pub const DEFINITION: SemanticTokenModifier = SemanticTokenModifier::new("definition");
+ pub const READONLY: SemanticTokenModifier = SemanticTokenModifier::new("readonly");
+ pub const STATIC: SemanticTokenModifier = SemanticTokenModifier::new("static");
+ pub const DEPRECATED: SemanticTokenModifier = SemanticTokenModifier::new("deprecated");
+ pub const ABSTRACT: SemanticTokenModifier = SemanticTokenModifier::new("abstract");
+ pub const ASYNC: SemanticTokenModifier = SemanticTokenModifier::new("async");
+ pub const MODIFICATION: SemanticTokenModifier = SemanticTokenModifier::new("modification");
+ pub const DOCUMENTATION: SemanticTokenModifier = SemanticTokenModifier::new("documentation");
+ pub const DEFAULT_LIBRARY: SemanticTokenModifier = SemanticTokenModifier::new("defaultLibrary");
+
+ pub const fn new(tag: &'static str) -> Self {
+ SemanticTokenModifier(Cow::Borrowed(tag))
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl From<String> for SemanticTokenModifier {
+ fn from(from: String) -> Self {
+ SemanticTokenModifier(Cow::from(from))
+ }
+}
+
+impl From<&'static str> for SemanticTokenModifier {
+ fn from(from: &'static str) -> Self {
+ SemanticTokenModifier::new(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Clone, Deserialize, Serialize)]
+pub struct TokenFormat(Cow<'static, str>);
+
+impl TokenFormat {
+ pub const RELATIVE: TokenFormat = TokenFormat::new("relative");
+
+ pub const fn new(tag: &'static str) -> Self {
+ TokenFormat(Cow::Borrowed(tag))
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl From<String> for TokenFormat {
+ fn from(from: String) -> Self {
+ TokenFormat(Cow::from(from))
+ }
+}
+
+impl From<&'static str> for TokenFormat {
+ fn from(from: &'static str) -> Self {
+ TokenFormat::new(from)
+ }
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensLegend {
+ /// The token types a server uses.
+ pub token_types: Vec<SemanticTokenType>,
+
+ /// The token modifiers a server uses.
+ pub token_modifiers: Vec<SemanticTokenModifier>,
+}
+
+/// The actual tokens.
+#[derive(Debug, Eq, PartialEq, Copy, Clone, Default)]
+pub struct SemanticToken {
+ pub delta_line: u32,
+ pub delta_start: u32,
+ pub length: u32,
+ pub token_type: u32,
+ pub token_modifiers_bitset: u32,
+}
+
+impl SemanticToken {
+ fn deserialize_tokens<'de, D>(deserializer: D) -> Result<Vec<SemanticToken>, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let data = Vec::<u32>::deserialize(deserializer)?;
+ let chunks = data.chunks_exact(5);
+
+ if !chunks.remainder().is_empty() {
+ return Result::Err(serde::de::Error::custom("Length is not divisible by 5"));
+ }
+
+ Result::Ok(
+ chunks
+ .map(|chunk| SemanticToken {
+ delta_line: chunk[0],
+ delta_start: chunk[1],
+ length: chunk[2],
+ token_type: chunk[3],
+ token_modifiers_bitset: chunk[4],
+ })
+ .collect(),
+ )
+ }
+
+ fn serialize_tokens<S>(tokens: &[SemanticToken], serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: serde::Serializer,
+ {
+ let mut seq = serializer.serialize_seq(Some(tokens.len() * 5))?;
+ for token in tokens.iter() {
+ seq.serialize_element(&token.delta_line)?;
+ seq.serialize_element(&token.delta_start)?;
+ seq.serialize_element(&token.length)?;
+ seq.serialize_element(&token.token_type)?;
+ seq.serialize_element(&token.token_modifiers_bitset)?;
+ }
+ seq.end()
+ }
+
+ fn deserialize_tokens_opt<'de, D>(
+ deserializer: D,
+ ) -> Result<Option<Vec<SemanticToken>>, D::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ #[derive(Deserialize)]
+ #[serde(transparent)]
+ struct Wrapper {
+ #[serde(deserialize_with = "SemanticToken::deserialize_tokens")]
+ tokens: Vec<SemanticToken>,
+ }
+
+ Ok(Option::<Wrapper>::deserialize(deserializer)?.map(|wrapper| wrapper.tokens))
+ }
+
+ fn serialize_tokens_opt<S>(
+ data: &Option<Vec<SemanticToken>>,
+ serializer: S,
+ ) -> Result<S::Ok, S::Error>
+ where
+ S: serde::Serializer,
+ {
+ #[derive(Serialize)]
+ #[serde(transparent)]
+ struct Wrapper {
+ #[serde(serialize_with = "SemanticToken::serialize_tokens")]
+ tokens: Vec<SemanticToken>,
+ }
+
+ let opt = data.as_ref().map(|t| Wrapper { tokens: t.to_vec() });
+
+ opt.serialize(serializer)
+ }
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokens {
+ /// An optional result id. If provided and clients support delta updating
+ /// the client will include the result id in the next semantic token request.
+ /// A server can then instead of computing all semantic tokens again simply
+ /// send a delta.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub result_id: Option<String>,
+
+ /// The actual tokens. For a detailed description about how the data is
+ /// structured please see
+ /// <https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71>
+ #[serde(
+ deserialize_with = "SemanticToken::deserialize_tokens",
+ serialize_with = "SemanticToken::serialize_tokens"
+ )]
+ pub data: Vec<SemanticToken>,
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensPartialResult {
+ #[serde(
+ deserialize_with = "SemanticToken::deserialize_tokens",
+ serialize_with = "SemanticToken::serialize_tokens"
+ )]
+ pub data: Vec<SemanticToken>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum SemanticTokensResult {
+ Tokens(SemanticTokens),
+ Partial(SemanticTokensPartialResult),
+}
+
+impl From<SemanticTokens> for SemanticTokensResult {
+ fn from(from: SemanticTokens) -> Self {
+ SemanticTokensResult::Tokens(from)
+ }
+}
+
+impl From<SemanticTokensPartialResult> for SemanticTokensResult {
+ fn from(from: SemanticTokensPartialResult) -> Self {
+ SemanticTokensResult::Partial(from)
+ }
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensEdit {
+ pub start: u32,
+ pub delete_count: u32,
+
+ #[serde(
+ default,
+ skip_serializing_if = "Option::is_none",
+ deserialize_with = "SemanticToken::deserialize_tokens_opt",
+ serialize_with = "SemanticToken::serialize_tokens_opt"
+ )]
+ pub data: Option<Vec<SemanticToken>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum SemanticTokensFullDeltaResult {
+ Tokens(SemanticTokens),
+ TokensDelta(SemanticTokensDelta),
+ PartialTokensDelta { edits: Vec<SemanticTokensEdit> },
+}
+
+impl From<SemanticTokens> for SemanticTokensFullDeltaResult {
+ fn from(from: SemanticTokens) -> Self {
+ SemanticTokensFullDeltaResult::Tokens(from)
+ }
+}
+
+impl From<SemanticTokensDelta> for SemanticTokensFullDeltaResult {
+ fn from(from: SemanticTokensDelta) -> Self {
+ SemanticTokensFullDeltaResult::TokensDelta(from)
+ }
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensDelta {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub result_id: Option<String>,
+ /// For a detailed description how these edits are structured please see
+ /// <https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L131>
+ pub edits: Vec<SemanticTokensEdit>,
+}
+
+/// Capabilities specific to the `textDocument/semanticTokens/*` requests.
+///
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensClientCapabilities {
+ /// Whether implementation supports dynamic registration. If this is set to `true`
+ /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+ /// return value for the corresponding server capability as well.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Which requests the client supports and might send to the server
+ /// depending on the server's capability. Please note that clients might not
+ /// show semantic tokens or degrade some of the user experience if a range
+ /// or full request is advertised by the client but not provided by the
+ /// server. If for example the client capability `requests.full` and
+ /// `request.range` are both set to true but the server only provides a
+ /// range provider the client might not render a minimap correctly or might
+ /// even decide to not show any semantic tokens at all.
+ pub requests: SemanticTokensClientCapabilitiesRequests,
+
+ /// The token types that the client supports.
+ pub token_types: Vec<SemanticTokenType>,
+
+ /// The token modifiers that the client supports.
+ pub token_modifiers: Vec<SemanticTokenModifier>,
+
+ /// The token formats the clients supports.
+ pub formats: Vec<TokenFormat>,
+
+ /// Whether the client supports tokens that can overlap each other.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub overlapping_token_support: Option<bool>,
+
+ /// Whether the client supports tokens that can span multiple lines.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub multiline_token_support: Option<bool>,
+
+ /// Whether the client allows the server to actively cancel a
+ /// semantic token request, e.g. supports returning
+ /// ErrorCodes.ServerCancelled. If a server does the client
+ /// needs to retrigger the request.
+ ///
+ /// since @3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub server_cancel_support: Option<bool>,
+
+ /// Whether the client uses semantic tokens to augment existing
+ /// syntax tokens. If set to `true` client side created syntax
+ /// tokens and semantic tokens are both used for colorization. If
+ /// set to `false` the client only uses the returned semantic tokens
+ /// for colorization.
+ ///
+ /// If the value is `undefined` then the client behavior is not
+ /// specified.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub augments_syntax_tokens: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensClientCapabilitiesRequests {
+ /// The client will send the `textDocument/semanticTokens/range` request if the server provides a corresponding handler.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range: Option<bool>,
+
+ /// The client will send the `textDocument/semanticTokens/full` request if the server provides a corresponding handler.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub full: Option<SemanticTokensFullOptions>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum SemanticTokensFullOptions {
+ Bool(bool),
+ Delta {
+ /// The client will send the `textDocument/semanticTokens/full/delta` request if the server provides a corresponding handler.
+ /// The server supports deltas for full documents.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ delta: Option<bool>,
+ },
+}
+
+/// @since 3.16.0
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+
+ /// The legend used by the server
+ pub legend: SemanticTokensLegend,
+
+ /// Server supports providing semantic tokens for a sepcific range
+ /// of a document.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub range: Option<bool>,
+
+ /// Server supports providing semantic tokens for a full document.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub full: Option<SemanticTokensFullOptions>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+
+ #[serde(flatten)]
+ pub semantic_tokens_options: SemanticTokensOptions,
+
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum SemanticTokensServerCapabilities {
+ SemanticTokensOptions(SemanticTokensOptions),
+ SemanticTokensRegistrationOptions(SemanticTokensRegistrationOptions),
+}
+
+impl From<SemanticTokensOptions> for SemanticTokensServerCapabilities {
+ fn from(from: SemanticTokensOptions) -> Self {
+ SemanticTokensServerCapabilities::SemanticTokensOptions(from)
+ }
+}
+
+impl From<SemanticTokensRegistrationOptions> for SemanticTokensServerCapabilities {
+ fn from(from: SemanticTokensRegistrationOptions) -> Self {
+ SemanticTokensServerCapabilities::SemanticTokensRegistrationOptions(from)
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensWorkspaceClientCapabilities {
+ /// Whether the client implementation supports a refresh request sent from
+ /// the server to the client.
+ ///
+ /// Note that this event is global and will force the client to refresh all
+ /// semantic tokens currently shown. It should be used with absolute care
+ /// and is useful for situation where a server for example detect a project
+ /// wide change that requires such a calculation.
+ pub refresh_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensParams {
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensDeltaParams {
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The result id of a previous response. The result Id can either point to a full response
+ /// or a delta response depending on what was recevied last.
+ pub previous_result_id: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SemanticTokensRangeParams {
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ /// The text document.
+ pub text_document: TextDocumentIdentifier,
+
+ /// The range the semantic tokens are requested for.
+ pub range: Range,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+pub enum SemanticTokensRangeResult {
+ Tokens(SemanticTokens),
+ Partial(SemanticTokensPartialResult),
+}
+
+impl From<SemanticTokens> for SemanticTokensRangeResult {
+ fn from(tokens: SemanticTokens) -> Self {
+ SemanticTokensRangeResult::Tokens(tokens)
+ }
+}
+
+impl From<SemanticTokensPartialResult> for SemanticTokensRangeResult {
+ fn from(partial: SemanticTokensPartialResult) -> Self {
+ SemanticTokensRangeResult::Partial(partial)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::{test_deserialization, test_serialization};
+
+ #[test]
+ fn test_semantic_tokens_support_serialization() {
+ test_serialization(
+ &SemanticTokens {
+ result_id: None,
+ data: vec![],
+ },
+ r#"{"data":[]}"#,
+ );
+
+ test_serialization(
+ &SemanticTokens {
+ result_id: None,
+ data: vec![SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ }],
+ },
+ r#"{"data":[2,5,3,0,3]}"#,
+ );
+
+ test_serialization(
+ &SemanticTokens {
+ result_id: None,
+ data: vec![
+ SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ },
+ SemanticToken {
+ delta_line: 0,
+ delta_start: 5,
+ length: 4,
+ token_type: 1,
+ token_modifiers_bitset: 0,
+ },
+ ],
+ },
+ r#"{"data":[2,5,3,0,3,0,5,4,1,0]}"#,
+ );
+ }
+
+ #[test]
+ fn test_semantic_tokens_support_deserialization() {
+ test_deserialization(
+ r#"{"data":[]}"#,
+ &SemanticTokens {
+ result_id: None,
+ data: vec![],
+ },
+ );
+
+ test_deserialization(
+ r#"{"data":[2,5,3,0,3]}"#,
+ &SemanticTokens {
+ result_id: None,
+ data: vec![SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ }],
+ },
+ );
+
+ test_deserialization(
+ r#"{"data":[2,5,3,0,3,0,5,4,1,0]}"#,
+ &SemanticTokens {
+ result_id: None,
+ data: vec![
+ SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ },
+ SemanticToken {
+ delta_line: 0,
+ delta_start: 5,
+ length: 4,
+ token_type: 1,
+ token_modifiers_bitset: 0,
+ },
+ ],
+ },
+ );
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_semantic_tokens_support_deserialization_err() {
+ test_deserialization(
+ r#"{"data":[1]}"#,
+ &SemanticTokens {
+ result_id: None,
+ data: vec![],
+ },
+ );
+ }
+
+ #[test]
+ fn test_semantic_tokens_edit_support_deserialization() {
+ test_deserialization(
+ r#"{"start":0,"deleteCount":1,"data":[2,5,3,0,3,0,5,4,1,0]}"#,
+ &SemanticTokensEdit {
+ start: 0,
+ delete_count: 1,
+ data: Some(vec![
+ SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ },
+ SemanticToken {
+ delta_line: 0,
+ delta_start: 5,
+ length: 4,
+ token_type: 1,
+ token_modifiers_bitset: 0,
+ },
+ ]),
+ },
+ );
+
+ test_deserialization(
+ r#"{"start":0,"deleteCount":1}"#,
+ &SemanticTokensEdit {
+ start: 0,
+ delete_count: 1,
+ data: None,
+ },
+ );
+ }
+
+ #[test]
+ fn test_semantic_tokens_edit_support_serialization() {
+ test_serialization(
+ &SemanticTokensEdit {
+ start: 0,
+ delete_count: 1,
+ data: Some(vec![
+ SemanticToken {
+ delta_line: 2,
+ delta_start: 5,
+ length: 3,
+ token_type: 0,
+ token_modifiers_bitset: 3,
+ },
+ SemanticToken {
+ delta_line: 0,
+ delta_start: 5,
+ length: 4,
+ token_type: 1,
+ token_modifiers_bitset: 0,
+ },
+ ]),
+ },
+ r#"{"start":0,"deleteCount":1,"data":[2,5,3,0,3,0,5,4,1,0]}"#,
+ );
+
+ test_serialization(
+ &SemanticTokensEdit {
+ start: 0,
+ delete_count: 1,
+ data: None,
+ },
+ r#"{"start":0,"deleteCount":1}"#,
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/signature_help.rs b/vendor/lsp-types/src/signature_help.rs
index 151f3bf7f..569417c2a 100644
--- a/vendor/lsp-types/src/signature_help.rs
+++ b/vendor/lsp-types/src/signature_help.rs
@@ -1,207 +1,207 @@
-use serde::{Deserialize, Serialize};
-
-use crate::{
- Documentation, MarkupKind, TextDocumentPositionParams, TextDocumentRegistrationOptions,
- WorkDoneProgressOptions, WorkDoneProgressParams,
-};
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureInformationSettings {
- /// Client supports the follow content formats for the documentation
- /// property. The order describes the preferred format of the client.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub documentation_format: Option<Vec<MarkupKind>>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub parameter_information: Option<ParameterInformationSettings>,
-
- /// The client support the `activeParameter` property on `SignatureInformation`
- /// literal.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub active_parameter_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ParameterInformationSettings {
- /// The client supports processing label offsets instead of a
- /// simple label string.
- ///
- /// @since 3.14.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub label_offset_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureHelpClientCapabilities {
- /// Whether completion supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// The client supports the following `SignatureInformation`
- /// specific properties.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub signature_information: Option<SignatureInformationSettings>,
-
- /// The client supports to send additional context information for a
- /// `textDocument/signatureHelp` request. A client that opts into
- /// contextSupport will also support the `retriggerCharacters` on
- /// `SignatureHelpOptions`.
- ///
- /// @since 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub context_support: Option<bool>,
-}
-
-/// Signature help options.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureHelpOptions {
- /// The characters that trigger signature help automatically.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trigger_characters: Option<Vec<String>>,
-
- /// List of characters that re-trigger signature help.
- /// These trigger characters are only active when signature help is already showing. All trigger characters
- /// are also counted as re-trigger characters.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub retrigger_characters: Option<Vec<String>>,
-
- #[serde(flatten)]
- pub work_done_progress_options: WorkDoneProgressOptions,
-}
-
-/// Signature help options.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct SignatureHelpRegistrationOptions {
- #[serde(flatten)]
- pub text_document_registration_options: TextDocumentRegistrationOptions,
-}
-
-/// Signature help options.
-#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct SignatureHelpTriggerKind(i32);
-lsp_enum! {
-impl SignatureHelpTriggerKind {
- /// Signature help was invoked manually by the user or by a command.
- pub const INVOKED: SignatureHelpTriggerKind = SignatureHelpTriggerKind(1);
- /// Signature help was triggered by a trigger character.
- pub const TRIGGER_CHARACTER: SignatureHelpTriggerKind = SignatureHelpTriggerKind(2);
- /// Signature help was triggered by the cursor moving or by the document content changing.
- pub const CONTENT_CHANGE: SignatureHelpTriggerKind = SignatureHelpTriggerKind(3);
-}
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureHelpParams {
- /// The signature help context. This is only available if the client specifies
- /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub context: Option<SignatureHelpContext>,
-
- #[serde(flatten)]
- pub text_document_position_params: TextDocumentPositionParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureHelpContext {
- /// Action that caused signature help to be triggered.
- pub trigger_kind: SignatureHelpTriggerKind,
-
- /// Character that caused signature help to be triggered.
- /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub trigger_character: Option<String>,
-
- /// `true` if signature help was already showing when it was triggered.
- /// Retriggers occur when the signature help is already active and can be caused by actions such as
- /// typing a trigger character, a cursor move, or document content changes.
- pub is_retrigger: bool,
-
- /// The currently active `SignatureHelp`.
- /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
- /// the user navigating through available signatures.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub active_signature_help: Option<SignatureHelp>,
-}
-
-/// Signature help represents the signature of something
-/// callable. There can be multiple signature but only one
-/// active and only one active parameter.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureHelp {
- /// One or more signatures.
- pub signatures: Vec<SignatureInformation>,
-
- /// The active signature.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub active_signature: Option<u32>,
-
- /// The active parameter of the active signature.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub active_parameter: Option<u32>,
-}
-
-/// Represents the signature of something callable. A signature
-/// can have a label, like a function-name, a doc-comment, and
-/// a set of parameters.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SignatureInformation {
- /// The label of this signature. Will be shown in
- /// the UI.
- pub label: String,
-
- /// The human-readable doc-comment of this signature. Will be shown
- /// in the UI but can be omitted.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub documentation: Option<Documentation>,
-
- /// The parameters of this signature.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub parameters: Option<Vec<ParameterInformation>>,
-
- /// The index of the active parameter.
- ///
- /// If provided, this is used in place of `SignatureHelp.activeParameter`.
- ///
- /// @since 3.16.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub active_parameter: Option<u32>,
-}
-
-/// Represents a parameter of a callable-signature. A parameter can
-/// have a label and a doc-comment.
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ParameterInformation {
- /// The label of this parameter information.
- ///
- /// Either a string or an inclusive start and exclusive end offsets within its containing
- /// signature label. (see SignatureInformation.label). *Note*: A label of type string must be
- /// a substring of its containing signature label.
- pub label: ParameterLabel,
-
- /// The human-readable doc-comment of this parameter. Will be shown
- /// in the UI but can be omitted.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub documentation: Option<Documentation>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum ParameterLabel {
- Simple(String),
- LabelOffsets([u32; 2]),
-}
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ Documentation, MarkupKind, TextDocumentPositionParams, TextDocumentRegistrationOptions,
+ WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureInformationSettings {
+ /// Client supports the follow content formats for the documentation
+ /// property. The order describes the preferred format of the client.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub documentation_format: Option<Vec<MarkupKind>>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parameter_information: Option<ParameterInformationSettings>,
+
+ /// The client support the `activeParameter` property on `SignatureInformation`
+ /// literal.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub active_parameter_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ParameterInformationSettings {
+ /// The client supports processing label offsets instead of a
+ /// simple label string.
+ ///
+ /// @since 3.14.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub label_offset_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureHelpClientCapabilities {
+ /// Whether completion supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// The client supports the following `SignatureInformation`
+ /// specific properties.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub signature_information: Option<SignatureInformationSettings>,
+
+ /// The client supports to send additional context information for a
+ /// `textDocument/signatureHelp` request. A client that opts into
+ /// contextSupport will also support the `retriggerCharacters` on
+ /// `SignatureHelpOptions`.
+ ///
+ /// @since 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub context_support: Option<bool>,
+}
+
+/// Signature help options.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureHelpOptions {
+ /// The characters that trigger signature help automatically.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trigger_characters: Option<Vec<String>>,
+
+ /// List of characters that re-trigger signature help.
+ /// These trigger characters are only active when signature help is already showing. All trigger characters
+ /// are also counted as re-trigger characters.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub retrigger_characters: Option<Vec<String>>,
+
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+/// Signature help options.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct SignatureHelpRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+}
+
+/// Signature help options.
+#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct SignatureHelpTriggerKind(i32);
+lsp_enum! {
+impl SignatureHelpTriggerKind {
+ /// Signature help was invoked manually by the user or by a command.
+ pub const INVOKED: SignatureHelpTriggerKind = SignatureHelpTriggerKind(1);
+ /// Signature help was triggered by a trigger character.
+ pub const TRIGGER_CHARACTER: SignatureHelpTriggerKind = SignatureHelpTriggerKind(2);
+ /// Signature help was triggered by the cursor moving or by the document content changing.
+ pub const CONTENT_CHANGE: SignatureHelpTriggerKind = SignatureHelpTriggerKind(3);
+}
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureHelpParams {
+ /// The signature help context. This is only available if the client specifies
+ /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub context: Option<SignatureHelpContext>,
+
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureHelpContext {
+ /// Action that caused signature help to be triggered.
+ pub trigger_kind: SignatureHelpTriggerKind,
+
+ /// Character that caused signature help to be triggered.
+ /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub trigger_character: Option<String>,
+
+ /// `true` if signature help was already showing when it was triggered.
+ /// Retriggers occur when the signature help is already active and can be caused by actions such as
+ /// typing a trigger character, a cursor move, or document content changes.
+ pub is_retrigger: bool,
+
+ /// The currently active `SignatureHelp`.
+ /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
+ /// the user navigating through available signatures.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub active_signature_help: Option<SignatureHelp>,
+}
+
+/// Signature help represents the signature of something
+/// callable. There can be multiple signature but only one
+/// active and only one active parameter.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureHelp {
+ /// One or more signatures.
+ pub signatures: Vec<SignatureInformation>,
+
+ /// The active signature.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub active_signature: Option<u32>,
+
+ /// The active parameter of the active signature.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub active_parameter: Option<u32>,
+}
+
+/// Represents the signature of something callable. A signature
+/// can have a label, like a function-name, a doc-comment, and
+/// a set of parameters.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SignatureInformation {
+ /// The label of this signature. Will be shown in
+ /// the UI.
+ pub label: String,
+
+ /// The human-readable doc-comment of this signature. Will be shown
+ /// in the UI but can be omitted.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub documentation: Option<Documentation>,
+
+ /// The parameters of this signature.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub parameters: Option<Vec<ParameterInformation>>,
+
+ /// The index of the active parameter.
+ ///
+ /// If provided, this is used in place of `SignatureHelp.activeParameter`.
+ ///
+ /// @since 3.16.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub active_parameter: Option<u32>,
+}
+
+/// Represents a parameter of a callable-signature. A parameter can
+/// have a label and a doc-comment.
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ParameterInformation {
+ /// The label of this parameter information.
+ ///
+ /// Either a string or an inclusive start and exclusive end offsets within its containing
+ /// signature label. (see SignatureInformation.label). *Note*: A label of type string must be
+ /// a substring of its containing signature label.
+ pub label: ParameterLabel,
+
+ /// The human-readable doc-comment of this parameter. Will be shown
+ /// in the UI but can be omitted.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub documentation: Option<Documentation>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum ParameterLabel {
+ Simple(String),
+ LabelOffsets([u32; 2]),
+}
diff --git a/vendor/lsp-types/src/trace.rs b/vendor/lsp-types/src/trace.rs
index 3272925bb..7cd42de07 100644
--- a/vendor/lsp-types/src/trace.rs
+++ b/vendor/lsp-types/src/trace.rs
@@ -1,82 +1,82 @@
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct SetTraceParams {
- /// The new value that should be assigned to the trace setting.
- pub value: TraceValue,
-}
-
-/// A TraceValue represents the level of verbosity with which the server systematically
-/// reports its execution trace using `LogTrace` notifications.
-///
-/// The initial trace value is set by the client at initialization and can be modified
-/// later using the `SetTrace` notification.
-#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub enum TraceValue {
- /// The server should not send any `$/logTrace` notification
- Off,
- /// The server should not add the 'verbose' field in the `LogTraceParams`
- Messages,
- Verbose,
-}
-
-impl Default for TraceValue {
- fn default() -> TraceValue {
- TraceValue::Off
- }
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct LogTraceParams {
- /// The message to be logged.
- pub message: String,
- /// Additional information that can be computed if the `trace` configuration
- /// is set to `'verbose'`
- #[serde(skip_serializing_if = "Option::is_none")]
- pub verbose: Option<String>,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::tests::test_serialization;
-
- #[test]
- fn test_set_trace_params() {
- test_serialization(
- &SetTraceParams {
- value: TraceValue::Off,
- },
- r#"{"value":"off"}"#,
- );
- }
-
- #[test]
- fn test_log_trace_params() {
- test_serialization(
- &LogTraceParams {
- message: "message".into(),
- verbose: None,
- },
- r#"{"message":"message"}"#,
- );
-
- test_serialization(
- &LogTraceParams {
- message: "message".into(),
- verbose: Some("verbose".into()),
- },
- r#"{"message":"message","verbose":"verbose"}"#,
- );
- }
-
- #[test]
- fn test_trace_value() {
- test_serialization(
- &vec![TraceValue::Off, TraceValue::Messages, TraceValue::Verbose],
- r#"["off","messages","verbose"]"#,
- );
- }
-}
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct SetTraceParams {
+ /// The new value that should be assigned to the trace setting.
+ pub value: TraceValue,
+}
+
+/// A TraceValue represents the level of verbosity with which the server systematically
+/// reports its execution trace using `LogTrace` notifications.
+///
+/// The initial trace value is set by the client at initialization and can be modified
+/// later using the `SetTrace` notification.
+#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum TraceValue {
+ /// The server should not send any `$/logTrace` notification
+ Off,
+ /// The server should not add the 'verbose' field in the `LogTraceParams`
+ Messages,
+ Verbose,
+}
+
+impl Default for TraceValue {
+ fn default() -> TraceValue {
+ TraceValue::Off
+ }
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LogTraceParams {
+ /// The message to be logged.
+ pub message: String,
+ /// Additional information that can be computed if the `trace` configuration
+ /// is set to `'verbose'`
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub verbose: Option<String>,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::tests::test_serialization;
+
+ #[test]
+ fn test_set_trace_params() {
+ test_serialization(
+ &SetTraceParams {
+ value: TraceValue::Off,
+ },
+ r#"{"value":"off"}"#,
+ );
+ }
+
+ #[test]
+ fn test_log_trace_params() {
+ test_serialization(
+ &LogTraceParams {
+ message: "message".into(),
+ verbose: None,
+ },
+ r#"{"message":"message"}"#,
+ );
+
+ test_serialization(
+ &LogTraceParams {
+ message: "message".into(),
+ verbose: Some("verbose".into()),
+ },
+ r#"{"message":"message","verbose":"verbose"}"#,
+ );
+ }
+
+ #[test]
+ fn test_trace_value() {
+ test_serialization(
+ &vec![TraceValue::Off, TraceValue::Messages, TraceValue::Verbose],
+ r#"["off","messages","verbose"]"#,
+ );
+ }
+}
diff --git a/vendor/lsp-types/src/type_hierarchy.rs b/vendor/lsp-types/src/type_hierarchy.rs
new file mode 100644
index 000000000..6cc9812ba
--- /dev/null
+++ b/vendor/lsp-types/src/type_hierarchy.rs
@@ -0,0 +1,90 @@
+use crate::{
+ DynamicRegistrationClientCapabilities, LSPAny, PartialResultParams, Range,
+ StaticRegistrationOptions, SymbolKind, SymbolTag, TextDocumentPositionParams,
+ TextDocumentRegistrationOptions, Url, WorkDoneProgressOptions, WorkDoneProgressParams,
+};
+
+use serde::{Deserialize, Serialize};
+
+pub type TypeHierarchyClientCapabilities = DynamicRegistrationClientCapabilities;
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct TypeHierarchyOptions {
+ #[serde(flatten)]
+ pub work_done_progress_options: WorkDoneProgressOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct TypeHierarchyRegistrationOptions {
+ #[serde(flatten)]
+ pub text_document_registration_options: TextDocumentRegistrationOptions,
+ #[serde(flatten)]
+ pub type_hierarchy_options: TypeHierarchyOptions,
+ #[serde(flatten)]
+ pub static_registration_options: StaticRegistrationOptions,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct TypeHierarchyPrepareParams {
+ #[serde(flatten)]
+ pub text_document_position_params: TextDocumentPositionParams,
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct TypeHierarchySupertypesParams {
+ pub item: TypeHierarchyItem,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct TypeHierarchySubtypesParams {
+ pub item: TypeHierarchyItem,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TypeHierarchyItem {
+ /// The name of this item.
+ pub name: String,
+
+ /// The kind of this item.
+ pub kind: SymbolKind,
+
+ /// Tags for this item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<SymbolTag>,
+
+ /// More detail for this item, e.g. the signature of a function.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub detail: Option<String>,
+
+ /// The resource identifier of this item.
+ pub uri: Url,
+
+ /// The range enclosing this symbol not including leading/trailing whitespace
+ /// but everything else, e.g. comments and code.
+ pub range: Range,
+
+ /// The range that should be selected and revealed when this symbol is being
+ /// picked, e.g. the name of a function. Must be contained by the
+ /// [`range`](#TypeHierarchyItem.range).
+ pub selection_range: Range,
+
+ /// A data entry field that is preserved between a type hierarchy prepare and
+ /// supertypes or subtypes requests. It could also be used to identify the
+ /// type hierarchy in the server, helping improve the performance on
+ /// resolving supertypes and subtypes.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<LSPAny>,
+}
diff --git a/vendor/lsp-types/src/window.rs b/vendor/lsp-types/src/window.rs
index 89d28aaaf..d4dbdf169 100644
--- a/vendor/lsp-types/src/window.rs
+++ b/vendor/lsp-types/src/window.rs
@@ -1,176 +1,176 @@
-use std::collections::HashMap;
-
-use serde::{Deserialize, Serialize};
-
-use serde_json::Value;
-
-use url::Url;
-
-use crate::Range;
-
-#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
-#[serde(transparent)]
-pub struct MessageType(i32);
-lsp_enum! {
-impl MessageType {
- /// An error message.
- pub const ERROR: MessageType = MessageType(1);
- /// A warning message.
- pub const WARNING: MessageType = MessageType(2);
- /// An information message;
- pub const INFO: MessageType = MessageType(3);
- /// A log message.
- pub const LOG: MessageType = MessageType(4);
-}
-}
-
-/// Window specific client capabilities.
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WindowClientCapabilities {
- /// Whether client supports handling progress notifications. If set
- /// servers are allowed to report in `workDoneProgress` property in the
- /// request specific server capabilities.
- ///
- /// @since 3.15.0
- #[serde(skip_serializing_if = "Option::is_none")]
- pub work_done_progress: Option<bool>,
-
- /// Capabilities specific to the showMessage request.
- ///
- /// @since 3.16.0
- ///
- #[serde(skip_serializing_if = "Option::is_none")]
- pub show_message: Option<ShowMessageRequestClientCapabilities>,
-
- /// Client capabilities for the show document request.
- ///
- /// @since 3.16.0
- ///
- #[serde(skip_serializing_if = "Option::is_none")]
- pub show_document: Option<ShowDocumentClientCapabilities>,
-}
-
-/// Show message request client capabilities
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ShowMessageRequestClientCapabilities {
- /// Capabilities specific to the `MessageActionItem` type.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub message_action_item: Option<MessageActionItemCapabilities>,
-}
-
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MessageActionItemCapabilities {
- /// Whether the client supports additional attribues which
- /// are preserved and send back to the server in the
- /// request's response.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub additional_properties_support: Option<bool>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct MessageActionItem {
- /// A short title like 'Retry', 'Open Log' etc.
- pub title: String,
-
- /// Additional attributes that the client preserves and
- /// sends back to the server. This depends on the client
- /// capability window.messageActionItem.additionalPropertiesSupport
- #[serde(flatten)]
- pub properties: HashMap<String, MessageActionItemProperty>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(untagged)]
-pub enum MessageActionItemProperty {
- String(String),
- Boolean(bool),
- Integer(i32),
- Object(Value),
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct LogMessageParams {
- /// The message type. See {@link MessageType}
- #[serde(rename = "type")]
- pub typ: MessageType,
-
- /// The actual message
- pub message: String,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct ShowMessageParams {
- /// The message type. See {@link MessageType}.
- #[serde(rename = "type")]
- pub typ: MessageType,
-
- /// The actual message.
- pub message: String,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-pub struct ShowMessageRequestParams {
- /// The message type. See {@link MessageType}
- #[serde(rename = "type")]
- pub typ: MessageType,
-
- /// The actual message
- pub message: String,
-
- /// The message action items to present.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub actions: Option<Vec<MessageActionItem>>,
-}
-
-/// Client capabilities for the show document request.
-#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ShowDocumentClientCapabilities {
- /// The client has support for the show document request.
- pub support: bool,
-}
-
-/// Params to show a document.
-///
-/// @since 3.16.0
-///
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ShowDocumentParams {
- /// The document uri to show.
- pub uri: Url,
-
- /// Indicates to show the resource in an external program.
- /// To show for example `https://code.visualstudio.com/`
- /// in the default WEB browser set `external` to `true`.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub external: Option<bool>,
-
- /// An optional property to indicate whether the editor
- /// showing the document should take focus or not.
- /// Clients might ignore this property if an external
- /// program in started.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub take_focus: Option<bool>,
-
- /// An optional selection range if the document is a text
- /// document. Clients might ignore the property if an
- /// external program is started or the file is not a text
- /// file.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub selection: Option<Range>,
-}
-
-/// The result of an show document request.
-///
-/// @since 3.16.0
-#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ShowDocumentResult {
- /// A boolean indicating if the show was successful.
- pub success: bool,
-}
+use std::collections::HashMap;
+
+use serde::{Deserialize, Serialize};
+
+use serde_json::Value;
+
+use url::Url;
+
+use crate::Range;
+
+#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
+#[serde(transparent)]
+pub struct MessageType(i32);
+lsp_enum! {
+impl MessageType {
+ /// An error message.
+ pub const ERROR: MessageType = MessageType(1);
+ /// A warning message.
+ pub const WARNING: MessageType = MessageType(2);
+ /// An information message;
+ pub const INFO: MessageType = MessageType(3);
+ /// A log message.
+ pub const LOG: MessageType = MessageType(4);
+}
+}
+
+/// Window specific client capabilities.
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WindowClientCapabilities {
+ /// Whether client supports handling progress notifications. If set
+ /// servers are allowed to report in `workDoneProgress` property in the
+ /// request specific server capabilities.
+ ///
+ /// @since 3.15.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub work_done_progress: Option<bool>,
+
+ /// Capabilities specific to the showMessage request.
+ ///
+ /// @since 3.16.0
+ ///
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub show_message: Option<ShowMessageRequestClientCapabilities>,
+
+ /// Client capabilities for the show document request.
+ ///
+ /// @since 3.16.0
+ ///
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub show_document: Option<ShowDocumentClientCapabilities>,
+}
+
+/// Show message request client capabilities
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShowMessageRequestClientCapabilities {
+ /// Capabilities specific to the `MessageActionItem` type.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub message_action_item: Option<MessageActionItemCapabilities>,
+}
+
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MessageActionItemCapabilities {
+ /// Whether the client supports additional attribues which
+ /// are preserved and send back to the server in the
+ /// request's response.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub additional_properties_support: Option<bool>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MessageActionItem {
+ /// A short title like 'Retry', 'Open Log' etc.
+ pub title: String,
+
+ /// Additional attributes that the client preserves and
+ /// sends back to the server. This depends on the client
+ /// capability window.messageActionItem.additionalPropertiesSupport
+ #[serde(flatten)]
+ pub properties: HashMap<String, MessageActionItemProperty>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum MessageActionItemProperty {
+ String(String),
+ Boolean(bool),
+ Integer(i32),
+ Object(Value),
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct LogMessageParams {
+ /// The message type. See {@link MessageType}
+ #[serde(rename = "type")]
+ pub typ: MessageType,
+
+ /// The actual message
+ pub message: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct ShowMessageParams {
+ /// The message type. See {@link MessageType}.
+ #[serde(rename = "type")]
+ pub typ: MessageType,
+
+ /// The actual message.
+ pub message: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct ShowMessageRequestParams {
+ /// The message type. See {@link MessageType}
+ #[serde(rename = "type")]
+ pub typ: MessageType,
+
+ /// The actual message
+ pub message: String,
+
+ /// The message action items to present.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub actions: Option<Vec<MessageActionItem>>,
+}
+
+/// Client capabilities for the show document request.
+#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShowDocumentClientCapabilities {
+ /// The client has support for the show document request.
+ pub support: bool,
+}
+
+/// Params to show a document.
+///
+/// @since 3.16.0
+///
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShowDocumentParams {
+ /// The document uri to show.
+ pub uri: Url,
+
+ /// Indicates to show the resource in an external program.
+ /// To show for example `https://code.visualstudio.com/`
+ /// in the default WEB browser set `external` to `true`.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub external: Option<bool>,
+
+ /// An optional property to indicate whether the editor
+ /// showing the document should take focus or not.
+ /// Clients might ignore this property if an external
+ /// program in started.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub take_focus: Option<bool>,
+
+ /// An optional selection range if the document is a text
+ /// document. Clients might ignore the property if an
+ /// external program is started or the file is not a text
+ /// file.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub selection: Option<Range>,
+}
+
+/// The result of an show document request.
+///
+/// @since 3.16.0
+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ShowDocumentResult {
+ /// A boolean indicating if the show was successful.
+ pub success: bool,
+}
diff --git a/vendor/lsp-types/src/workspace_folders.rs b/vendor/lsp-types/src/workspace_folders.rs
index ae30d3a0b..677e6f696 100644
--- a/vendor/lsp-types/src/workspace_folders.rs
+++ b/vendor/lsp-types/src/workspace_folders.rs
@@ -1,49 +1,49 @@
-use serde::{Deserialize, Serialize};
-use url::Url;
-
-use crate::OneOf;
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceFoldersServerCapabilities {
- /// The server has support for workspace folders
- #[serde(skip_serializing_if = "Option::is_none")]
- pub supported: Option<bool>,
-
- /// Whether the server wants to receive workspace folder
- /// change notifications.
- ///
- /// If a string is provided, the string is treated as an ID
- /// under which the notification is registered on the client
- /// side. The ID can be used to unregister for these events
- /// using the `client/unregisterCapability` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub change_notifications: Option<OneOf<bool, String>>,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceFolder {
- /// The associated URI for this workspace folder.
- pub uri: Url,
- /// The name of the workspace folder. Defaults to the uri's basename.
- pub name: String,
-}
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DidChangeWorkspaceFoldersParams {
- /// The actual workspace folder change event.
- pub event: WorkspaceFoldersChangeEvent,
-}
-
-/// The workspace folder change event.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceFoldersChangeEvent {
- /// The array of added workspace folders
- pub added: Vec<WorkspaceFolder>,
-
- /// The array of the removed workspace folders
- pub removed: Vec<WorkspaceFolder>,
-}
+use serde::{Deserialize, Serialize};
+use url::Url;
+
+use crate::OneOf;
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceFoldersServerCapabilities {
+ /// The server has support for workspace folders
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub supported: Option<bool>,
+
+ /// Whether the server wants to receive workspace folder
+ /// change notifications.
+ ///
+ /// If a string is provided, the string is treated as an ID
+ /// under which the notification is registered on the client
+ /// side. The ID can be used to unregister for these events
+ /// using the `client/unregisterCapability` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub change_notifications: Option<OneOf<bool, String>>,
+}
+
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceFolder {
+ /// The associated URI for this workspace folder.
+ pub uri: Url,
+ /// The name of the workspace folder. Defaults to the uri's basename.
+ pub name: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DidChangeWorkspaceFoldersParams {
+ /// The actual workspace folder change event.
+ pub event: WorkspaceFoldersChangeEvent,
+}
+
+/// The workspace folder change event.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceFoldersChangeEvent {
+ /// The array of added workspace folders
+ pub added: Vec<WorkspaceFolder>,
+
+ /// The array of the removed workspace folders
+ pub removed: Vec<WorkspaceFolder>,
+}
diff --git a/vendor/lsp-types/src/workspace_symbols.rs b/vendor/lsp-types/src/workspace_symbols.rs
index 6b4143a54..8540bb46f 100644
--- a/vendor/lsp-types/src/workspace_symbols.rs
+++ b/vendor/lsp-types/src/workspace_symbols.rs
@@ -1,42 +1,106 @@
-use crate::{PartialResultParams, SymbolKindCapability, WorkDoneProgressParams};
-
-use crate::{SymbolTag, TagSupport};
-
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct WorkspaceSymbolClientCapabilities {
- /// This capability supports dynamic registration.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub dynamic_registration: Option<bool>,
-
- /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
- #[serde(skip_serializing_if = "Option::is_none")]
- pub symbol_kind: Option<SymbolKindCapability>,
-
- /// The client supports tags on `SymbolInformation`.
- /// Clients supporting tags have to handle unknown tags gracefully.
- ///
- /// @since 3.16.0
- ///
- #[serde(
- default,
- skip_serializing_if = "Option::is_none",
- deserialize_with = "TagSupport::deserialize_compat"
- )]
- pub tag_support: Option<TagSupport<SymbolTag>>,
-}
-
-/// The parameters of a Workspace Symbol Request.
-#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
-pub struct WorkspaceSymbolParams {
- #[serde(flatten)]
- pub partial_result_params: PartialResultParams,
-
- #[serde(flatten)]
- pub work_done_progress_params: WorkDoneProgressParams,
-
- /// A non-empty query string
- pub query: String,
-}
+use crate::{
+ LSPAny, Location, OneOf, PartialResultParams, SymbolInformation, SymbolKind,
+ SymbolKindCapability, SymbolTag, TagSupport, Url, WorkDoneProgressParams,
+};
+
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceSymbolClientCapabilities {
+ /// This capability supports dynamic registration.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub dynamic_registration: Option<bool>,
+
+ /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub symbol_kind: Option<SymbolKindCapability>,
+
+ /// The client supports tags on `SymbolInformation`.
+ /// Clients supporting tags have to handle unknown tags gracefully.
+ ///
+ /// @since 3.16.0
+ ///
+ #[serde(
+ default,
+ skip_serializing_if = "Option::is_none",
+ deserialize_with = "TagSupport::deserialize_compat"
+ )]
+ pub tag_support: Option<TagSupport<SymbolTag>>,
+
+ /// The client support partial workspace symbols. The client will send the
+ /// request `workspaceSymbol/resolve` to the server to resolve additional
+ /// properties.
+ ///
+ /// @since 3.17.0
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub resolve_support: Option<WorkspaceSymbolResolveSupportCapability>,
+}
+
+/// The parameters of a Workspace Symbol Request.
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct WorkspaceSymbolParams {
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ /// A non-empty query string
+ pub query: String,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+pub struct WorkspaceSymbolResolveSupportCapability {
+ /// The properties that a client can resolve lazily. Usually
+ /// `location.range`
+ pub properties: Vec<String>,
+}
+
+/// A special workspace symbol that supports locations without a range
+///
+/// @since 3.17.0
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceSymbol {
+ /// The name of this symbol.
+ pub name: String,
+
+ /// The kind of this symbol.
+ pub kind: SymbolKind,
+
+ /// Tags for this completion item.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tags: Option<Vec<SymbolTag>>,
+
+ /// The name of the symbol containing this symbol. This information is for
+ /// user interface purposes (e.g. to render a qualifier in the user interface
+ /// if necessary). It can't be used to re-infer a hierarchy for the document
+ /// symbols.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub container_name: Option<String>,
+
+ /// The location of this symbol. Whether a server is allowed to
+ /// return a location without a range depends on the client
+ /// capability `workspace.symbol.resolveSupport`.
+ ///
+ /// See also `SymbolInformation.location`.
+ pub location: OneOf<Location, WorkspaceLocation>,
+
+ /// A data entry field that is preserved on a workspace symbol between a
+ /// workspace symbol request and a workspace symbol resolve request.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub data: Option<LSPAny>,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+pub struct WorkspaceLocation {
+ pub uri: Url,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum WorkspaceSymbolResponse {
+ Flat(Vec<SymbolInformation>),
+ Nested(Vec<WorkspaceSymbol>),
+}
diff --git a/vendor/lsp-types/tests/lsif.rs b/vendor/lsp-types/tests/lsif.rs
index dd4a7230a..9f5c97798 100644
--- a/vendor/lsp-types/tests/lsif.rs
+++ b/vendor/lsp-types/tests/lsif.rs
@@ -1,16 +1,16 @@
-use lsp_types::lsif::Entry;
-
-#[test]
-#[cfg(unix)]
-fn run() {
- let jsonl = include_str!("tsc-unix.lsif");
- for json in jsonl.lines() {
- let r = serde_json::from_str::<Entry>(&json).expect(&format!("can not parse {}", json));
- let x = serde_json::to_string(&r).expect(&format!("can not serialize {}", json));
- assert_eq!(
- serde_json::from_str::<serde_json::Value>(&x).unwrap(),
- serde_json::from_str::<serde_json::Value>(json).unwrap(),
- "and strings:\ntheir: {}\n our: {}", json, x,
- );
- }
-}
+use lsp_types::lsif::Entry;
+
+#[test]
+#[cfg(unix)]
+fn run() {
+ let jsonl = include_str!("tsc-unix.lsif");
+ for json in jsonl.lines() {
+ let r = serde_json::from_str::<Entry>(&json).expect(&format!("can not parse {}", json));
+ let x = serde_json::to_string(&r).expect(&format!("can not serialize {}", json));
+ assert_eq!(
+ serde_json::from_str::<serde_json::Value>(&x).unwrap(),
+ serde_json::from_str::<serde_json::Value>(json).unwrap(),
+ "and strings:\ntheir: {}\n our: {}", json, x,
+ );
+ }
+}
diff --git a/vendor/lsp-types/tests/tsc-unix.lsif b/vendor/lsp-types/tests/tsc-unix.lsif
index 24c4dc046..27f6d5135 100644
--- a/vendor/lsp-types/tests/tsc-unix.lsif
+++ b/vendor/lsp-types/tests/tsc-unix.lsif
@@ -1,135 +1,135 @@
-{"id":1,"type":"vertex","label":"metaData","version":"0.4.3","projectRoot":"file:///media/hamid/nv1/garbage","positionEncoding":"utf-16","toolInfo":{"name":"lsif-tsc","args":["-p","."],"version":"0.7.2"}}
-{"id":2,"type":"vertex","label":"project","kind":"typescript"}
-{"id":3,"type":"vertex","label":"$event","kind":"begin","scope":"project","data":2}
-{"id":4,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/a.ts","languageId":"typescript"}
-{"id":5,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":4}
-{"id":6,"type":"vertex","label":"resultSet"}
-{"id":7,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"a:"}
-{"id":8,"type":"edge","label":"moniker","outV":6,"inV":7}
-{"id":9,"type":"vertex","label":"packageInformation","name":"garbage","manager":"npm","version":"1.0.0"}
-{"id":10,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:a:"}
-{"id":11,"type":"edge","label":"packageInformation","outV":10,"inV":9}
-{"id":12,"type":"edge","label":"nextMoniker","outV":7,"inV":10}
-{"id":13,"type":"vertex","label":"range","start":{"line":0,"character":0},"end":{"line":0,"character":0},"tag":{"type":"definition","text":"","kind":7,"fullRange":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
-{"id":14,"type":"edge","label":"next","outV":13,"inV":6}
-{"id":15,"type":"vertex","label":"resultSet"}
-{"id":16,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"a:a"}
-{"id":17,"type":"edge","label":"moniker","outV":15,"inV":16}
-{"id":18,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:a:a"}
-{"id":19,"type":"edge","label":"packageInformation","outV":18,"inV":9}
-{"id":20,"type":"edge","label":"nextMoniker","outV":16,"inV":18}
-{"id":21,"type":"vertex","label":"range","start":{"line":0,"character":13},"end":{"line":0,"character":14},"tag":{"type":"definition","text":"a","kind":7,"fullRange":{"start":{"line":0,"character":13},"end":{"line":2,"character":1}}}}
-{"id":22,"type":"edge","label":"next","outV":21,"inV":15}
-{"id":23,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"const a: (x: number, y: string) => string"}]}}
-{"id":24,"type":"edge","label":"textDocument/hover","outV":15,"inV":23}
-{"id":25,"type":"vertex","label":"resultSet"}
-{"id":26,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"dW50H+qRDGdPj+RYWpwLSg=="}
-{"id":27,"type":"edge","label":"moniker","outV":25,"inV":26}
-{"id":28,"type":"vertex","label":"range","start":{"line":0,"character":18},"end":{"line":0,"character":19},"tag":{"type":"definition","text":"x","kind":7,"fullRange":{"start":{"line":0,"character":18},"end":{"line":0,"character":27}}}}
-{"id":29,"type":"edge","label":"next","outV":28,"inV":25}
-{"id":30,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(parameter) x: number"}]}}
-{"id":31,"type":"edge","label":"textDocument/hover","outV":25,"inV":30}
-{"id":32,"type":"vertex","label":"resultSet"}
-{"id":33,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"W2CLXh2PW8+ib7xga5YF4A=="}
-{"id":34,"type":"edge","label":"moniker","outV":32,"inV":33}
-{"id":35,"type":"vertex","label":"range","start":{"line":0,"character":29},"end":{"line":0,"character":30},"tag":{"type":"definition","text":"y","kind":7,"fullRange":{"start":{"line":0,"character":29},"end":{"line":0,"character":38}}}}
-{"id":36,"type":"edge","label":"next","outV":35,"inV":32}
-{"id":37,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(parameter) y: string"}]}}
-{"id":38,"type":"edge","label":"textDocument/hover","outV":32,"inV":37}
-{"id":39,"type":"vertex","label":"resultSet"}
-{"id":40,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"WLUBvuhxsSADYrjTwQnBoA=="}
-{"id":41,"type":"edge","label":"moniker","outV":39,"inV":40}
-{"id":42,"type":"vertex","label":"range","start":{"line":0,"character":40},"end":{"line":0,"character":42},"tag":{"type":"reference","text":"=>"}}
-{"id":43,"type":"edge","label":"next","outV":42,"inV":39}
-{"id":44,"type":"vertex","label":"range","start":{"line":1,"character":18},"end":{"line":1,"character":19},"tag":{"type":"reference","text":"y"}}
-{"id":45,"type":"edge","label":"next","outV":44,"inV":32}
-{"id":46,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/node_modules/typescript-lsif/lib/lib.es2015.core.d.ts","languageId":"typescript"}
-{"id":47,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":46}
-{"id":48,"type":"vertex","label":"resultSet"}
-{"id":49,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"node_modules/typescript-lsif/lib/lib.es2015.core:String.repeat"}
-{"id":50,"type":"edge","label":"moniker","outV":48,"inV":49}
-{"id":51,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:node_modules/typescript-lsif/lib/lib.es2015.core:String.repeat"}
-{"id":52,"type":"edge","label":"packageInformation","outV":51,"inV":9}
-{"id":53,"type":"edge","label":"nextMoniker","outV":49,"inV":51}
-{"id":54,"type":"vertex","label":"range","start":{"line":446,"character":4},"end":{"line":446,"character":10},"tag":{"type":"definition","text":"repeat","kind":7,"fullRange":{"start":{"line":446,"character":4},"end":{"line":446,"character":34}}}}
-{"id":55,"type":"edge","label":"next","outV":54,"inV":48}
-{"id":56,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(method) String.repeat(count: number): string"},"Returns a String value that is made from count copies appended together. If count is 0,\nthe empty string is returned."]}}
-{"id":57,"type":"edge","label":"textDocument/hover","outV":48,"inV":56}
-{"id":58,"type":"vertex","label":"range","start":{"line":1,"character":20},"end":{"line":1,"character":26},"tag":{"type":"reference","text":"repeat"}}
-{"id":59,"type":"edge","label":"next","outV":58,"inV":48}
-{"id":60,"type":"vertex","label":"range","start":{"line":1,"character":27},"end":{"line":1,"character":28},"tag":{"type":"reference","text":"x"}}
-{"id":61,"type":"edge","label":"next","outV":60,"inV":25}
-{"id":62,"type":"vertex","label":"definitionResult"}
-{"id":63,"type":"edge","label":"textDocument/definition","outV":6,"inV":62}
-{"id":64,"type":"edge","label":"item","outV":62,"inVs":[13],"document":4}
-{"id":65,"type":"vertex","label":"referenceResult"}
-{"id":66,"type":"edge","label":"textDocument/references","outV":6,"inV":65}
-{"id":67,"type":"edge","label":"item","outV":65,"inVs":[13],"document":4,"property":"definitions"}
-{"id":68,"type":"vertex","label":"definitionResult"}
-{"id":69,"type":"edge","label":"textDocument/definition","outV":15,"inV":68}
-{"id":70,"type":"edge","label":"item","outV":68,"inVs":[21],"document":4}
-{"id":71,"type":"vertex","label":"referenceResult"}
-{"id":72,"type":"edge","label":"textDocument/references","outV":15,"inV":71}
-{"id":73,"type":"edge","label":"item","outV":71,"inVs":[21],"document":4,"property":"definitions"}
-{"id":74,"type":"vertex","label":"definitionResult"}
-{"id":75,"type":"edge","label":"textDocument/definition","outV":25,"inV":74}
-{"id":76,"type":"edge","label":"item","outV":74,"inVs":[28],"document":4}
-{"id":77,"type":"vertex","label":"referenceResult"}
-{"id":78,"type":"edge","label":"textDocument/references","outV":25,"inV":77}
-{"id":79,"type":"edge","label":"item","outV":77,"inVs":[28],"document":4,"property":"definitions"}
-{"id":80,"type":"edge","label":"item","outV":77,"inVs":[60],"document":4,"property":"references"}
-{"id":81,"type":"vertex","label":"definitionResult"}
-{"id":82,"type":"edge","label":"textDocument/definition","outV":32,"inV":81}
-{"id":83,"type":"edge","label":"item","outV":81,"inVs":[35],"document":4}
-{"id":84,"type":"vertex","label":"referenceResult"}
-{"id":85,"type":"edge","label":"textDocument/references","outV":32,"inV":84}
-{"id":86,"type":"edge","label":"item","outV":84,"inVs":[35],"document":4,"property":"definitions"}
-{"id":87,"type":"edge","label":"item","outV":84,"inVs":[44],"document":4,"property":"references"}
-{"id":88,"type":"vertex","label":"referenceResult"}
-{"id":89,"type":"edge","label":"textDocument/references","outV":39,"inV":88}
-{"id":90,"type":"edge","label":"item","outV":88,"inVs":[42],"document":4,"property":"references"}
-{"id":91,"type":"vertex","label":"referenceResult"}
-{"id":92,"type":"edge","label":"textDocument/references","outV":48,"inV":91}
-{"id":93,"type":"edge","label":"item","outV":91,"inVs":[58],"document":4,"property":"references"}
-{"id":94,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/b.ts","languageId":"typescript"}
-{"id":95,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":94}
-{"id":96,"type":"vertex","label":"resultSet"}
-{"id":97,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"b:"}
-{"id":98,"type":"edge","label":"moniker","outV":96,"inV":97}
-{"id":99,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:b:"}
-{"id":100,"type":"edge","label":"packageInformation","outV":99,"inV":9}
-{"id":101,"type":"edge","label":"nextMoniker","outV":97,"inV":99}
-{"id":102,"type":"vertex","label":"range","start":{"line":0,"character":0},"end":{"line":0,"character":0},"tag":{"type":"definition","text":"","kind":7,"fullRange":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
-{"id":103,"type":"edge","label":"next","outV":102,"inV":96}
-{"id":104,"type":"vertex","label":"resultSet"}
-{"id":105,"type":"edge","label":"next","outV":104,"inV":15}
-{"id":106,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"sNwThRvTZlfLwz6po1s2Zg=="}
-{"id":107,"type":"edge","label":"moniker","outV":104,"inV":106}
-{"id":108,"type":"vertex","label":"range","start":{"line":0,"character":9},"end":{"line":0,"character":10},"tag":{"type":"definition","text":"a","kind":7,"fullRange":{"start":{"line":0,"character":9},"end":{"line":0,"character":10}}}}
-{"id":109,"type":"edge","label":"next","outV":108,"inV":104}
-{"id":110,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(alias) const a: (x: number, y: string) => string\nimport a"}]}}
-{"id":111,"type":"edge","label":"textDocument/hover","outV":104,"inV":110}
-{"id":112,"type":"vertex","label":"range","start":{"line":0,"character":18},"end":{"line":0,"character":23},"tag":{"type":"reference","text":"\"./a\""}}
-{"id":113,"type":"edge","label":"next","outV":112,"inV":6}
-{"id":114,"type":"vertex","label":"range","start":{"line":2,"character":0},"end":{"line":2,"character":1},"tag":{"type":"reference","text":"a"}}
-{"id":115,"type":"edge","label":"next","outV":114,"inV":104}
-{"id":116,"type":"vertex","label":"definitionResult"}
-{"id":117,"type":"edge","label":"textDocument/definition","outV":96,"inV":116}
-{"id":118,"type":"edge","label":"item","outV":116,"inVs":[102],"document":94}
-{"id":119,"type":"vertex","label":"referenceResult"}
-{"id":120,"type":"edge","label":"textDocument/references","outV":96,"inV":119}
-{"id":121,"type":"edge","label":"item","outV":119,"inVs":[102],"document":94,"property":"definitions"}
-{"id":122,"type":"edge","label":"item","outV":71,"inVs":[108,114],"document":94,"property":"references"}
-{"id":123,"type":"edge","label":"item","outV":65,"inVs":[112],"document":94,"property":"references"}
-{"id":124,"type":"vertex","label":"definitionResult"}
-{"id":125,"type":"edge","label":"textDocument/definition","outV":48,"inV":124}
-{"id":126,"type":"edge","label":"item","outV":124,"inVs":[54],"document":46}
-{"id":127,"type":"edge","label":"item","outV":91,"inVs":[54],"document":46,"property":"definitions"}
-{"id":128,"type":"edge","label":"contains","outV":4,"inVs":[13,21,28,35,42,44,58,60]}
-{"id":129,"type":"vertex","label":"$event","kind":"end","scope":"document","data":4}
-{"id":130,"type":"edge","label":"contains","outV":46,"inVs":[54]}
-{"id":131,"type":"vertex","label":"$event","kind":"end","scope":"document","data":46}
-{"id":132,"type":"edge","label":"contains","outV":94,"inVs":[102,108,112,114]}
-{"id":133,"type":"vertex","label":"$event","kind":"end","scope":"document","data":94}
-{"id":134,"type":"edge","label":"contains","outV":2,"inVs":[4,46,94]}
-{"id":135,"type":"vertex","label":"$event","kind":"end","scope":"project","data":2}
+{"id":1,"type":"vertex","label":"metaData","version":"0.4.3","projectRoot":"file:///media/hamid/nv1/garbage","positionEncoding":"utf-16","toolInfo":{"name":"lsif-tsc","args":["-p","."],"version":"0.7.2"}}
+{"id":2,"type":"vertex","label":"project","kind":"typescript"}
+{"id":3,"type":"vertex","label":"$event","kind":"begin","scope":"project","data":2}
+{"id":4,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/a.ts","languageId":"typescript"}
+{"id":5,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":4}
+{"id":6,"type":"vertex","label":"resultSet"}
+{"id":7,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"a:"}
+{"id":8,"type":"edge","label":"moniker","outV":6,"inV":7}
+{"id":9,"type":"vertex","label":"packageInformation","name":"garbage","manager":"npm","version":"1.0.0"}
+{"id":10,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:a:"}
+{"id":11,"type":"edge","label":"packageInformation","outV":10,"inV":9}
+{"id":12,"type":"edge","label":"nextMoniker","outV":7,"inV":10}
+{"id":13,"type":"vertex","label":"range","start":{"line":0,"character":0},"end":{"line":0,"character":0},"tag":{"type":"definition","text":"","kind":7,"fullRange":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
+{"id":14,"type":"edge","label":"next","outV":13,"inV":6}
+{"id":15,"type":"vertex","label":"resultSet"}
+{"id":16,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"a:a"}
+{"id":17,"type":"edge","label":"moniker","outV":15,"inV":16}
+{"id":18,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:a:a"}
+{"id":19,"type":"edge","label":"packageInformation","outV":18,"inV":9}
+{"id":20,"type":"edge","label":"nextMoniker","outV":16,"inV":18}
+{"id":21,"type":"vertex","label":"range","start":{"line":0,"character":13},"end":{"line":0,"character":14},"tag":{"type":"definition","text":"a","kind":7,"fullRange":{"start":{"line":0,"character":13},"end":{"line":2,"character":1}}}}
+{"id":22,"type":"edge","label":"next","outV":21,"inV":15}
+{"id":23,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"const a: (x: number, y: string) => string"}]}}
+{"id":24,"type":"edge","label":"textDocument/hover","outV":15,"inV":23}
+{"id":25,"type":"vertex","label":"resultSet"}
+{"id":26,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"dW50H+qRDGdPj+RYWpwLSg=="}
+{"id":27,"type":"edge","label":"moniker","outV":25,"inV":26}
+{"id":28,"type":"vertex","label":"range","start":{"line":0,"character":18},"end":{"line":0,"character":19},"tag":{"type":"definition","text":"x","kind":7,"fullRange":{"start":{"line":0,"character":18},"end":{"line":0,"character":27}}}}
+{"id":29,"type":"edge","label":"next","outV":28,"inV":25}
+{"id":30,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(parameter) x: number"}]}}
+{"id":31,"type":"edge","label":"textDocument/hover","outV":25,"inV":30}
+{"id":32,"type":"vertex","label":"resultSet"}
+{"id":33,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"W2CLXh2PW8+ib7xga5YF4A=="}
+{"id":34,"type":"edge","label":"moniker","outV":32,"inV":33}
+{"id":35,"type":"vertex","label":"range","start":{"line":0,"character":29},"end":{"line":0,"character":30},"tag":{"type":"definition","text":"y","kind":7,"fullRange":{"start":{"line":0,"character":29},"end":{"line":0,"character":38}}}}
+{"id":36,"type":"edge","label":"next","outV":35,"inV":32}
+{"id":37,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(parameter) y: string"}]}}
+{"id":38,"type":"edge","label":"textDocument/hover","outV":32,"inV":37}
+{"id":39,"type":"vertex","label":"resultSet"}
+{"id":40,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"WLUBvuhxsSADYrjTwQnBoA=="}
+{"id":41,"type":"edge","label":"moniker","outV":39,"inV":40}
+{"id":42,"type":"vertex","label":"range","start":{"line":0,"character":40},"end":{"line":0,"character":42},"tag":{"type":"reference","text":"=>"}}
+{"id":43,"type":"edge","label":"next","outV":42,"inV":39}
+{"id":44,"type":"vertex","label":"range","start":{"line":1,"character":18},"end":{"line":1,"character":19},"tag":{"type":"reference","text":"y"}}
+{"id":45,"type":"edge","label":"next","outV":44,"inV":32}
+{"id":46,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/node_modules/typescript-lsif/lib/lib.es2015.core.d.ts","languageId":"typescript"}
+{"id":47,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":46}
+{"id":48,"type":"vertex","label":"resultSet"}
+{"id":49,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"node_modules/typescript-lsif/lib/lib.es2015.core:String.repeat"}
+{"id":50,"type":"edge","label":"moniker","outV":48,"inV":49}
+{"id":51,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:node_modules/typescript-lsif/lib/lib.es2015.core:String.repeat"}
+{"id":52,"type":"edge","label":"packageInformation","outV":51,"inV":9}
+{"id":53,"type":"edge","label":"nextMoniker","outV":49,"inV":51}
+{"id":54,"type":"vertex","label":"range","start":{"line":446,"character":4},"end":{"line":446,"character":10},"tag":{"type":"definition","text":"repeat","kind":7,"fullRange":{"start":{"line":446,"character":4},"end":{"line":446,"character":34}}}}
+{"id":55,"type":"edge","label":"next","outV":54,"inV":48}
+{"id":56,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(method) String.repeat(count: number): string"},"Returns a String value that is made from count copies appended together. If count is 0,\nthe empty string is returned."]}}
+{"id":57,"type":"edge","label":"textDocument/hover","outV":48,"inV":56}
+{"id":58,"type":"vertex","label":"range","start":{"line":1,"character":20},"end":{"line":1,"character":26},"tag":{"type":"reference","text":"repeat"}}
+{"id":59,"type":"edge","label":"next","outV":58,"inV":48}
+{"id":60,"type":"vertex","label":"range","start":{"line":1,"character":27},"end":{"line":1,"character":28},"tag":{"type":"reference","text":"x"}}
+{"id":61,"type":"edge","label":"next","outV":60,"inV":25}
+{"id":62,"type":"vertex","label":"definitionResult"}
+{"id":63,"type":"edge","label":"textDocument/definition","outV":6,"inV":62}
+{"id":64,"type":"edge","label":"item","outV":62,"inVs":[13],"document":4}
+{"id":65,"type":"vertex","label":"referenceResult"}
+{"id":66,"type":"edge","label":"textDocument/references","outV":6,"inV":65}
+{"id":67,"type":"edge","label":"item","outV":65,"inVs":[13],"document":4,"property":"definitions"}
+{"id":68,"type":"vertex","label":"definitionResult"}
+{"id":69,"type":"edge","label":"textDocument/definition","outV":15,"inV":68}
+{"id":70,"type":"edge","label":"item","outV":68,"inVs":[21],"document":4}
+{"id":71,"type":"vertex","label":"referenceResult"}
+{"id":72,"type":"edge","label":"textDocument/references","outV":15,"inV":71}
+{"id":73,"type":"edge","label":"item","outV":71,"inVs":[21],"document":4,"property":"definitions"}
+{"id":74,"type":"vertex","label":"definitionResult"}
+{"id":75,"type":"edge","label":"textDocument/definition","outV":25,"inV":74}
+{"id":76,"type":"edge","label":"item","outV":74,"inVs":[28],"document":4}
+{"id":77,"type":"vertex","label":"referenceResult"}
+{"id":78,"type":"edge","label":"textDocument/references","outV":25,"inV":77}
+{"id":79,"type":"edge","label":"item","outV":77,"inVs":[28],"document":4,"property":"definitions"}
+{"id":80,"type":"edge","label":"item","outV":77,"inVs":[60],"document":4,"property":"references"}
+{"id":81,"type":"vertex","label":"definitionResult"}
+{"id":82,"type":"edge","label":"textDocument/definition","outV":32,"inV":81}
+{"id":83,"type":"edge","label":"item","outV":81,"inVs":[35],"document":4}
+{"id":84,"type":"vertex","label":"referenceResult"}
+{"id":85,"type":"edge","label":"textDocument/references","outV":32,"inV":84}
+{"id":86,"type":"edge","label":"item","outV":84,"inVs":[35],"document":4,"property":"definitions"}
+{"id":87,"type":"edge","label":"item","outV":84,"inVs":[44],"document":4,"property":"references"}
+{"id":88,"type":"vertex","label":"referenceResult"}
+{"id":89,"type":"edge","label":"textDocument/references","outV":39,"inV":88}
+{"id":90,"type":"edge","label":"item","outV":88,"inVs":[42],"document":4,"property":"references"}
+{"id":91,"type":"vertex","label":"referenceResult"}
+{"id":92,"type":"edge","label":"textDocument/references","outV":48,"inV":91}
+{"id":93,"type":"edge","label":"item","outV":91,"inVs":[58],"document":4,"property":"references"}
+{"id":94,"type":"vertex","label":"document","uri":"file:///media/hamid/nv1/garbage/b.ts","languageId":"typescript"}
+{"id":95,"type":"vertex","label":"$event","kind":"begin","scope":"document","data":94}
+{"id":96,"type":"vertex","label":"resultSet"}
+{"id":97,"type":"vertex","label":"moniker","kind":"export","unique":"document","scheme":"tsc","identifier":"b:"}
+{"id":98,"type":"edge","label":"moniker","outV":96,"inV":97}
+{"id":99,"type":"vertex","label":"moniker","kind":"export","unique":"global","scheme":"npm","identifier":"garbage:b:"}
+{"id":100,"type":"edge","label":"packageInformation","outV":99,"inV":9}
+{"id":101,"type":"edge","label":"nextMoniker","outV":97,"inV":99}
+{"id":102,"type":"vertex","label":"range","start":{"line":0,"character":0},"end":{"line":0,"character":0},"tag":{"type":"definition","text":"","kind":7,"fullRange":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
+{"id":103,"type":"edge","label":"next","outV":102,"inV":96}
+{"id":104,"type":"vertex","label":"resultSet"}
+{"id":105,"type":"edge","label":"next","outV":104,"inV":15}
+{"id":106,"type":"vertex","label":"moniker","kind":"local","unique":"document","scheme":"tsc","identifier":"sNwThRvTZlfLwz6po1s2Zg=="}
+{"id":107,"type":"edge","label":"moniker","outV":104,"inV":106}
+{"id":108,"type":"vertex","label":"range","start":{"line":0,"character":9},"end":{"line":0,"character":10},"tag":{"type":"definition","text":"a","kind":7,"fullRange":{"start":{"line":0,"character":9},"end":{"line":0,"character":10}}}}
+{"id":109,"type":"edge","label":"next","outV":108,"inV":104}
+{"id":110,"type":"vertex","label":"hoverResult","result":{"contents":[{"language":"typescript","value":"(alias) const a: (x: number, y: string) => string\nimport a"}]}}
+{"id":111,"type":"edge","label":"textDocument/hover","outV":104,"inV":110}
+{"id":112,"type":"vertex","label":"range","start":{"line":0,"character":18},"end":{"line":0,"character":23},"tag":{"type":"reference","text":"\"./a\""}}
+{"id":113,"type":"edge","label":"next","outV":112,"inV":6}
+{"id":114,"type":"vertex","label":"range","start":{"line":2,"character":0},"end":{"line":2,"character":1},"tag":{"type":"reference","text":"a"}}
+{"id":115,"type":"edge","label":"next","outV":114,"inV":104}
+{"id":116,"type":"vertex","label":"definitionResult"}
+{"id":117,"type":"edge","label":"textDocument/definition","outV":96,"inV":116}
+{"id":118,"type":"edge","label":"item","outV":116,"inVs":[102],"document":94}
+{"id":119,"type":"vertex","label":"referenceResult"}
+{"id":120,"type":"edge","label":"textDocument/references","outV":96,"inV":119}
+{"id":121,"type":"edge","label":"item","outV":119,"inVs":[102],"document":94,"property":"definitions"}
+{"id":122,"type":"edge","label":"item","outV":71,"inVs":[108,114],"document":94,"property":"references"}
+{"id":123,"type":"edge","label":"item","outV":65,"inVs":[112],"document":94,"property":"references"}
+{"id":124,"type":"vertex","label":"definitionResult"}
+{"id":125,"type":"edge","label":"textDocument/definition","outV":48,"inV":124}
+{"id":126,"type":"edge","label":"item","outV":124,"inVs":[54],"document":46}
+{"id":127,"type":"edge","label":"item","outV":91,"inVs":[54],"document":46,"property":"definitions"}
+{"id":128,"type":"edge","label":"contains","outV":4,"inVs":[13,21,28,35,42,44,58,60]}
+{"id":129,"type":"vertex","label":"$event","kind":"end","scope":"document","data":4}
+{"id":130,"type":"edge","label":"contains","outV":46,"inVs":[54]}
+{"id":131,"type":"vertex","label":"$event","kind":"end","scope":"document","data":46}
+{"id":132,"type":"edge","label":"contains","outV":94,"inVs":[102,108,112,114]}
+{"id":133,"type":"vertex","label":"$event","kind":"end","scope":"document","data":94}
+{"id":134,"type":"edge","label":"contains","outV":2,"inVs":[4,46,94]}
+{"id":135,"type":"vertex","label":"$event","kind":"end","scope":"project","data":2}