godot/modules/gdscript/language_server/godot_lsp.h

/**************************************************************************/
/*  godot_lsp.h                                                           */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#ifndef GODOT_LSP_H
#define GODOT_LSP_H

#include "core/doc_data.h"
#include "core/object/class_db.h"
#include "core/templates/list.h"

namespace lsp {

DocumentUri;

/** Format BBCode documentation from DocData to markdown */
static String marked_documentation(const String &p_bbcode);

/**
 * Text documents are identified using a URI. On the protocol level, URIs are passed as strings.
 */
struct TextDocumentIdentifier {};

/**
 * Position in a text document expressed as zero-based line and zero-based character offset.
 * A position is between two characters like an ‘insert’ cursor in a editor.
 * Special values like for example -1 to denote the end of a line are not supported.
 */
struct Position {};

/**
 * A range in a text document expressed as (zero-based) start and end positions.
 * A range is comparable to a selection in an editor. Therefore the end position is exclusive.
 * If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line.
 */
struct Range {};

/**
 * Represents a location inside a resource, such as a line inside a text file.
 */
struct Location {};

/**
 * Represents a link between a source and a target location.
 */
struct LocationLink {};

/**
 * A parameter literal used in requests to pass a text document and a position inside that document.
 */
struct TextDocumentPositionParams {};

struct ReferenceContext {};

struct ReferenceParams : TextDocumentPositionParams {};

struct DocumentLinkParams {};

/**
 * A document link is a range in a text document that links to an internal or external resource, like another
 * text document or a web site.
 */
struct DocumentLink {};

/**
 * A textual edit applicable to a text document.
 */
struct TextEdit {};

/**
 * The edits to be applied.
 */
struct WorkspaceEdit {};

/**
 * Represents a reference to a command.
 * Provides a title which will be used to represent a command in the UI.
 * Commands are identified by a string identifier.
 * The recommended way to handle commands is to implement their execution on the server side if the client and server provides the corresponding capabilities.
 * Alternatively the tool extension code could handle the command. The protocol currently doesn’t specify a set of well-known commands.
 */
struct Command {};

// Use namespace instead of enumeration to follow the LSP specifications.
// `lsp::EnumName::EnumValue` is OK but `lsp::EnumValue` is not.

namespace TextDocumentSyncKind {
/**
 * Documents should not be synced at all.
 */
static const int None =;

/**
 * Documents are synced by always sending the full content
 * of the document.
 */
static const int Full =;

/**
 * Documents are synced by sending the full content on open.
 * After that only incremental updates to the document are
 * send.
 */
static const int Incremental =;
}; // namespace TextDocumentSyncKind

/**
 * Completion options.
 */
struct CompletionOptions {};

/**
 * Signature help options.
 */
struct SignatureHelpOptions {};

/**
 * Code Lens options.
 */
struct CodeLensOptions {};

/**
 * Rename options
 */
struct RenameOptions {};

/**
 * Document link options.
 */
struct DocumentLinkOptions {};

/**
 * Execute command options.
 */
struct ExecuteCommandOptions {};

/**
 * Save options.
 */
struct SaveOptions {};

/**
 * Color provider options.
 */
struct ColorProviderOptions {};

/**
 * Folding range provider options.
 */
struct FoldingRangeProviderOptions {};

struct TextDocumentSyncOptions {};

/**
 * Static registration options to be returned in the initialize request.
 */
struct StaticRegistrationOptions {};

/**
 * Format document on type options.
 */
struct DocumentOnTypeFormattingOptions {};

struct TextDocumentItem {};

/**
 * An event describing a change to a text document. If range and rangeLength are omitted
 * the new text is considered to be the full content of the document.
 */
struct TextDocumentContentChangeEvent {};

// Use namespace instead of enumeration to follow the LSP specifications
namespace DiagnosticSeverity {
/**
 * Reports an error.
 */
static const int Error =;
/**
 * Reports a warning.
 */
static const int Warning =;
/**
 * Reports an information.
 */
static const int Information =;
/**
 * Reports a hint.
 */
static const int Hint =;
}; // namespace DiagnosticSeverity

/**
 * Represents a related message and source code location for a diagnostic. This should be
 * used to point to code locations that cause or related to a diagnostics, e.g when duplicating
 * a symbol in a scope.
 */
struct DiagnosticRelatedInformation {};

/**
 * Represents a diagnostic, such as a compiler error or warning.
 * Diagnostic objects are only valid in the scope of a resource.
 */
struct Diagnostic {};

// Use namespace instead of enumeration to follow the LSP specifications
/**
 * Describes the content type that a client supports in various
 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
 *
 * Please note that `MarkupKinds` must not start with a `$`. This kinds
 * are reserved for internal usage.
 */
namespace MarkupKind {
static const String PlainText =;
static const String Markdown =;
}; // namespace MarkupKind

/**
 * A `MarkupContent` literal represents a string value which content is interpreted base on its
 * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
 *
 * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
 * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
 *
 * Here is an example how such a string can be constructed using JavaScript / TypeScript:
 * ```typescript
 * let markdown: MarkdownContent = {
 *  kind: MarkupKind.Markdown,
 *	value: [
 *		'# Header',
 *		'Some text',
 *		'```typescript',
 *		'someCode();',
 *		'```'
 *	].join('\n')
 * };
 * ```
 *
 * *Please Note* that clients might sanitize the return markdown. A client could decide to
 * remove HTML from the markdown to avoid script execution.
 */
struct MarkupContent {};

// Use namespace instead of enumeration to follow the LSP specifications
// `lsp::EnumName::EnumValue` is OK but `lsp::EnumValue` is not.
// And here C++ compilers are unhappy with our enumeration name like `Color`, `File`, `RefCounted` etc.
/**
 * The kind of a completion entry.
 */
namespace CompletionItemKind {
static const int Text =;
static const int Method =;
static const int Function =;
static const int Constructor =;
static const int Field =;
static const int Variable =;
static const int Class =;
static const int Interface =;
static const int Module =;
static const int Property =;
static const int Unit =;
static const int Value =;
static const int Enum =;
static const int Keyword =;
static const int Snippet =;
static const int Color =;
static const int File =;
static const int RefCounted =;
static const int Folder =;
static const int EnumMember =;
static const int Constant =;
static const int Struct =;
static const int Event =;
static const int Operator =;
static const int TypeParameter =;
}; // namespace CompletionItemKind

// Use namespace instead of enumeration to follow the LSP specifications.
/**
 * Defines whether the insert text in a completion item should be interpreted as
 * plain text or a snippet.
 */
namespace InsertTextFormat {
/**
 * The primary text to be inserted is treated as a plain string.
 */
static const int PlainText =;

/**
 * The primary text to be inserted is treated as a snippet.
 *
 * A snippet can define tab stops and placeholders with `$1`, `$2`
 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
 * the end of the snippet. Placeholders with equal identifiers are linked,
 * that is typing in one will update others too.
 */
static const int Snippet =;
}; // namespace InsertTextFormat

struct CompletionItem {};

/**
 * Represents a collection of [completion items](#CompletionItem) to be presented
 * in the editor.
 */
struct CompletionList {};

// Use namespace instead of enumeration to follow the LSP specifications
// `lsp::EnumName::EnumValue` is OK but `lsp::EnumValue` is not
// And here C++ compilers are unhappy with our enumeration name like `String`, `Array`, `Object` etc
/**
 * A symbol kind.
 */
namespace SymbolKind {
static const int File =;
static const int Module =;
static const int Namespace =;
static const int Package =;
static const int Class =;
static const int Method =;
static const int Property =;
static const int Field =;
static const int Constructor =;
static const int Enum =;
static const int Interface =;
static const int Function =;
static const int Variable =;
static const int Constant =;
static const int String =;
static const int Number =;
static const int Boolean =;
static const int Array =;
static const int Object =;
static const int Key =;
static const int Null =;
static const int EnumMember =;
static const int Struct =;
static const int Event =;
static const int Operator =;
static const int TypeParameter =;
}; // namespace SymbolKind

/**
 * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be
 * hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range,
 * e.g. the range of an identifier.
 */
struct DocumentSymbol {};

struct ApplyWorkspaceEditParams {};

struct NativeSymbolInspectParams {};

/**
 * Enum of known range kinds
 */
namespace FoldingRangeKind {
/**
 * Folding range for a comment
 */
static const String Comment =;
/**
 * Folding range for a imports or includes
 */
static const String Imports =;
/**
 * Folding range for a region (e.g. `#region`)
 */
static const String Region =;
} // namespace FoldingRangeKind

/**
 * Represents a folding range.
 */
struct FoldingRange {};

// Use namespace instead of enumeration to follow the LSP specifications
/**
 * How a completion was triggered
 */
namespace CompletionTriggerKind {
/**
 * Completion was triggered by typing an identifier (24x7 code
 * complete), manual invocation (e.g Ctrl+Space) or via API.
 */
static const int Invoked =;

/**
 * Completion was triggered by a trigger character specified by
 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
 */
static const int TriggerCharacter =;

/**
 * Completion was re-triggered as the current completion list is incomplete.
 */
static const int TriggerForIncompleteCompletions =;
} // namespace CompletionTriggerKind

/**
 * Contains additional information about the context in which a completion request is triggered.
 */
struct CompletionContext {};

struct CompletionParams : public TextDocumentPositionParams {};

/**
 * The result of a hover request.
 */
struct Hover {};

/**
 * Represents a parameter of a callable-signature. A parameter can
 * have a label and a doc-comment.
 */
struct ParameterInformation {};

/**
 * Represents the signature of something callable. A signature
 * can have a label, like a function-name, a doc-comment, and
 * a set of parameters.
 */
struct SignatureInformation {};

/**
 * Signature help represents the signature of something
 * callable. There can be multiple signature but only one
 * active and only one active parameter.
 */
struct SignatureHelp {};

/**
 * A pattern to describe in which file operation requests or notifications
 * the server is interested in.
 */
struct FileOperationPattern {};

/**
 * A filter to describe in which file operation requests or notifications
 * the server is interested in.
 */
struct FileOperationFilter {};

/**
 * The options to register for file operations.
 */
struct FileOperationRegistrationOptions {};

/**
 * The server is interested in file notifications/requests.
 */
struct FileOperations {};

/**
 * Workspace specific server capabilities
 */
struct Workspace {};

struct ServerCapabilities {};

struct InitializeResult {};

struct GodotNativeClassInfo {};

/** Features not included in the standard lsp specifications */
struct GodotCapabilities {};

/** Format BBCode documentation from DocData to markdown */
static String marked_documentation(const String &p_bbcode) {}
} // namespace lsp

#endif // GODOT_LSP_H