1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::datamodel_connector::format_completion_docs;
use lsp_types::{
    CompletionItem, CompletionItemKind, CompletionList, Documentation, InsertTextFormat, MarkupContent, MarkupKind,
};

pub(crate) fn extensions_completion(completion_list: &mut CompletionList) {
    completion_list.items.push(CompletionItem {
        label: "extensions".to_owned(),
        insert_text: Some("extensions = [$0]".to_owned()),
        insert_text_format: Some(InsertTextFormat::SNIPPET),
        kind: Some(CompletionItemKind::FIELD),
        documentation: Some(Documentation::MarkupContent(MarkupContent {
            kind: MarkupKind::Markdown,
            value: format_completion_docs(
                r#"extensions = [pg_trgm, postgis(version: "2.1")]"#,
                r#"Enable PostgreSQL extensions. [Learn more](https://pris.ly/d/postgresql-extensions)"#,
                None,
            ),
        })),
        ..Default::default()
    })
}

pub(crate) fn schemas_completion(completion_list: &mut CompletionList) {
    completion_list.items.push(CompletionItem {
        label: "schemas".to_owned(),
        insert_text: Some(r#"schemas = [$0]"#.to_owned()),
        insert_text_format: Some(InsertTextFormat::SNIPPET),
        kind: Some(CompletionItemKind::FIELD),
        documentation: Some(Documentation::MarkupContent(MarkupContent {
            kind: MarkupKind::Markdown,
            value: format_completion_docs(
                r#"schemas = ["foo", "bar", "baz"]"#,
                "The list of database schemas. [Learn More](https://pris.ly/d/multi-schema-configuration)",
                None,
            ),
        })),
        // detail: Some("schemas".to_owned()),
        ..Default::default()
    });
}