[][src]Attribute Macro lsp_msg_derive::lsp_object

#[lsp_object]

Generates LSP objects from structs.

Specifications

SPEC-lsp_object-serde

lsp_object shall add the Deserialize and Serialize traits..

use lsp_msg_derive::lsp_object;
use serde::{Deserialize, Serialize};
#[lsp_object]
struct LspObj {}

SPEC-lsp_object-allow_missing

If lsp_object receives allow_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 recieves dynamic_registration = "..", a dynamic_registration field with type bool and documentation Supports 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() };

If lsp_object receives link_support = "..", a link_support field with type bool and documentation Supports 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 recieves trigger_characters = "..", a trigger_characters field with type Vec<String> and documentation Characters 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 receives resolve_provider = "..", a resolve_provider field with type bool and documentation Provides 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 receives static_registration, an id field with type Elective<String> and documentation The 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 receives markup_kind_list = "..", a {..}_format field with type Vec<MarkupKind> and documentation The 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};