aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/lib.rs
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2019-11-18 17:02:28 +0000
committerEmil Lauridsen <[email protected]>2019-11-19 16:23:50 +0000
commitdadad36bb9770f9b13ed84bc219ea0168a7a5bf1 (patch)
tree00051540da204b4294501f3c56960975177ae502 /crates/ra_ide_api/src/lib.rs
parentc24ee0990486b04723534f072d7a58e829bbd1bd (diff)
Move type inlay hint truncation to language server
This commit implements a general truncation framework for HirFormatter that keeps track of how much has been output so far. This information can then be used to perform truncation inside the language server, instead of relying on the client. Initial support is implemented for truncating types hints using the maxInlayHintLength server config option. The existing solution in the VSCode extension has been removed in favor of letting the server truncate type hints.
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r--crates/ra_ide_api/src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 110ddcd62..fcb3da90e 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -338,8 +338,14 @@ impl Analysis {
338 } 338 }
339 339
340 /// Returns a list of the places in the file where type hints can be displayed. 340 /// Returns a list of the places in the file where type hints can be displayed.
341 pub fn inlay_hints(&self, file_id: FileId) -> Cancelable<Vec<InlayHint>> { 341 pub fn inlay_hints(
342 self.with_db(|db| inlay_hints::inlay_hints(db, file_id, &db.parse(file_id).tree())) 342 &self,
343 file_id: FileId,
344 max_inlay_hint_length: Option<usize>,
345 ) -> Cancelable<Vec<InlayHint>> {
346 self.with_db(|db| {
347 inlay_hints::inlay_hints(db, file_id, &db.parse(file_id).tree(), max_inlay_hint_length)
348 })
343 } 349 }
344 350
345 /// Returns the set of folding ranges. 351 /// Returns the set of folding ranges.