mirror of
https://github.com/open-goal/jak-project
synced 2026-06-28 19:21:06 -04:00
01c70368e3
* lsp: json-rpc example is working, a decent place to start... * lsp: vendor library * lsp: cleanup and time to get started * lsp: commit what i got so far * lsp: example `initialize` payload * lsp: switch to `stdio` * stash * modularize the lsp implementation * lsp: implement first actual LSP feature - function names in outline * lsp: produce document diagnostics * lsp: remove unused third-party lib * lsp: support hovering MIPS instructions in IR files * lsp: basic go-to all-types definition * stash * lsp: cleanup code, just need to add it to the release artifacts * fix some project configuration * fix linux build * lsp: add lsp to PR artifacts and release assets * lsp: address feedback
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "common_types.h"
|
|
|
|
namespace LSPSpec {
|
|
/**
|
|
* 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.
|
|
*
|
|
* 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 {
|
|
std::string m_kind; // Actually a MarkupKind which is either 'plaintext' or 'markdown'
|
|
std::string m_value;
|
|
};
|
|
|
|
void to_json(json& j, const MarkupContent& obj);
|
|
void from_json(const json& j, MarkupContent& obj);
|
|
|
|
struct Hover {
|
|
/// @brief The hover's content
|
|
MarkupContent m_contents;
|
|
/// @brief An optional range is a range inside a text document that is used to visualize a hover,
|
|
/// e.g. by changing the background color.
|
|
std::optional<Range> m_range;
|
|
};
|
|
|
|
void to_json(json& j, const Hover& obj);
|
|
void from_json(const json& j, Hover& obj);
|
|
|
|
} // namespace LSPSpec
|