From 0bf899a5f8110fbea97272bdda03b68b91745e51 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 1 Jul 2022 15:09:24 -0700 Subject: Language server: auto completion of `import` file and directories. (#2312) * Language server: auto completion of `import` file and directories. * Completion of include path. * Improvements. Co-authored-by: Yong He --- .../compiler-core/slang-language-server-protocol.h | 83 +++++++++++++++++----- 1 file changed, 65 insertions(+), 18 deletions(-) (limited to 'source/compiler-core/slang-language-server-protocol.h') diff --git a/source/compiler-core/slang-language-server-protocol.h b/source/compiler-core/slang-language-server-protocol.h index fbc79acca..316c15c04 100644 --- a/source/compiler-core/slang-language-server-protocol.h +++ b/source/compiler-core/slang-language-server-protocol.h @@ -176,6 +176,24 @@ struct Range static const StructRttiInfo g_rttiInfo; }; +struct TextEdit +{ + /** + * The range of the text document to be manipulated. To insert + * text into a document create a range where start === end. + */ + Range range; + + /** + * The string to be inserted. For delete operations use an + * empty string. + */ + String newText; + + static const StructRttiInfo g_rttiInfo; + +}; + struct DidOpenTextDocumentParams { TextDocumentItem textDocument; @@ -605,6 +623,53 @@ struct CompletionItem static const StructRttiInfo g_rttiInfo; }; +struct TextEditCompletionItem +{ + /** + * The label of this completion item. + * + * The label property is also by default the text that + * is inserted when selecting this completion. + * + * If label details are provided the label itself should + * be an unqualified name of the completion item. + */ + String label; + + /** + * The kind of this completion item. Based of the kind + * an icon is chosen by the editor. The standardized set + * of available values is defined in `CompletionItemKind`. + */ + CompletionItemKind kind = CompletionItemKind(0); + + /** + * A human-readable string with additional information + * about this item, like type or symbol information. + */ + String detail; + + /** + * A human-readable string that represents a doc-comment. + */ + MarkupContent documentation; + + TextEdit textEdit; + + /** + * An optional set of characters that when pressed while this completion is + * active will accept it first and then type that character. *Note* that all + * commit characters should have `length=1` and that superfluous characters + * will be ignored. + */ + List commitCharacters; + + // Additional data. + String data; + + static const StructRttiInfo g_rttiInfo; +}; + struct SemanticTokensParams : WorkDoneProgressParams { TextDocumentIdentifier textDocument; @@ -921,24 +986,6 @@ struct InlayHintParams static const UnownedStringSlice methodName; }; -struct TextEdit -{ - /** - * The range of the text document to be manipulated. To insert - * text into a document create a range where start === end. - */ - Range range; - - /** - * The string to be inserted. For delete operations use an - * empty string. - */ - String newText; - - static const StructRttiInfo g_rttiInfo; - -}; - typedef int InlayHintKind; const int kInlayHintKindType = 1; const int kInlayHintKindParameter = 2; -- cgit v1.2.3