[−][src]Attribute Macro lsp_msg_derive::lsp_object
#[lsp_object]
Generates LSP objects from structs.
Specifications
SPEC-lsp_object-serde
lsp_object
shall add theDeserialize
andSerialize
traits..
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object] struct LspObj {}
SPEC-lsp_object-allow_missing
If
lsp_object
receivesallow_missing
, when deserializing the LSP object, any missing field shall be set to its respective default value.
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object(allow_missing)] struct LspObj {}
SPEC-lsp_object-dynamic_registration
If
lsp_object
recievesdynamic_registration = ".."
, adynamic_registration
field with typebool
and documentationSupports dynamic registration of the {..}.
is added to the LSP object.
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object(dynamic_registration = "test")] struct LspObj {} let lsp_obj = LspObj { dynamic_registration: bool::default() };
SPEC-lsp_object-link_support
If
lsp_object
receiveslink_support = ".."
, alink_support
field with typebool
and documentationSupports additional metadata in the form of {..} links.
is added to the LSP object.
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object(link_support = "test")] struct LspObj {} let lsp_obj = LspObj { link_support: bool::default() };
SPEC-lsp_object-trigger_characters
If
lsp_object
recievestrigger_characters = ".."
, atrigger_characters
field with typeVec<String>
and documentationCharacters that trigger {..} automatically.
is added to the LSP object.
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object(trigger_characters = "test")] struct LspObj {} let lsp_obj = LspObj { trigger_characters: vec![String::default()] };
SPEC-lsp_object-resolve_provider
If
lsp_object
receivesresolve_provider = ".."
, aresolve_provider
field with typebool
and documentationProvides support to resolve additional information for a {..} item.
is added to the **LSP object.
use lsp_msg_derive::lsp_object; use serde::{Deserialize, Serialize}; #[lsp_object(resolve_provider = "test")] struct LspObj {} let lsp_obj = LspObj { resolve_provider: bool::default() };
SPEC-lsp_object-static_registration
If
lsp_object
receivesstatic_registration
, anid
field with typeElective<String>
and documentationThe id used to register the request.
is added to the LSP object.
use lsp_msg_derive::lsp_object; use lsp_msg_internal::Elective; use serde::{Deserialize, Serialize};
SPEC-lsp_object-markup_kind_list
If
lsp_object
receivesmarkup_kind_list = ".."
, a{..}_format
field with typeVec<MarkupKind>
and documentationThe supported `MarkupKind`s for the `{..}` property.\n\nThe order describes the preferred format.
is added to the LSP object.
use lsp_msg_derive::lsp_object; use lsp_msg_internal::MarkupKind; use serde::{Deserialize, Serialize};