aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r--crates/ra_project_model/src/lib.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 37845ca56..a5012c0ef 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -16,6 +16,7 @@ use anyhow::{bail, Context, Result};
16use ra_cfg::CfgOptions; 16use ra_cfg::CfgOptions;
17use ra_db::{CrateGraph, CrateName, Edition, Env, FileId}; 17use ra_db::{CrateGraph, CrateName, Edition, Env, FileId};
18use rustc_hash::FxHashMap; 18use rustc_hash::FxHashMap;
19use serde::Deserialize;
19use serde_json::from_reader; 20use serde_json::from_reader;
20 21
21pub use crate::{ 22pub use crate::{
@@ -24,6 +25,34 @@ pub use crate::{
24 sysroot::Sysroot, 25 sysroot::Sysroot,
25}; 26};
26 27
28#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
29#[serde(rename_all = "lowercase")]
30pub enum InlayHintDisplayType {
31 Off,
32 TypeHints,
33 ParameterHints,
34 Full,
35}
36
37#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
38#[serde(rename_all = "camelCase", default)]
39pub struct InlayHintOptions {
40 pub display_type: InlayHintDisplayType,
41 pub max_length: Option<usize>,
42}
43
44impl InlayHintOptions {
45 pub fn new(max_length: Option<usize>) -> Self {
46 Self { display_type: InlayHintDisplayType::Full, max_length }
47 }
48}
49
50impl Default for InlayHintOptions {
51 fn default() -> Self {
52 Self { display_type: InlayHintDisplayType::Full, max_length: None }
53 }
54}
55
27#[derive(Clone, PartialEq, Eq, Hash, Debug)] 56#[derive(Clone, PartialEq, Eq, Hash, Debug)]
28pub struct CargoTomlNotFoundError { 57pub struct CargoTomlNotFoundError {
29 pub searched_at: PathBuf, 58 pub searched_at: PathBuf,