Move hint settings on the language level

This commit is contained in:
Kirill Bulatov 2023-06-26 23:28:56 +03:00
parent 480d8c511b
commit 667b70afde
7 changed files with 196 additions and 145 deletions

View file

@ -1,5 +1,5 @@
use crate::{
DocumentHighlight, Hover, HoverBlock, HoverBlockKind, InlayHint, InlayHintKind, InlayHintLabel,
DocumentHighlight, Hover, HoverBlock, HoverBlockKind, InlayHint, InlayHintLabel,
InlayHintLabelPart, InlayHintLabelPartTooltip, InlayHintTooltip, Location, LocationLink,
MarkupContent, Project, ProjectTransaction,
};
@ -9,7 +9,7 @@ use client::proto::{self, PeerId};
use fs::LineEnding;
use gpui::{AppContext, AsyncAppContext, ModelHandle};
use language::{
language_settings::language_settings,
language_settings::{language_settings, InlayHintKind},
point_from_lsp, point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, CachedLspAdapter, CharKind, CodeAction,

View file

@ -31,7 +31,7 @@ use gpui::{
};
use itertools::Itertools;
use language::{
language_settings::{language_settings, FormatOnSave, Formatter},
language_settings::{language_settings, FormatOnSave, Formatter, InlayHintKind},
point_to_lsp,
proto::{
deserialize_anchor, deserialize_fingerprint, deserialize_line_ending, deserialize_version,
@ -339,29 +339,6 @@ pub struct InlayHint {
pub tooltip: Option<InlayHintTooltip>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InlayHintKind {
Type,
Parameter,
}
impl InlayHintKind {
pub fn from_name(name: &str) -> Option<Self> {
match name {
"type" => Some(InlayHintKind::Type),
"parameter" => Some(InlayHintKind::Parameter),
_ => None,
}
}
pub fn name(&self) -> &'static str {
match self {
InlayHintKind::Type => "type",
InlayHintKind::Parameter => "parameter",
}
}
}
impl InlayHint {
pub fn text(&self) -> String {
match &self.label {