summaryrefslogtreecommitdiff
path: root/ted-internal.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-08 22:59:47 -0400
committerpommicket <pommicket@gmail.com>2023-09-08 22:59:47 -0400
commit0dcfd5a4f1fd865c24c01b17b214e1f72e4c06fe (patch)
treed693d70a57713cf4dbe48d30159100bab279c77d /ted-internal.h
parentf86b0aa1e843646056c08a91fcc759aa0d8a57ba (diff)
LSP code formatting (not entirely working yet)
Diffstat (limited to 'ted-internal.h')
-rw-r--r--ted-internal.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/ted-internal.h b/ted-internal.h
index a9ee175..6868895 100644
--- a/ted-internal.h
+++ b/ted-internal.h
@@ -208,6 +208,9 @@ typedef struct Autocomplete Autocomplete;
/// data needed for finding usages
typedef struct Usages Usages;
+/// data needed for formatting code
+typedef struct Formatting Formatting;
+
/// max number of signatures to display at a time.
#define SIGNATURE_HELP_MAX 5
@@ -340,6 +343,7 @@ struct Ted {
Highlights *highlights;
Usages *usages;
RenameSymbol *rename_symbol;
+ Formatting *formatting;
FILE *log;
@@ -450,6 +454,12 @@ LSPDocumentPosition buffer_pos_to_lsp_document_position(TextBuffer *buffer, Buff
BufferPos buffer_pos_from_lsp(TextBuffer *buffer, LSPPosition lsp_pos);
/// Get the cursor position as an LSPPosition.
LSPPosition buffer_cursor_pos_as_lsp_position(TextBuffer *buffer);
+/// Get the current selection as an LSPRange.
+///
+/// Returns `(LSPRange){0}` if nothing is selected.
+LSPRange buffer_selection_as_lsp_range(TextBuffer *buffer);
+/// Apply LSP TextEdit from response
+void buffer_apply_lsp_text_edit(TextBuffer *buffer, const LSPResponse *response, const LSPTextEdit *edit);
/// Get the cursor position as an LSPDocumentPosition.
LSPDocumentPosition buffer_cursor_pos_as_lsp_document_position(TextBuffer *buffer);
/// highlight an \ref LSPRange in this buffer.
@@ -617,6 +627,16 @@ void document_link_quit(Ted *ted);
void document_link_frame(Ted *ted);
void document_link_process_lsp_response(Ted *ted, const LSPResponse *response);
+
+// === ide-format.c ===
+/// initialize formatting stuff
+void format_init(Ted *ted);
+void format_process_lsp_response(Ted *ted, const LSPResponse *response);
+/// cancel last formatting request
+void format_cancel_request(Ted *ted);
+/// free formatting stuff
+void format_quit(Ted *ted);
+
// === ide-highlights.c ===
void highlights_init(Ted *ted);
void highlights_quit(Ted *ted);